BashUpdate is a simple Bash script for performing routine system updates and maintenance on Raspberry Pi and Debian-based systems. It not only updates system packages but also handles Docker maintenance and performs Raspberry Pi–specific tasks such as firmware updates and optional Unifi controller updates.
-
System Updates & Upgrades:
- Updates package lists using
apt update - Performs a full system upgrade with
apt full-upgrade - Removes unnecessary packages with
apt autoremove
- Updates package lists using
-
Disk Space Check:
- Verifies that a minimum disk space threshold (~512MB by default) is available before executing updates.
-
Raspberry Pi Specific Tasks:
- Checks for Raspberry Pi hardware and, if detected, prompts for a firmware upgrade using
rpi-update - Optionally runs a Unifi update script (
unifi-update.sh) if available
- Checks for Raspberry Pi hardware and, if detected, prompts for a firmware upgrade using
-
Firmware Updates (fwupd):
- Installs
fwupdif not present - Lists available firmware devices with
fwupdmgr get-devices - Refreshes firmware metadata with
fwupdmgr refresh --force - Checks for firmware updates with
fwupdmgr get-updates - Applies firmware updates with
fwupdmgr update
- Installs
-
Docker Maintenance:
- If Docker is installed, the script will run Docker-specific maintenance, including:
- Downloading and executing
dockcheck.shif not present locally - Pruning unused Docker containers, networks, images, and volumes
- Downloading and executing
- If Docker is installed, the script will run Docker-specific maintenance, including:
-
Verbose Mode:
- Use the
-voption to enable detailed output (using shell's debug mode).
- Use the
- Operating System: Debian-based systems or Raspberry Pi OS
- Bash: Tested on version 4.x or higher
- Privileges: Must be run as root (or via
sudo) - Optional Dependencies:
rpi-updatefor firmware updates (the script will install it if missing)fwupdfor firmware updates (the script will install it if missing)docker(if you want to perform Docker maintenance)curlfor downloading external scripts if needed