Also run upgrade only if required

This commit is contained in:
Jeremy Gardais 2023-02-27 10:39:38 +01:00
parent 3e627904b9
commit 055244defb
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
2 changed files with 3 additions and 2 deletions

View File

@ -30,7 +30,7 @@ if-shell -b 'test -n $TMUX' {
# with mutt running in the first pane
new-session -A -stoto -nmail 'mutt ; exec ${SHELL}'
## Split the first window for APT upgrade
split-window -h -p 25 -ttoto:1.1 'sudo apt update ; sudo aptitude full-upgrade ; sudo aptitude clean ; exec ${SHELL}'
split-window -h -p 25 -ttoto:1.1 'sudo apt update ; test $(apt list --upgradable 2>/dev/null | wc --lines) -gt 1 && { sudo aptitude full-upgrade ; sudo aptitude clean } ; exec ${SHELL}'
#
# Second window named **Xt0p** with btop running
new-window -d -nXt0p 'btop ; exec ${SHELL}'

View File

@ -43,7 +43,8 @@ if-shell -b 'test -n $TMUX' {
split-window -d -h -tjd:2.1 -c '/home/jegardai/repos/ipr.debops'
# Third window for APT upgrade
new-window -nAPT 'sudo apt update ; sudo aptitude full-upgrade ; sudo aptitude clean ; exec ${SHELL}'
# Run upgrade only if packages to upgrade
new-window -nAPT 'sudo apt update ; test $(apt list --upgradable 2>/dev/null | wc --lines) -gt 1 && { sudo aptitude full-upgrade ; sudo aptitude clean } ; logout'
# Fourth window for authentication tools
new-window -nAuth 'gpg --quiet --for-your-eyes-only --decrypt ~/.password-store/test.gpg ; logout'