Skip to content

Latest commit

 

History

History
86 lines (61 loc) · 4.02 KB

File metadata and controls

86 lines (61 loc) · 4.02 KB

Version History & Logic Refactoring

This document outlines the key differences, improvements, and architectural changes across the three major versions of the Linux System Updater script.

1. myUpdaterScript.sh (Legacy)

Path: older/myUpdaterScript.sh Role: Initial Prototype

🟢 Core Features

  • Basic Detection: Identifies Distro (/etc/os-release) and System Package Manager (apt, dnf, yum, pacman, zypper).
  • Dev Tools: Basic support for npm, yarn, bun, nvm.
  • Updates: Separate "Check" phase (reporting only) and "Apply" phase.

🔴 Limitations

  • Redundant Output: Heavy use of echo checks which cluttered the terminal.
  • Wait Times: Serial processing meant the user had to stare at checking messages before seeing a summary.
  • Error Handling: Basic set -e usage which could cause the script to crash entirely if one minor tool (like npm) failed.
  • No GUI Integration: Strictly a terminal script.

2. myUpdaterScript(2).sh (Intermediate)

Path: older/myUpdaterScript(2).sh Role: Refinement & Expansion

🟢 Improvements over V1

  • Clean Output: suppressed the "Checking..." logs. Instead, it runs checks silently and produces a Summary Table at the end.
  • Formatted Summary: Introduced formatted output (columns) for detected tools.
  • Expanded Support: Added support for:
    • snap
    • flatpak
    • brew (Homebrew)
    • fwupd (Firmware)
    • cargo (Rust)
    • pip (Python)
  • Bug Fixes: Removed duplicate function calls found in V1. Added || true to more commands to prevent crashes on non-critical failures.

🔴 Limitations

  • Hardcoded Formatting: The formatting logic was slightly brittle (printf manual alignment).
  • System Conflicts: Still attempted to force updates on system-managed environments (e.g., trying to run pip install --upgrade pip on Ubuntu, leading to PEP 668 errors).
  • Missing Binaries: Failed when node binary was missing (common on Ubuntu apt installs).

3. myUpdaterScriptV2.sh (Current Stable)

Path: myUpdaterScriptV2.sh Role: Universal, Production-Ready Modular Rewrite

🌟 Major Architectural Changes

Feature Legacy / V1 Intermediate / (2) Current V2.0
Architecture Linear Script Linear Script Modular Functions (Detection > Logic > UI)
UI/UX Text Walls Clean Table Spinners & Colors (Modern Terminal UI)
Desktop Entry Manual Manual Auto-Setup Script (setup_desktop_icon.sh)
Verbose Mode None None Dual Mode: Interactive Prompt or CLI flag (-v)
Wait Behavior Immediate Exit Immediate Exit Pause on Exit (Keeps terminal open for review)

🛡️ "System Aware" Intelligence (New in V2)

  1. Node.js Protection:

    • Problem: Ubuntu installs binary as nodejs, but scripts call node.
    • V2 Fix: detects this mismatch, warns the user to install nodejs-legacy, and skips the update to prevent ugly crash logs.
  2. PEP 668 (Python) Compliance:

    • Problem: Running pip on modern Debian/Ubuntu breaks system packages.
    • V2 Fix: Detects the EXTERNALLY-MANAGED marker file. If found, it logs an info message and skips the update, instead of failing with a red error.
  3. RubyGem Safety:

    • Problem: Updating system gems breaks apt managed ruby.
    • V2 Fix: Detects system gem paths and skips invalid updates.

🐛 Summary of Fixes

  • Fixed: env: 'node': No such file error.
  • Fixed: externally-managed-environment (Pip) error.
  • Fixed: Terminal closing immediately after execution.
  • Added: tput based coloring and spinner animations (⠋⠙⠹...).
  • Added: setup_desktop_icon.sh to automate .desktop file creation and trust settings.