Add --no-sudo and --print to debug

This commit is contained in:
Ryan Hughes
2026-01-03 16:33:08 -05:00
parent fdee76e2d2
commit 16a9bc295c

View File

@@ -1,7 +1,34 @@
#!/bin/bash
NO_SUDO=false
PRINT_ONLY=false
while [[ $# -gt 0 ]]; do
case "$1" in
--no-sudo)
NO_SUDO=true
shift
;;
--print)
PRINT_ONLY=true
shift
;;
*)
echo "Unknown option: $1"
echo "Usage: omarchy-debug [--no-sudo] [--print]"
exit 1
;;
esac
done
LOG_FILE="/tmp/omarchy-debug.log"
if [ "$NO_SUDO" = true ]; then
DMESG_OUTPUT="(skipped - --no-sudo flag used)"
else
DMESG_OUTPUT="$(sudo dmesg)"
fi
cat > "$LOG_FILE" <<EOF
Date: $(date)
Hostname: $(hostname)
@@ -15,7 +42,7 @@ $(inxi -Farz)
=========================================
DMESG
=========================================
$(sudo dmesg)
$DMESG_OUTPUT
=========================================
JOURNALCTL (CURRENT BOOT, ERRORS ONLY)
@@ -28,6 +55,11 @@ 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[@]}")