Update after.sh
This commit is contained in:
parent
1c19b5cc5a
commit
bbbf918bd0
1 changed files with 19 additions and 10 deletions
29
after.sh
29
after.sh
|
|
@ -14,19 +14,25 @@ USER_HOME="/home/$USERNAME"
|
||||||
# ─────────────────────────────────────
|
# ─────────────────────────────────────
|
||||||
# NO PASSWORD SETUP
|
# NO PASSWORD SETUP
|
||||||
# ─────────────────────────────────────
|
# ─────────────────────────────────────
|
||||||
SUDOERS_FILE=/etc/sudoers.d/99-install-script
|
# ─────────────────────────────────────
|
||||||
|
# Configure temporary passwordless sudo
|
||||||
|
# ─────────────────────────────────────
|
||||||
|
|
||||||
|
SUDOERS_FILE="/etc/sudoers.d/99-install-script"
|
||||||
|
|
||||||
install -d -m 750 /etc/sudoers.d
|
|
||||||
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"
|
||||||
visudo -cf /etc/sudoers || exit 1
|
|
||||||
|
|
||||||
cleanup() {
|
if ! visudo -c; then
|
||||||
rm -f "$SUDOERS_FILE"
|
rm -f "$SUDOERS_FILE"
|
||||||
visudo -c
|
exit 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
trap cleanup EXIT
|
echo "Temporary sudoers rule:"
|
||||||
|
cat "$SUDOERS_FILE"
|
||||||
|
|
||||||
|
echo "Effective sudo permissions:"
|
||||||
|
sudo -l -U "$USERNAME"
|
||||||
|
|
||||||
# ─────────────────────────────────────
|
# ─────────────────────────────────────
|
||||||
# Misc
|
# Misc
|
||||||
|
|
@ -64,9 +70,12 @@ install -d -o "$USERNAME" -g "$USERNAME" "/home/$USERNAME/.config/yay"
|
||||||
su - "$USERNAME" <<'EOF'
|
su - "$USERNAME" <<'EOF'
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "USERNAME=$(whoami)"
|
sudo -k
|
||||||
sudo -l
|
sudo -n true || {
|
||||||
sudo -n true && echo "Passwordless sudo works" || { echo "Passwordless sudo FAILED"; exit 1; }
|
echo "ERROR: Passwordless sudo is not working."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
echo "Passwordless sudo works."
|
||||||
|
|
||||||
git clone https://aur.archlinux.org/yay-bin.git
|
git clone https://aur.archlinux.org/yay-bin.git
|
||||||
cd yay-bin
|
cd yay-bin
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue