Skip to content

Instantly share code, notes, and snippets.

@danog
Last active August 29, 2015 14:19
Show Gist options
  • Save danog/0212e89f81297e371346 to your computer and use it in GitHub Desktop.
Save danog/0212e89f81297e371346 to your computer and use it in GitHub Desktop.
Update Debian/Ubuntu system
#!/bin/bash
# Debian/Ubuntu updater script
# Created by Daniil Gentili
if [ "$1" = "--help" ]; then
echo "Debian/Ubuntu upgrade script created by Daniil Gentili.
Usage: just type
update.sh
:)
All arguments are passed on to apt-get.
"
exit
fi
if [ $(id -u) -ne 0 ]; then
sudo $0 $*
exit $?
fi
echo "Updating package list..." &&
apt-get $* update &&
echo "Upgrading this system and all its packages..." &&
apt-get $* -y dist-upgrade &&
printf "Removing unnecessary packages..." &&
apt-get $* -y autoremove &&
echo "Cleaning up..." &&
apt-get clean &&
echo 'All done!
Bye!'
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment