Files
omarchy/migrations/1791125650.sh
T
72c152a288 Retry systemd reload in the fingerprint recovery migration (#14260)
* Retry systemd reload after installing fingerprint recovery

A failed reload leaves the migration pending with the drop-in already installed. Reload existing configuration on retry so completion means systemd has applied the stop timeout, while preserving administrator changes.

Co-Authored-By: Codex Medium <317366263+omarchybot@users.noreply.github.com>

* Avoid sudo for an already-applied fingerprint repair

Migration completion belongs to each user, while the systemd repair is machine-wide. Query systemd reload state without elevation and reload only stale configuration, so interrupted repairs still retry and later users can complete without sudo. A failed state query remains a migration failure.

Co-Authored-By: Greptile <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com>
Co-authored-by: Greptile <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-10-04 13:29:38 -04:00

29 lines
1.2 KiB
Bash

echo "Install the fingerprint resume hook on existing fingerprint setups"
# Existing enrolled machines never rerun setup. Install only missing files
# so administrator changes survive an upgrade.
hook_src="${OMARCHY_FPRINTD_RESUME_SRC:-$OMARCHY_PATH/default/systemd/system-sleep/fprintd-resume}"
hook_dst="${OMARCHY_FPRINTD_RESUME_DST:-/usr/lib/systemd/system-sleep/fprintd-resume}"
stop_timeout_src="${OMARCHY_FPRINTD_STOP_TIMEOUT_SRC:-$OMARCHY_PATH/default/systemd/system/fprintd.service.d/10-stop-timeout.conf}"
stop_timeout_dst="${OMARCHY_FPRINTD_STOP_TIMEOUT_DST:-/etc/systemd/system/fprintd.service.d/10-stop-timeout.conf}"
lock_pam="${OMARCHY_LOCK_FINGERPRINT_PAM:-/etc/pam.d/omarchy-lock-fingerprint}"
[[ -f $lock_pam ]] || exit 0
if [[ -f $hook_src && ! -e $hook_dst ]]; then
echo "Installing the fprintd resume hook"
sudo install -Dm755 "$hook_src" "$hook_dst"
fi
if [[ -f $stop_timeout_src && ! -e $stop_timeout_dst ]]; then
sudo install -Dm644 "$stop_timeout_src" "$stop_timeout_dst"
fi
if [[ -f $stop_timeout_dst ]]; then
reload_needed=$(systemctl show fprintd.service --property=NeedDaemonReload --value)
if [[ $reload_needed == "yes" ]]; then
sudo systemctl daemon-reload
fi
fi