Migrate: clean up legacy /etc paths from prior installs

Existing users upgrading from script-installed Omarchy still have files
the install scripts wrote at the OLD paths. The new package can't own
those old paths (they were either renamed or replaced by drop-ins), so
this migration tidies them up:

- /etc/sysctl.d/99-sysctl.conf: strip the appended net.ipv4.tcp_mtu_probing
  line (new file is /etc/sysctl.d/99-omarchy-sysctl.conf)
- /etc/modprobe.d/disable-usb-autosuspend.conf: removed
  (new file is /etc/modprobe.d/omarchy-usb-autosuspend.conf)
- /etc/sudoers.d/{passwd-tries,asdcontrol}: removed
  (new files are /etc/sudoers.d/omarchy-{passwd-tries,asdcontrol})
- /etc/systemd/system/user@.service.d/faster-shutdown.conf: removed
  (new file is 10-faster-shutdown.conf)
- /etc/systemd/logind.conf HandlePowerKey=ignore line: reset to its
  commented default so the logind.conf.d/ drop-in is the only source

After cleanup, systemctl daemon-reload + sysctl --system to pick up the
new state immediately.
This commit is contained in:
Ryan Hughes
2026-06-04 18:34:04 -04:00
parent 89242fafc6
commit 3636f57f0c
+35
View File
@@ -0,0 +1,35 @@
echo "Clean up the old per-script /etc files now owned by omarchy-settings package"
# ssh-flakiness.sh used to append `net.ipv4.tcp_mtu_probing=1` to the
# conventionally-user-owned /etc/sysctl.d/99-sysctl.conf. The setting now ships
# at /etc/sysctl.d/99-omarchy-sysctl.conf via the package. Strip the line from
# the old path if it's there (leave the rest of 99-sysctl.conf alone).
if [[ -f /etc/sysctl.d/99-sysctl.conf ]] && grep -q '^net\.ipv4\.tcp_mtu_probing=1' /etc/sysctl.d/99-sysctl.conf; then
sudo sed -i '/^net\.ipv4\.tcp_mtu_probing=1$/d' /etc/sysctl.d/99-sysctl.conf
fi
# usb-autosuspend.sh used /etc/modprobe.d/disable-usb-autosuspend.conf; package
# now owns /etc/modprobe.d/omarchy-usb-autosuspend.conf. Remove the old file.
sudo rm -f /etc/modprobe.d/disable-usb-autosuspend.conf
# Sudoers renames: passwd-tries -> omarchy-passwd-tries; asdcontrol -> omarchy-asdcontrol.
sudo rm -f /etc/sudoers.d/passwd-tries
sudo rm -f /etc/sudoers.d/asdcontrol
# fast-shutdown.sh used to ship user@.service.d/faster-shutdown.conf; the
# package owns user@.service.d/10-faster-shutdown.conf. Both would apply
# simultaneously, so remove the old.
sudo rm -f /etc/systemd/system/user@.service.d/faster-shutdown.conf
# ignore-power-button.sh used to `sed` HandlePowerKey=ignore directly into
# /etc/systemd/logind.conf. The package now ships a drop-in at
# /etc/systemd/logind.conf.d/10-ignore-power-button.conf, which wins regardless,
# but reset the main file's line back to its commented default so future
# changes to the drop-in aren't shadowed.
if [[ -f /etc/systemd/logind.conf ]] && grep -q '^HandlePowerKey=ignore' /etc/systemd/logind.conf; then
sudo sed -i 's/^HandlePowerKey=ignore$/#HandlePowerKey=poweroff/' /etc/systemd/logind.conf
fi
# Reload anything that watches these files so the changes take effect now.
sudo systemctl daemon-reload || true
sudo sysctl --system >/dev/null 2>&1 || true