Skip to content

Instantly share code, notes, and snippets.

@GiovanniGrieco
Created March 24, 2021 22:15
Show Gist options
  • Save GiovanniGrieco/d430c3a4143dc13256d8d6242e0c29bd to your computer and use it in GitHub Desktop.
Save GiovanniGrieco/d430c3a4143dc13256d8d6242e0c29bd to your computer and use it in GitHub Desktop.
Automatically upgrade Raspberry Pi OS software packages
#!/bin/bash
if [ "$EUID" -ne "0" ]; then
echo "Please run this script as root."
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
apt update
SPECIAL_PKGS=$(apt list --upgradable | egrep "(firmware|kernel)")
apt upgrade -y
if [ ! -z "$SPECIAL_PKGS" ]; then
reboot
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment