Update after.sh

This commit is contained in:
Baltrust 2026-10-14 16:46:02 +03:00
parent 3e835129ef
commit c4002b4a1f

View file

@ -15,19 +15,13 @@ USER_HOME="/home/$USERNAME"
# Temporarily enable passwordless sudo
# ─────────────────────────────────────
SUDOERS_FILE="/etc/sudoers.d/99-install-script"
SUDOERS_FILE="/etc/sudoers.d/00_$USERNAME"
printf '%s ALL=(ALL:ALL) NOPASSWD: ALL\n' "$USERNAME" > "$SUDOERS_FILE"
chmod 440 "$SUDOERS_FILE"
visudo -c || exit 1
cleanup() {
rm -f "$SUDOERS_FILE"
visudo -c
}
trap cleanup EXIT
# ─────────────────────────────────────
# Misc
# ─────────────────────────────────────
@ -197,6 +191,11 @@ cd grub2
cd "$OLDPWD"
EOF
rm after.sh
# Restore password requirement after successful installation
printf '%s ALL=(ALL) ALL\n' "$USERNAME" > "$SUDOERS_FILE"
chmod 440 "$SUDOERS_FILE"
visudo -c
rm -f after.sh
exit 0