fix: reboot/shutdown commands work without sudo prefix
polkit denies reboot/shutdown for non-root users without a local seat (e.g. SSH sessions). Since archipelago has NOPASSWD sudo, add shell aliases so reboot/shutdown/halt/poweroff transparently use sudo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2236,6 +2236,15 @@ rm -f /mnt/target/etc/motd.d/* 2>/dev/null || true
|
||||
if ! grep -q '/sbin' /mnt/target/home/archipelago/.bashrc 2>/dev/null; then
|
||||
echo 'export PATH="$PATH:/sbin:/usr/sbin"' >> /mnt/target/home/archipelago/.bashrc
|
||||
fi
|
||||
# Power commands need sudo on SSH sessions (polkit denies without local seat)
|
||||
if ! grep -q 'alias reboot' /mnt/target/home/archipelago/.bashrc 2>/dev/null; then
|
||||
cat >> /mnt/target/home/archipelago/.bashrc <<'ALIASES'
|
||||
alias reboot='sudo systemctl reboot'
|
||||
alias shutdown='sudo shutdown'
|
||||
alias halt='sudo systemctl halt'
|
||||
alias poweroff='sudo systemctl poweroff'
|
||||
ALIASES
|
||||
fi
|
||||
|
||||
# Systemd service: use the production version from rootfs (configs/archipelago.service)
|
||||
# Do NOT overwrite — the rootfs already has the correct User=archipelago, no DEV_MODE version
|
||||
|
||||
Reference in New Issue
Block a user