From eada9933a84177295d32685829ceeec99e1e3c49 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Thu, 7 Dec 2023 06:26:27 +0000 Subject: [PATCH] Latest --- scripts/provision.sh | 2 ++ scripts/src/provision.sh.tmpl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scripts/provision.sh b/scripts/provision.sh index 84ab2f42..f514a944 100644 --- a/scripts/provision.sh +++ b/scripts/provision.sh @@ -331,10 +331,12 @@ setupPasswordlessSudo() { sudo -n true || SUDO_EXIT_CODE=$? logg info 'Your user will temporarily be granted passwordless sudo for the duration of the script' if [ -n "$SUDO_EXIT_CODE" ] && [ -z "$SUDO_PASSWORD" ] && command -v chezmoi > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets/SUDO_PASSWORD" ]; then + logg info "Acquiring SUDO_PASSWORD by using Chezmoi to decrypt ${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets/SUDO_PASSWORD" SUDO_PASSWORD="$(chezmoi decrypt "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets/SUDO_PASSWORD")" export SUDO_PASSWORD fi if [ -n "$SUDO_PASSWORD" ]; then + logg info 'Using the acquired sudo password to automatically grant the user passwordless sudo privileges for the duration of the script' printf '%s\n' "$SUDO_PASSWORD" | sudo -p "" -S echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers > /dev/null else logg info 'Press CTRL+C to bypass this prompt to either enter your password when needed or perform a non-privileged installation' diff --git a/scripts/src/provision.sh.tmpl b/scripts/src/provision.sh.tmpl index ceb2f043..75d6244d 100644 --- a/scripts/src/provision.sh.tmpl +++ b/scripts/src/provision.sh.tmpl @@ -111,10 +111,12 @@ setupPasswordlessSudo() { sudo -n true || SUDO_EXIT_CODE=$? logg info 'Your user will temporarily be granted passwordless sudo for the duration of the script' if [ -n "$SUDO_EXIT_CODE" ] && [ -z "$SUDO_PASSWORD" ] && command -v chezmoi > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets/SUDO_PASSWORD" ]; then + logg info "Acquiring SUDO_PASSWORD by using Chezmoi to decrypt ${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets/SUDO_PASSWORD" SUDO_PASSWORD="$(chezmoi decrypt "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets/SUDO_PASSWORD")" export SUDO_PASSWORD fi if [ -n "$SUDO_PASSWORD" ]; then + logg info 'Using the acquired sudo password to automatically grant the user passwordless sudo privileges for the duration of the script' printf '%s\n' "$SUDO_PASSWORD" | sudo -p "" -S echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers > /dev/null else logg info 'Press CTRL+C to bypass this prompt to either enter your password when needed or perform a non-privileged installation'