ubuntu_debian_update_verbose.sh - limehawk/rmm-scripts GitHub Wiki

ubuntu_debian_update_verbose.sh

Automated system update script for Ubuntu/Debian systems with verbose output, color-coded status messages, and configurable update options.

Overview

Automates system package updates for Ubuntu/Debian systems with verbose output and error handling. Updates package lists, upgrades installed packages, removes unused dependencies, and cleans package cache. Provides color-coded status messages and reboot detection.

Purpose

Automates system package updates for Ubuntu/Debian systems with verbose output and error handling. Updates package lists, upgrades installed packages, removes unused dependencies, and cleans package cache. Provides color-coded status messages and reboot detection.

Prerequisites

  • Root/sudo access required
  • Ubuntu or Debian-based Linux distribution
  • Network connectivity to package repositories
  • apt package manager

Configuration

Required Inputs

All configuration is hardcoded within the script.

ENSURE_APT_UTILS - Install apt-utils if missing

  • Default: true
  • Type: Boolean

ENABLE_FULL_UPGRADE - Use dist-upgrade instead of upgrade

  • Default: false
  • Type: Boolean

ENABLE_AUTOREMOVE - Remove unused packages after upgrade

  • Default: true
  • Type: Boolean

ENABLE_CACHE_CLEAN - Clean apt cache to free disk space

  • Default: true
  • Type: Boolean

ENABLE_COLOR_OUTPUT - Use colored terminal output

  • Default: true
  • Type: Boolean

Behavior

  1. Updates package lists from repositories
  2. Ensures apt-utils is installed for proper configuration
  3. Upgrades all system packages (or performs dist-upgrade if enabled)
  4. Removes unused packages and dependencies if enabled
  5. Cleans apt cache if enabled
  6. Checks if system reboot is required and notifies user

Security Notes

  • No secrets exposed in output
  • Uses DEBIAN_FRONTEND=noninteractive to prevent interactive prompts
  • Runs with elevated privileges (sudo required)

Exit Codes

  • 0 - Success (all updates completed)
  • Non-zero - Failure (error occurred during execution)

Example Output

=== Starting System Update ===

--- Starting: Updating package lists ---
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
+++ Success: Updating package lists +++

--- apt-utils already installed ---

--- Starting: Upgrading all system packages ---
Reading package lists...
Building dependency tree...
+++ Success: Upgrading all system packages +++

--- Starting: Removing unused packages ---
+++ Success: Removing unused packages +++

--- Starting: Cleaning up apt cache ---
+++ Success: Cleaning up apt cache +++

=== All System Update Tasks Complete ===

*** System reboot required ***

Version History

  • v1.0.0 (2024-11-18) - Updated with Limehawk Style A formatting

Links