Added SUDO_PASSWORD variable
This commit is contained in:
parent
be03797995
commit
5102fd8cf2
4 changed files with 22 additions and 6 deletions
|
@ -18,10 +18,14 @@ if [ -n "$SUDO_EXIT_CODE" ]; then
|
|||
logg info 'Note: Non-privileged installations are not yet supported'
|
||||
fi
|
||||
|
||||
### Enable passwordless sudo
|
||||
# @description Add current user to /etc/sudoers so that headless automation is possible
|
||||
if ! sudo cat /etc/sudoers | grep '# TEMPORARY FOR INSTALL DOCTOR' > /dev/null; then
|
||||
if [ -n "$SUDO_PASSWORD" ]; then
|
||||
printf '%s\n' "$SUDO_PASSWORD" | sudo -p "" -S echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||
else
|
||||
echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||
fi
|
||||
fi
|
||||
|
||||
### Ensure ~/.local/share/megabyte-labs is a directory
|
||||
if [ ! -d "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs" ]; then
|
||||
|
|
|
@ -195,10 +195,14 @@ if [ -n "$SUDO_EXIT_CODE" ]; then
|
|||
logg info 'Note: Non-privileged installations are not yet supported'
|
||||
fi
|
||||
|
||||
### Enable passwordless sudo
|
||||
# @description Add current user to /etc/sudoers so that headless automation is possible
|
||||
if ! sudo cat /etc/sudoers | grep '# TEMPORARY FOR INSTALL DOCTOR' > /dev/null; then
|
||||
if [ -n "$SUDO_PASSWORD" ]; then
|
||||
printf '%s\n' "$SUDO_PASSWORD" | sudo -p "" -S echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||
else
|
||||
echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||
fi
|
||||
fi
|
||||
|
||||
### Qubes dom0
|
||||
if command -v qubesctl > /dev/null; then
|
||||
|
|
|
@ -163,8 +163,12 @@ fi
|
|||
|
||||
# @description Add current user to /etc/sudoers so that headless automation is possible
|
||||
if ! sudo cat /etc/sudoers | grep '# TEMPORARY FOR INSTALL DOCTOR' > /dev/null; then
|
||||
if [ -n "$SUDO_PASSWORD" ]; then
|
||||
printf '%s\n' "$SUDO_PASSWORD" | sudo -p "" -S echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||
else
|
||||
echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||
fi
|
||||
fi
|
||||
|
||||
# @section Qubes dom0 Bootstrap
|
||||
# @description Perform Qubes dom0 specific logic like updating system packages, setting up the Tor VM, updating TemplateVMs, and
|
||||
|
|
|
@ -105,8 +105,12 @@ fi
|
|||
|
||||
# @description Add current user to /etc/sudoers so that headless automation is possible
|
||||
if ! sudo cat /etc/sudoers | grep '# TEMPORARY FOR INSTALL DOCTOR' > /dev/null; then
|
||||
if [ -n "$SUDO_PASSWORD" ]; then
|
||||
printf '%s\n' "$SUDO_PASSWORD" | sudo -p "" -S echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||
else
|
||||
echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||
fi
|
||||
fi
|
||||
|
||||
# @section Qubes dom0 Bootstrap
|
||||
# @description Perform Qubes dom0 specific logic like updating system packages, setting up the Tor VM, updating TemplateVMs, and
|
||||
|
|
Loading…
Reference in a new issue