User Tools

Site Tools


pages:howtos:tmux:runnig_updates_in_tmux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
pages:howtos:tmux:runnig_updates_in_tmux [2022/04/13 13:08] – [Sources] mischerhpages:howtos:tmux:runnig_updates_in_tmux [2022/06/19 17:07] (current) – [Implementation] mischerh
Line 6: Line 6:
   * update git repositories   * update git repositories
   * update flatpak packages   * update flatpak packages
-  * update snap packages+  * <del>update snap packages</del> (it seems like snaps will get updated automatically)
  
 ===== Sources ===== ===== Sources =====
Line 18: Line 18:
   * https://www.cyberciti.biz/faq/using-heredoc-rediection-in-bash-shell-script-to-write-to-file/   * https://www.cyberciti.biz/faq/using-heredoc-rediection-in-bash-shell-script-to-write-to-file/
   * https://www.cyberciti.biz/faq/find-linux-distribution-name-version-number/   * https://www.cyberciti.biz/faq/find-linux-distribution-name-version-number/
 +  * https://wiki.archlinux.org/title/Flatpak#Update_a_runtime_or_application
  
 ===== ToDo ===== ===== ToDo =====
Line 25: Line 26:
 <sxh bash; gutter: false> <sxh bash; gutter: false>
 zypper in lsb-release zypper in lsb-release
 +
  
 install -bD --owner=root --group=root --mode=0750 -T <(cat << 'EOF' install -bD --owner=root --group=root --mode=0750 -T <(cat << 'EOF'
 #!/bin/bash #!/bin/bash
 +  
 # debug # debug
-set -x +#set -x 
 +  
 +declare _updatecommand 
 +declare _flatpak_updatecommand 
 +declare _gitup_user_updatecommand
 declare _osvendor declare _osvendor
 declare _highlevelpackagemanager declare _highlevelpackagemanager
-declare _updatecommand +declare _os_updatecommand 
 +  
 +_flatpak_updatecommand="flatpak --system update -y" 
 +_gitup_user_updatecommand="sudo -u def python3.8 /home/def/.local/bin/gitup" 
 +  
 if [ ! command -v lsb-release >/dev/null 2>&1 ] && [ ! command -v lsb_release >/dev/null 2>&1 ]  if [ ! command -v lsb-release >/dev/null 2>&1 ] && [ ! command -v lsb_release >/dev/null 2>&1 ] 
 then  then 
Line 41: Line 49:
     exit 1;     exit 1;
 fi fi
 +  
 _osvendor="$( lsb-release -is )" _osvendor="$( lsb-release -is )"
- +   
 +  
 case $_osvendor in case $_osvendor in
     openSUSE)     openSUSE)
         _highlevelpackagemanager="$( command -v zypper )"         _highlevelpackagemanager="$( command -v zypper )"
-        _updatecommand="${_highlevelpackagemanager} ref && ${_highlevelpackagemanager} dup -y"+        _os_updatecommand="${_highlevelpackagemanager} ref && ${_highlevelpackagemanager} dup"
         ;;         ;;
-        +          
     Debian)     Debian)
         _highlevelpackagemanager="$( command -v apt )"         _highlevelpackagemanager="$( command -v apt )"
-        _updatecommand="${_highlevelpackagemanager} update && ${_highlevelpackagemanager} -y upgrade && ${_highlevelpackagemanager} -y full-upgrade"+        _os_updatecommand="${_highlevelpackagemanager} update && ${_highlevelpackagemanager} -y upgrade && ${_highlevelpackagemanager} -y full-upgrade"
         ;;         ;;
 +  
     *)     *)
-        echo >&2 "ERROR: Your operating system vendor (${_osvendor}) is not supported. Aborting."+        echo >&2 "ERROR: Your operating system (${_osvendor}) is not supported. Aborting."
         exit 1         exit 1
         ;;         ;;
 esac esac
- +  
 +_updatecommand="${_flatpak_updatecommand} && ${_gitup_user_updatecommand} && ${_os_updatecommand}" 
 + 
 tmux new -s sysupdate -d tmux new -s sysupdate -d
 tmux send-keys -t sysupdate "${_updatecommand}" C-m tmux send-keys -t sysupdate "${_updatecommand}" C-m
Line 70: Line 79:
  
 ln -s /root/scripts/sysupdate/sysupdate /root/bin/AAA 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 --user
 +</sxh>
 +add ~/.local/bin to your PATH
 +<sxh bash; gutter: false>
 +vim ~/.bashrc
 +</sxh>
 +<sxh bash; highlight: []; title: ~/.bashrc>
 +# PATH
 +export PATH="${PATH}:~/bin:~/.local/bin"
 +</sxh>
 +<sxh bash; gutter: false>
 +source  ~/.bashrc
 +gitup --add ~/repos/
 </sxh> </sxh>
  
 +<sxh bash; gutter: false>
 +# 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
 +
 +</sxh>
  
 ---- ----
 ~~DISCUSSION~~ ~~DISCUSSION~~
  
pages/howtos/tmux/runnig_updates_in_tmux.1649855326.txt.gz · Last modified: 2022/04/13 13:08 by mischerh