From 09377e37ea856f809951b69a635368f1a9030912 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Sat, 4 Apr 2026 19:54:01 +0100 Subject: [PATCH] chore(hygiene): final script cleanup and persistence fixes - Remove remaining obsolete Arch-era scripts (branch-set, debug, upload-log, etc.) - Add /var/lib/fprint to impermanence persistence for fingerprint survival - Add /etc/supergfxd.conf to impermanence persistence for GPU mode survival --- bin/nomarchy-branch-set | 17 ----- bin/nomarchy-channel-set | 31 -------- bin/nomarchy-debug | 95 ----------------------- bin/nomarchy-update-analyze-logs | 11 --- bin/nomarchy-upload-log | 126 ------------------------------- bin/nomarchy-version | 2 - bin/nomarchy-version-branch | 3 - modules/system/impermanence.nix | 2 + 8 files changed, 2 insertions(+), 285 deletions(-) delete mode 100755 bin/nomarchy-branch-set delete mode 100755 bin/nomarchy-channel-set delete mode 100755 bin/nomarchy-debug delete mode 100755 bin/nomarchy-update-analyze-logs delete mode 100755 bin/nomarchy-upload-log delete mode 100755 bin/nomarchy-version delete mode 100755 bin/nomarchy-version-branch diff --git a/bin/nomarchy-branch-set b/bin/nomarchy-branch-set deleted file mode 100755 index 9c053d1..0000000 --- a/bin/nomarchy-branch-set +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Set the branch for Nomarchy's git repository. - -if (($# == 0)); then - echo "Usage: nomarchy-branch-set [master|rc|dev]" - exit 1 -else - branch="$1" -fi - -if [[ $branch != "master" && $branch != "rc" && $branch != "dev" ]]; then - echo "Error: Invalid branch '$branch'. Must be one of: master, rc, dev" - exit 1 -fi - -git -C $OMARCHY_PATH switch $branch diff --git a/bin/nomarchy-channel-set b/bin/nomarchy-channel-set deleted file mode 100755 index 5cf0dfe..0000000 --- a/bin/nomarchy-channel-set +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# Set the Nomarchy channel, which dictates what git branch and package repository is used. -# -# Stable uses the master branch, which only sees updates on official releases, and -# the stable package repository, which typically lags the edge by a month to ensure -# better compatibility. -# -# Edge tracks the latest package repository, but still relies on the master branch, -# so new packages which require config changes may cause conflicts or errors. -# -# Dev tracks the active development dev branch, which may include partial or broken updates, -# as well as the latest package repository. This should only be used by Nomarchy developers -# and people with a lot of experience managing Linux systems. - -if (($# == 0)); then - echo "Usage: nomarchy-channel-set [stable|rc|edge|dev]" - exit 1 -else - channel="$1" -fi - -case "$channel" in -"stable") nomarchy-branch-set "master" && nomarchy-refresh-pacman "stable" ;; -"rc") nomarchy-branch-set "rc" && nomarchy-refresh-pacman "rc" ;; -"edge") nomarchy-branch-set "master" && nomarchy-refresh-pacman "edge" ;; -"dev") nomarchy-branch-set "dev" && nomarchy-refresh-pacman "edge" ;; -*) echo "Unknown channel: $channel"; exit 1; ;; -esac - -nomarchy-update -y diff --git a/bin/nomarchy-debug b/bin/nomarchy-debug deleted file mode 100755 index 57a4e4c..0000000 --- a/bin/nomarchy-debug +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -# Return exhaustive debugging information about the system to help diagnose problems. - -NO_SUDO=false -PRINT_ONLY=false - -while (( $# > 0 )); do - case "$1" in - --no-sudo) - NO_SUDO=true - shift - ;; - --print) - PRINT_ONLY=true - shift - ;; - *) - echo "Unknown option: $1" - echo "Usage: nomarchy-debug [--no-sudo] [--print]" - exit 1 - ;; - esac -done - -LOG_FILE="/tmp/nomarchy-debug.log" - -if [[ $NO_SUDO = "true" ]]; then - DMESG_OUTPUT="(skipped - --no-sudo flag used)" -else - DMESG_OUTPUT="$(sudo dmesg)" -fi - -cat > "$LOG_FILE" </dev/null || echo "unknown") - -========================================= -SYSTEM INFORMATION -========================================= -$(inxi -Farz) - -========================================= -DMESG -========================================= -$DMESG_OUTPUT - -========================================= -JOURNALCTL (CURRENT BOOT, WARNINGS+ERRORS) -========================================= -$(journalctl -b -p 4..1) - -========================================= -INSTALLED PACKAGES -========================================= -$({ expac -S '%n %v (%r)' $(pacman -Qqe) 2>/dev/null; comm -13 <(pacman -Sql | sort) <(pacman -Qqe | sort) | xargs -r expac -Q '%n %v (AUR)'; } | sort) -EOF - -if [[ $PRINT_ONLY = "true" ]]; then - cat "$LOG_FILE" - exit 0 -fi - -OPTIONS=("View log" "Save in current directory") -if ping -c 1 8.8.8.8 >/dev/null 2>&1; then - OPTIONS=("Upload log" "${OPTIONS[@]}") -fi - -ACTION=$(gum choose "${OPTIONS[@]}") - -case "$ACTION" in - "Upload log") - echo "Uploading debug log to 0x0.st..." - URL=$(curl -sF "file=@$LOG_FILE" -Fexpires=24 https://0x0.st) - if (( $? == 0 )) && [[ -n $URL ]]; then - echo "✓ Log uploaded successfully!" - echo "Share this URL:" - echo "" - echo " $URL" - echo "" - echo "This link will expire in 24 hours." - else - echo "Error: Failed to upload log file" - exit 1 - fi - ;; - "View log") - less "$LOG_FILE" - ;; - "Save in current directory") - cp "$LOG_FILE" "./nomarchy-debug.log" - echo "✓ Log saved to $(pwd)/nomarchy-debug.log" - ;; -esac diff --git a/bin/nomarchy-update-analyze-logs b/bin/nomarchy-update-analyze-logs deleted file mode 100755 index 1a5d3bf..0000000 --- a/bin/nomarchy-update-analyze-logs +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -update_log="/tmp/nomarchy-update.log" - -# Check for initramfs generation failure -if grep -q "Updating linux initcpios" "$update_log"; then - if ! grep -q "Initcpio image generation successful" "$update_log"; then - echo -e '\e[31mError: Initramfs generation may have failed. Review logs before restart.\e[0m' - echo - fi -fi diff --git a/bin/nomarchy-upload-log b/bin/nomarchy-upload-log deleted file mode 100755 index d1853c4..0000000 --- a/bin/nomarchy-upload-log +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash - -# Upload logs to 0x0.st - -LOG_TYPE="${1:-install}" -TEMP_LOG="/tmp/upload-log.txt" -SYSTEM_INFO="/tmp/system-info.txt" - -# Get system information if fastfetch is available -if command -v fastfetch >/dev/null 2>&1; then - { - echo "=========================================" - echo "SYSTEM INFORMATION" - echo "=========================================" - # Use fastfetch with no logo to get clean output - fastfetch --logo none --pipe 2>/dev/null || echo "Failed to get system info" - echo "" - echo "=========================================" - echo "LOG CONTENT" - echo "=========================================" - echo "" - } >"$SYSTEM_INFO" -else - # Fallback to basic info if fastfetch isn't available - { - echo "=========================================" - echo "SYSTEM INFORMATION" - echo "=========================================" - echo "Hostname: $(hostname)" - echo "Kernel: $(uname -r)" - echo "Date: $(date)" - echo "" - echo "=========================================" - echo "LOG CONTENT" - echo "=========================================" - echo "" - } >"$SYSTEM_INFO" -fi - -case "$LOG_TYPE" in -install) - ARCHINSTALL_LOG="/var/log/archinstall/install.log" - OMARCHY_LOG="/var/log/nomarchy-install.log" - - # Combine system info with logs - cat "$SYSTEM_INFO" >"$TEMP_LOG" - cat $ARCHINSTALL_LOG $OMARCHY_LOG >>"$TEMP_LOG" 2>/dev/null - - if [[ ! -s $TEMP_LOG ]]; then - echo "Error: No install logs found" - exit 1 - fi - - echo "Uploading installation log to 0x0.st..." - ;; - -this-boot) - # Combine system info with boot logs - cat "$SYSTEM_INFO" >"$TEMP_LOG" - journalctl -b 0 >>"$TEMP_LOG" 2>/dev/null - - if [[ ! -s $TEMP_LOG ]]; then - echo "Error: No logs found for current boot" - exit 1 - fi - - echo "Uploading current boot logs to 0x0.st..." - ;; - -last-boot) - # Combine system info with previous boot logs - cat "$SYSTEM_INFO" >"$TEMP_LOG" - journalctl -b -1 >>"$TEMP_LOG" 2>/dev/null - - if [[ ! -s $TEMP_LOG ]]; then - echo "Error: No logs found for previous boot" - exit 1 - fi - - echo "Uploading previous boot logs to 0x0.st..." - ;; - -installed|system-info) - # System info plus all installed packages - cat "$SYSTEM_INFO" >"$TEMP_LOG" - { - echo "" - echo "=========================================" - echo "INSTALLED PACKAGES (pacman -Q)" - echo "=========================================" - pacman -Q 2>/dev/null || echo "Failed to get package list" - } >>"$TEMP_LOG" - - if [[ ! -s $TEMP_LOG ]]; then - echo "Error: Failed to gather system information" - exit 1 - fi - - echo "Uploading system information to 0x0.st..." - ;; - -*) - echo "Usage: $0 [install|this-boot|last-boot|installed|system-info]" - echo " install - Upload installation logs (default)" - echo " this-boot - Upload logs from current boot" - echo " last-boot - Upload logs from previous boot" - echo " installed - Upload system info and installed packages" - exit 1 - ;; -esac - -echo "" - -URL=$(curl -sF "file=@$TEMP_LOG" -Fexpires=24 https://0x0.st) - -if (( $? == 0 )) && [[ -n $URL ]]; then - echo "✓ Log uploaded successfully!" - echo "Share this URL:" - echo "" - echo " $URL" - echo "" - echo "This link will expire in 24 hours." -else - echo "Error: Failed to upload log file" - exit 1 -fi diff --git a/bin/nomarchy-version b/bin/nomarchy-version deleted file mode 100755 index 5ddc823..0000000 --- a/bin/nomarchy-version +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -cat $OMARCHY_PATH/version diff --git a/bin/nomarchy-version-branch b/bin/nomarchy-version-branch deleted file mode 100755 index 43281d9..0000000 --- a/bin/nomarchy-version-branch +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -echo $(git -C "$OMARCHY_PATH" rev-parse --abbrev-ref HEAD) diff --git a/modules/system/impermanence.nix b/modules/system/impermanence.nix index d1f23a3..3a0cdaa 100644 --- a/modules/system/impermanence.nix +++ b/modules/system/impermanence.nix @@ -49,12 +49,14 @@ in "/var/lib/systemd/coredump" "/var/lib/systemd/timesync" "/var/lib/bluetooth" + "/var/lib/fprint" "/etc/NetworkManager/system-connections" "/etc/nixos" "/etc/ssh" ]; files = [ "/etc/machine-id" + "/etc/supergfxd.conf" ]; }; };