diff options
Diffstat (limited to 'system/usr/system-update')
| -rwxr-xr-x | system/usr/system-update | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/system/usr/system-update b/system/usr/system-update new file mode 100755 index 0000000..4187e46 --- /dev/null +++ b/system/usr/system-update @@ -0,0 +1,36 @@ +#!/bin/bash +# /usr/local/bin/sys-update +# Formal system maintenance utility with administrative enforcement + +LOG_FILE="/var/log/system-update.log" + +# Administrative Privileges Check +if [ "$EUID" -ne 0 ]; then + printf ":: [ERROR] This utility requires administrative privileges. Please execute with 'sudo'.\n" >&2 + exit 1 +fi + +set -e + +log_message() { + printf "[$(date +'%Y-%m-%d %H:%M:%S')] %s\n" "$1" >> "$LOG_FILE" +} + +log_message "START: Commencing system maintenance cycle." +printf ":: Initializing hardware state: Activating discrete GPU...\n" +gpu-toggle on + +printf ":: Synchronizing package repositories and performing system upgrade...\n" +xbps-install -Su + +printf ":: Commencing filesystem optimization and orphan removal...\n" +xbps-remove -Oo + +printf ":: Executing kernel image purge for obsolete versions...\n" +vkpurge rm all + +printf ":: Restoring power-efficient state: Deactivating discrete GPU...\n" +gpu-toggle off + +log_message "FINISH: Maintenance cycle completed successfully." +printf ":: [SUCCESS] Operation logged to %s\n" "$LOG_FILE" |
