From 3e627904b903b32ffd855607b522387e6f2b8750 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 27 Feb 2023 10:25:05 +0100 Subject: [PATCH] Run upgrade/clean only if some packages to upgrade --- splitUPDATE | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/splitUPDATE b/splitUPDATE index 969b751..6dc76e9 100644 --- a/splitUPDATE +++ b/splitUPDATE @@ -16,7 +16,8 @@ if-shell -b 'tmux has-session' { # Window for system update + # Run upgrade only if packages to upgrade display-message "Create a new window for system update" - new-window -nAPT 'sudo apt update ; sudo aptitude full-upgrade ; sudo aptitude clean ; exec ${SHELL}' + 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' } # }}}