From 080c8ba38c35f6e120f02f17d54857598154e07a Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Wed, 20 May 2026 16:31:05 -0400 Subject: [PATCH] omarchy-wifi-powersave: nullglob; plocate drop-in daemon-reload; idempotent legacy cleanup - bin/omarchy-wifi-powersave: shopt -s nullglob. Previously, machines with no wireless interfaces ran the loop once with the literal glob ('iface=*'), failed iw, and exited 237. With the new always-installed udev rule that invokes this on every AC transition, the failure would surface as failed transient omarchy-wifi-powersave-* units on desktops. Now it cleanly no-ops. - migrations/1779307845.sh: add 'systemctl daemon-reload' so the plocate-updatedb.service.d/ac-only.conf drop-in is picked up on upgrade. Arch's systemd pacman hook only triggers on /usr/lib/systemd/system/*, not /etc/systemd/system/*. - install/config/powerprofilesctl-rules.sh and wifi-powersave-rules.sh: rm -f the pre-rename legacy paths before udevadm reload, so the cleanup is idempotent outside the one-shot migration (matters for re-install/downgrade testing). --- bin/omarchy-wifi-powersave | 1 + install/config/powerprofilesctl-rules.sh | 3 +++ install/config/wifi-powersave-rules.sh | 3 +++ migrations/1779307845.sh | 7 ++++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/omarchy-wifi-powersave b/bin/omarchy-wifi-powersave index 26810e52..d75434a1 100755 --- a/bin/omarchy-wifi-powersave +++ b/bin/omarchy-wifi-powersave @@ -3,6 +3,7 @@ # omarchy:summary=Set Wi-Fi power save mode on wireless interfaces # omarchy:args= +shopt -s nullglob for iface in /sys/class/net/*/wireless; do iface="$(basename "$(dirname "$iface")")" iw dev "$iface" set power_save "$1" 2>/dev/null diff --git a/install/config/powerprofilesctl-rules.sh b/install/config/powerprofilesctl-rules.sh index c4f99a03..d23e4a9b 100644 --- a/install/config/powerprofilesctl-rules.sh +++ b/install/config/powerprofilesctl-rules.sh @@ -1,6 +1,9 @@ # The udev rule (/etc/udev/rules.d/99-omarchy-power-profile.rules) ships via # omarchy-settings. This script handles the runtime side: enable the service # the rule's RUN+= chains through, and reload udev so the new rule takes effect. +# Also remove the pre-rename legacy path in case the old installer ran since +# the one-shot migration completed (idempotency for re-install/downgrade tests). +sudo rm -f /etc/udev/rules.d/99-power-profile.rules sudo systemctl enable power-profiles-daemon sudo udevadm control --reload 2>/dev/null sudo udevadm trigger --subsystem-match=power_supply 2>/dev/null diff --git a/install/config/wifi-powersave-rules.sh b/install/config/wifi-powersave-rules.sh index 11a39b1c..6a08b060 100644 --- a/install/config/wifi-powersave-rules.sh +++ b/install/config/wifi-powersave-rules.sh @@ -1,5 +1,8 @@ # The udev rule (/etc/udev/rules.d/99-omarchy-wifi-powersave.rules) ships via # omarchy-settings. This script just reloads udev so the rule takes effect # without waiting for a reboot. +# Also remove the pre-rename legacy path in case the old installer ran since +# the one-shot migration completed (idempotency for re-install/downgrade tests). +sudo rm -f /etc/udev/rules.d/99-wifi-powersave.rules sudo udevadm control --reload sudo udevadm trigger --subsystem-match=power_supply diff --git a/migrations/1779307845.sh b/migrations/1779307845.sh index e18f33b4..4fe58953 100644 --- a/migrations/1779307845.sh +++ b/migrations/1779307845.sh @@ -9,6 +9,11 @@ sudo rm -f /etc/udev/rules.d/99-power-profile.rules # Package now ships /etc/udev/rules.d/99-omarchy-wifi-powersave.rules. Same. sudo rm -f /etc/udev/rules.d/99-wifi-powersave.rules -# Reload so the new rules take effect immediately. +# Reload so the new udev rules take effect immediately. sudo udevadm control --reload 2>/dev/null sudo udevadm trigger --subsystem-match=power_supply 2>/dev/null + +# The plocate-updatedb.service drop-in is installed under /etc/systemd/system, +# which Arch's systemd pacman hook does NOT trigger on. Explicitly reload so +# upgrades pick up the drop-in without needing a reboot. +sudo systemctl daemon-reload 2>/dev/null