diff --git a/scripts/provision.sh b/scripts/provision.sh index f514a944..f0512def 100644 --- a/scripts/provision.sh +++ b/scripts/provision.sh @@ -337,7 +337,9 @@ setupPasswordlessSudo() { 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 + echo "$SUDO_PASSWORD" | sudo -S sh -c "echo '$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR' | sudo -S tee -a /etc/sudoers > /dev/null" + # Old method below does not work on macOS due to multiple sudo prompts + # printf '%s\n%s\n' "$SUDO_PASSWORD" | sudo -S echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo -S 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' logg info 'Note: Non-privileged installations are not yet supported' diff --git a/scripts/src/provision.sh.tmpl b/scripts/src/provision.sh.tmpl index 75d6244d..f28fde7d 100644 --- a/scripts/src/provision.sh.tmpl +++ b/scripts/src/provision.sh.tmpl @@ -117,7 +117,9 @@ setupPasswordlessSudo() { 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 + echo "$SUDO_PASSWORD" | sudo -S sh -c "echo '$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR' | sudo -S tee -a /etc/sudoers > /dev/null" + # Old method below does not work on macOS due to multiple sudo prompts + # printf '%s\n%s\n' "$SUDO_PASSWORD" | sudo -S echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo -S 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' logg info 'Note: Non-privileged installations are not yet supported'