Reboot prompt for updates

Experimenting with swanag stuff. Check if reboot is required, nag to reboot, include installed packages in details.
This commit is contained in:
John Mertz 2022-07-20 23:11:59 -04:00
parent 56a6299d4f
commit 539248ee70
1 changed files with 3 additions and 0 deletions

View File

@ -23,6 +23,9 @@ elif [ "$1" == 'upgrade' ]; then
COUNT=`apt list --upgradable 2> /dev/null | wc -l`
let COUNT--
echo $COUNT > /home/jpm/.spool/apt-upgradeable
if [ -e /var/run/reboot-required ]; then
cat /var/log/apt/history.log | tr "\n" "%" | sed -e 's/.*\(Start-Date\)/\1/g' | tr "%" "\n" | swaynag --config=${HOME}/.dotfiles/sway/swaynag --edge=bottom --message="New packages require restart" --button="Restart Now" "sudo systemctl reboot" --dismiss-button="Later" --detailed-message --detailed-button "Show/Hide Upgrade Details"
fi
elif [ "$1" == 'update' ]; then
sudo apt update >/dev/null 2>/dev/null
COUNT=`apt list --upgradable 2> /dev/null | wc -l`