pages:howtos:tmux:runnig_updates_in_tmux
This is an old revision of the document!
Table of Contents
Running Updates In TMUX
I want to make updates to be executed inside a tmux-session to make the update process resilient against interrupted ssh-connections.
- update distribution packages on SUSE and Debian
- update git repositories
- update flatpak packages
update snap packages(it seems like snaps will get updated automatically)
Sources
ToDo
Implementation
zypper in lsb-release install -bD --owner=root --group=root --mode=0750 -T <(cat << 'EOF' #!/bin/bash # debug set -x declare _osvendor declare _highlevelpackagemanager declare _updatecommand if [ ! command -v lsb-release >/dev/null 2>&1 ] && [ ! command -v lsb_release >/dev/null 2>&1 ] then echo >&2 "ERROR: lsb-release required but it's not installed. Aborting." exit 1; fi _osvendor="$( lsb-release -is )" case $_osvendor in openSUSE) _highlevelpackagemanager="$( command -v zypper )" _updatecommand="${_highlevelpackagemanager} ref && ${_highlevelpackagemanager} dup -y" ;; Debian) _highlevelpackagemanager="$( command -v apt )" _updatecommand="${_highlevelpackagemanager} update && ${_highlevelpackagemanager} -y upgrade && ${_highlevelpackagemanager} -y full-upgrade" ;; *) echo >&2 "ERROR: Your operating system vendor (${_osvendor}) is not supported. Aborting." exit 1 ;; esac tmux new -s sysupdate -d tmux send-keys -t sysupdate "${_updatecommand}" C-m tmux attach -t sysupdate EOF ) /root/scripts/sysupdate/sysupdate ln -s /root/scripts/sysupdate/sysupdate /root/bin/AAA # as user su - <USERNAME> mkdir -pv ~/repos/extern/ git clone https://github.com/earwig/git-repo-updater.git ~/repos/extern/git-repo-updater cd ~/repos/extern/git-repo-updater python ./setup.py install --useradd ~/.local/bin to your PATH
vim ~/.bashrc
# PATH export PATH="${PATH}:~/bin:~/.local/bin"
source ~/.bashrc gitup --add ~/repos/
todo…. sudo -u <USERNAME> /home/<USERNAME>/.local/bin/gitup
# as root install -bD --owner=root --group=root --mode=0750 -T <(cat << 'EOF' [Unit] Description=Update Flatpak After=network-online.target Wants=network-online.target [Service] Type=oneshot ExecStart=/usr/bin/flatpak update --noninteractive --assumeyes [Install] WantedBy=multi-user.target EOF) /etc/systemd/user/flatpak-update.service install -bD --owner=root --group=root --mode=0750 -T <(cat << 'EOF' [Unit] Description=Update Flatpak [Timer] OnBootSec=2m OnActiveSec=2m OnUnitInactiveSec=24h OnUnitActiveSec=24h AccuracySec=1h RandomizedDelaySec=10m [Install] WantedBy=timers.target EOF) /etc/systemd/user/flatpak-update.timer
~~DISCUSSION~~
pages/howtos/tmux/runnig_updates_in_tmux.1655639558.txt.gz · Last modified: 2022/06/19 11:52 by mischerh