diff --git a/home/stormux/Documents/system_updates.md b/home/stormux/Documents/system_updates.md new file mode 100644 index 0000000..aa74d20 --- /dev/null +++ b/home/stormux/Documents/system_updates.md @@ -0,0 +1,98 @@ +# System Updates + +## Overview + +The Stormux Gaming Image includes a system update feature that keeps your system current with the latest packages and configuration files. Updates are performed through the main menu system and require minimal user interaction. + +## How to Update + +1. Open the Game Launcher (automatically starts on boot) +2. Navigate to the "System" menu (from initial load of the image, press left once) +3. Select "System Update" +4. Enter your username and password when prompted (only required when credentials change on the server username is always patron) +5. The update process will run automatically +6. Review the update summary when complete +7. Press Enter to return to the menu + +## What Gets Updated + +The system update performs two main operations: + +### 1. Package Updates +- Updates all installed system packages using pacman +- Includes kernel updates, applications, and libraries +- Runs non-interactively with automatic confirmations + +### 2. Configuration File Sync +- Downloads the latest custom image files and deploys them +- Updates system configuration files +- Refreshes user utilities and applications +- Updates documentation and resources +- Preserves user data and settings + +## Update Logs + +All update operations are logged for troubleshooting and review: + +**Log Location**: `~/Logs/system-updates.log` + +The log file contains: +- Timestamp for each update session +- Complete output from package updates +- Git operations (clone, checkout, LFS pull) +- File copy operations +- Error messages if any operations fail +- Success/failure summary + +## Understanding the Summary + +At the end of each update, you'll see one of two messages: + +### Successful Update +``` +SUCCESS: All update operations completed successfully. +``` + +### Failed Update +``` +ERRORS DETECTED: 2 error(s) occurred during update: + - Package update failed + - Git clone failed +``` + +If errors are detected, review the log file for detailed information about what went wrong. + +## Common Issues + +### Authentication Required +If the server credentials have changed, you'll be prompted for your username and password. This is normal and only happens when credentials are updated on the server. + +### Network Issues +Updates require an internet connection. If git clone or package updates fail, verify your network connection and try again. + +### Insufficient Disk Space +Package updates require free disk space. If updates fail, check available space. + +## Update Frequency + + +## Safety Features + +- Updates are logged for troubleshooting +- User files and settings are preserved +- File ownership is automatically corrected +- Screen reader remains active throughout the process +- Summary shows if any operations failed + +## Getting Help + +If you experience persistent update issues: +1. Review the log file at `~/Logs/system-updates.log` +2. Contact Stormux with your log file (email address storm_dragon@stormux.org) + +## Notes + +- The script runs with root privileges to update system files +- Your personal data in ~/Music, ~/Roms, and other user directories is never modified +- Configuration files like .w3m and .irssi are excluded from updates to preserve your settings +- Updates can take several minutes depending on internet speed and the number of packages diff --git a/usr/local/bin/live-update.sh b/usr/local/bin/live-update.sh index abb8fcb..9c52331 100755 --- a/usr/local/bin/live-update.sh +++ b/usr/local/bin/live-update.sh @@ -9,17 +9,50 @@ sudo -n /usr/bin/systemctl start fenrirscreenreader.service # Clear the screen before loading clear -# Update system packages (run as stormux user since yay shouldn't run as root) -pacman -Syu --noconfirm +# Setup logging +logDir="/home/stormux/Logs" +logFile="${logDir}/system-updates.log" +mkdir -p "${logDir}" +echo "=== System Update Started: $(date) ===" | tee "${logFile}" + +# Track errors +errorCount=0 +errorMessages=() + +# Clean up old packages keeping currently installed versions only +pacman -Sc --noconfirm 2>&1 | tee -a "${logFile}" +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + ((errorCount++)) + errorMessages+=("Package cleaning failed") +fi + +# Upgrade the system +pacman -Syu --noconfirm 2>&1 | tee -a "${logFile}" +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + ((errorCount++)) + errorMessages+=("Package update failed") +fi gitUrl="https://git.stormux.org/storm/gaming-image-files" gitPath="${gitUrl##*/}" pushd /tmp || exit git config --global credential.helper store -git clone "${gitUrl}" +git clone "${gitUrl}" 2>&1 | tee -a "${logFile}" +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + ((errorCount++)) + errorMessages+=("Git clone failed") +fi pushd "${gitPath}" || exit -git checkout master -git lfs pull +git checkout master 2>&1 | tee -a "${logFile}" +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + ((errorCount++)) + errorMessages+=("Git checkout master failed") +fi +git lfs pull 2>&1 | tee -a "${logFile}" +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + ((errorCount++)) + errorMessages+=("Git LFS pull failed") +fi # Files and directories to ignore when copying ignoreFiles=(".git" "./image" ".git*" "/home/stormux/.w3m" "/home/stormux/.irssi") # Build find command with ignore patterns @@ -32,11 +65,35 @@ for ignore in "${ignoreFiles[@]}"; do fi done # Copy all files as root (preserves permissions properly) -find . "${findArgs[@]}" -type f -exec bash -c 'for i ; do cp -av --preserve=all --parents "${i}" /;done' _ "{}" \; +find . "${findArgs[@]}" -type f -exec bash -c 'for i ; do cp -av --preserve=all --parents "${i}" /;done' _ "{}" \; 2>&1 | tee -a "${logFile}" +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + ((errorCount++)) + errorMessages+=("File copy failed") +fi # Fix ownership of home directory files -chown -R stormux:users /home/stormux +chown -R stormux:users /home/stormux 2>&1 | tee -a "${logFile}" +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + ((errorCount++)) + errorMessages+=("Ownership fix failed") +fi popd || exit rm -rf "${gitPath}" popd || exit +echo "=== System Update Completed: $(date) ===" | tee -a "${logFile}" +echo | tee -a "${logFile}" + +# Display summary +if [[ $errorCount -eq 0 ]]; then + echo "SUCCESS: All update operations completed successfully." | tee -a "${logFile}" +else + echo "ERRORS DETECTED: $errorCount error(s) occurred during update:" | tee -a "${logFile}" + for error in "${errorMessages[@]}"; do + echo " - $error" | tee -a "${logFile}" + done +fi +echo | tee -a "${logFile}" + +read -r -p "Press enter to continue." + exit 0