Skip to content

Instantly share code, notes, and snippets.

@andrewpmiller
Last active March 9, 2022 13:38
Show Gist options
  • Save andrewpmiller/1f4ba7599db5070c6a4a to your computer and use it in GitHub Desktop.
Save andrewpmiller/1f4ba7599db5070c6a4a to your computer and use it in GitHub Desktop.
Pi Update bash script
#!/bin/bash
# ------------------------------------------------------------------
# Title: piupdate.sh
# Author: Andrew Miller
# Version: 0.1.1
#
# Description:
# A really simple script that runs through all of the usual updates
# for a Raspbian Raspberry Pi.
#
# Note: Use the -f flag to check and update the firmware
# (Requires https://github.com/Hexxeh/rpi-update)
# ------------------------------------------------------------------
date
echo "$(tput setaf 1)Checking for system software updates...$(tput sgr0)"
sudo apt-get update
echo "$(tput setaf 1)Updating system software...$(tput sgr0)"
sudo apt-get upgrade
echo "$(tput setaf 1)Updating distribution software...$(tput sgr0)"
sudo apt-get dist-upgrade
echo "$(tput setaf 1)Cleaning up...$(tput sgr0)"
sudo apt-get autoremove --purge
if [ "$1" = "-f" ]
then
echo "$(tput setaf 1)Checking and updating firmware...$(tput sgr0)"
sudo rpi-update
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment