Update after.sh
This commit is contained in:
parent
338aa1ebcb
commit
e70cfe6202
1 changed files with 2 additions and 6 deletions
8
after.sh
8
after.sh
|
|
@ -18,10 +18,7 @@ USER_HOME="/home/$USERNAME"
|
||||||
# Temporarily enable passwordless sudo
|
# Temporarily enable passwordless sudo
|
||||||
# ─────────────────────────────────────
|
# ─────────────────────────────────────
|
||||||
|
|
||||||
SUDOERS_FILE="/etc/sudoers.d/00_$USERNAME"
|
SUDOERS_FILE="/etc/sudoers.d/99-install-script"
|
||||||
SUDOERS_BACKUP="${SUDOERS_FILE}.backup"
|
|
||||||
|
|
||||||
cp "$SUDOERS_FILE" "$SUDOERS_BACKUP"
|
|
||||||
|
|
||||||
printf '%s ALL=(ALL:ALL) NOPASSWD: ALL\n' "$USERNAME" > "$SUDOERS_FILE"
|
printf '%s ALL=(ALL:ALL) NOPASSWD: ALL\n' "$USERNAME" > "$SUDOERS_FILE"
|
||||||
chmod 440 "$SUDOERS_FILE"
|
chmod 440 "$SUDOERS_FILE"
|
||||||
|
|
@ -29,8 +26,7 @@ chmod 440 "$SUDOERS_FILE"
|
||||||
visudo -c || exit 1
|
visudo -c || exit 1
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
mv "$SUDOERS_BACKUP" "$SUDOERS_FILE"
|
rm -f "$SUDOERS_FILE"
|
||||||
rm -f /etc/sudoers.d/99-install-script
|
|
||||||
visudo -c
|
visudo -c
|
||||||
}
|
}
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue