-
-
Save Detmud/8150b792532717d7da6e59fb2c454a63 to your computer and use it in GitHub Desktop.
Default update scripts for Debian-based Linux distributions. See this blog post: http://blog.robseder.com/?p=13292
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
logger "Update Script: Starting..." | |
echo '[*] Refreshing repository cache...' | |
sudo apt-get -qq update -y | |
echo '[*] Repository cache refreshed.' | |
echo '[*] Upgrading all existing packages...' | |
sudo apt-get -qq upgrade -y | |
echo '[*] Existing packages upgraded.' | |
echo '[*] Upgrading Linux distribution (if available)...' | |
sudo apt-get -qq dist-upgrade -y | |
echo '[*] Linux distribution upgrade processed.' | |
echo '[*] Clean up unused and cached packages...' | |
sudo apt-get -qq autoclean -y | |
sudo apt-get -qq autoremove -y | |
echo '[*] Package cleanup complete.' | |
if [ $(which raspi-config | wc -l) -gt 0 ]; then | |
echo '[*] Raspberry Pi Detected.' | |
echo '[*] Update the Raspberry Pi firmware to the latest (if available)...' | |
sudo rpi-update | |
echo '[*] Done updating firmware.' | |
fi | |
logger "Update Script: Done." | |
while true; do | |
read -r -p "Do you wish to reboot? " choice | |
case "$choice" in | |
y|Y ) echo "[*] Rebooting..."; sudo reboot; break;; | |
n|N ) echo "[*] Done."; break;; | |
* ) echo "[-] Invalid response. Use 'y' or 'n'.";; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment