Update after.sh
This commit is contained in:
parent
3e835129ef
commit
c4002b4a1f
1 changed files with 7 additions and 8 deletions
15
after.sh
15
after.sh
|
|
@ -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
|
||||
Loading…
Reference in a new issue