Skip to content

Instantly share code, notes, and snippets.

@StudioLE
Last active August 29, 2015 14:26
Show Gist options
  • Save StudioLE/035c36dbb02b6031391b to your computer and use it in GitHub Desktop.
Save StudioLE/035c36dbb02b6031391b to your computer and use it in GitHub Desktop.
Chain apt-get update > upgrade > dist-upgrade > autoremove
#!/bin/bash
echo "apt-get update & upgrade wizard"
echo "Would you like to assume yes? [y/n]"
read input_force
if [ $input_force = y ]
then
force="--yes"
fi
apt-get update
apt-get upgrade $force
echo "Run dist-upgrade? [y/n]"
read dist_upgrade
if [ $dist_upgrade = n ]
then
echo "Aborted"
exit
fi
apt-get dist-upgrade $force
echo "Run autoremove? [y/n]"
read autoremove
if [ $autoremove = n ]
then
echo "Aborted"
exit
fi
apt-get autoremove $force
if [ ! -f /var/run/reboot-required ]
then
echo "No reboot required"
exit
fi
echo "A reboot is required"
echo "Would you like to reboot now? [y/n]"
read reboot_now
if [ $reboot_now = y ]
then
echo "Rebooting"
reboot
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment