Clean up file if no timer is present
This commit is contained in:
@@ -7,6 +7,11 @@
|
|||||||
NOPASSWD_FILE="/etc/sudoers.d/99-omarchy-nopasswd-${USER}"
|
NOPASSWD_FILE="/etc/sudoers.d/99-omarchy-nopasswd-${USER}"
|
||||||
TIMER_NAME="omarchy-nopasswd-expire-${USER}"
|
TIMER_NAME="omarchy-nopasswd-expire-${USER}"
|
||||||
|
|
||||||
|
# Safety: if the file exists but the timer doesn't (e.g. after reboot), clean up
|
||||||
|
if sudo test -f "$NOPASSWD_FILE" && ! systemctl is-active "${TIMER_NAME}.timer" &>/dev/null; then
|
||||||
|
sudo rm "$NOPASSWD_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for the file directly — sudo -n can stay cached or be granted by other rules
|
# Check for the file directly — sudo -n can stay cached or be granted by other rules
|
||||||
if sudo test -f "$NOPASSWD_FILE"; then
|
if sudo test -f "$NOPASSWD_FILE"; then
|
||||||
sudo rm "$NOPASSWD_FILE"
|
sudo rm "$NOPASSWD_FILE"
|
||||||
|
|||||||
Reference in New Issue
Block a user