Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bin/omarchy-update-restart
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ if [[ $mode != "--reboot-only" ]]; then
echo -e "\e[32m\nRestarting shell\e[0m"
echo "All plugins have been reloaded"
omarchy-restart-shell || true

# bash holds a running crash-watch on the unlinked inode after pacman
# replaces the script, so the next toast calls the new notification
# helper with the old argv. try-restart is a no-op if it isn't running.
systemctl --user try-restart omarchy-crash-watch.service >/dev/null 2>&1 || true
Comment thread
Elshayib marked this conversation as resolved.
Resolved
fi
4 changes: 4 additions & 0 deletions test/shell.d/crash-capture-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ grep -F 'omarchy-crash-watch.service' "$ROOT/install/user/first-run/enable-user-
fail "crash capture is no longer on by default for new installs"
pass "crash capture is on by default"

grep -F 'try-restart omarchy-crash-watch.service' "$ROOT/bin/omarchy-update-restart" >/dev/null ||
fail "updates leave the running watcher on the unlinked inode after pacman replaces it"
pass "updates restart the crash watcher"

require_command jq

# The per-program mute, driven through the real watcher with a stubbed journal:
Expand Down
5 changes: 3 additions & 2 deletions test/shell.d/update-restart-phases-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
source "$SHELL_TEST_DIR/fixtures/sudo-boundary-test.sh"
rm "$SUDO_TEST_ROOT/bin/omarchy-update-restart"
copy_boundary_file bin/omarchy-update-restart
for step in omarchy-state omarchy-restart-sshd omarchy-restart-shell omarchy-system-reboot; do
for step in omarchy-state omarchy-restart-sshd omarchy-restart-shell omarchy-system-reboot systemctl; do
ln -s test-step "$SUDO_TEST_ROOT/bin/$step"
done
cat >"$SUDO_TEST_ROOT/bin/gum" <<'STUB'
Expand All @@ -24,10 +24,11 @@ for mode in --services-only --reboot-only; do
if [[ $mode == "--services-only" ]]; then
grep -q '^step:omarchy-restart-sshd ' "$SUDO_TEST_LOG" || fail "service phase did not restart a marked service"
grep -q '^step:omarchy-restart-shell ' "$SUDO_TEST_LOG" || fail "service phase did not restart the shell"
grep -q '^step:systemctl --user try-restart omarchy-crash-watch.service$' "$SUDO_TEST_LOG" || fail "service phase left the crash watcher running the replaced script"
if grep -q '^prompt:' "$SUDO_TEST_LOG"; then fail "service phase offered a reboot before update cleanup"; fi
else
grep -q '^prompt:' "$SUDO_TEST_LOG" || fail "reboot phase did not offer the required reboot"
if grep -q '^step:omarchy-restart-' "$SUDO_TEST_LOG"; then fail "reboot phase performed later service work"; fi
if grep -Eq '^step:(omarchy-restart-|systemctl )' "$SUDO_TEST_LOG"; then fail "reboot phase performed later service work"; fi
fi
pass "restart $mode performs only its selected phase"
done
Expand Down