Added SUDO_PASSWORD variable
This commit is contained in:
parent
be03797995
commit
5102fd8cf2
4 changed files with 22 additions and 6 deletions
|
@ -18,9 +18,13 @@ if [ -n "$SUDO_EXIT_CODE" ]; then
|
||||||
logg info 'Note: Non-privileged installations are not yet supported'
|
logg info 'Note: Non-privileged installations are not yet supported'
|
||||||
fi
|
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 ! 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
|
echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Ensure ~/.local/share/megabyte-labs is a directory
|
### Ensure ~/.local/share/megabyte-labs is a directory
|
||||||
|
|
|
@ -195,9 +195,13 @@ if [ -n "$SUDO_EXIT_CODE" ]; then
|
||||||
logg info 'Note: Non-privileged installations are not yet supported'
|
logg info 'Note: Non-privileged installations are not yet supported'
|
||||||
fi
|
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 ! 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
|
echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Qubes dom0
|
### Qubes dom0
|
||||||
|
|
|
@ -163,7 +163,11 @@ fi
|
||||||
|
|
||||||
# @description Add current user to /etc/sudoers so that headless automation is possible
|
# @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 ! 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
|
echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# @section Qubes dom0 Bootstrap
|
# @section Qubes dom0 Bootstrap
|
||||||
|
|
|
@ -105,7 +105,11 @@ fi
|
||||||
|
|
||||||
# @description Add current user to /etc/sudoers so that headless automation is possible
|
# @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 ! 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
|
echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# @section Qubes dom0 Bootstrap
|
# @section Qubes dom0 Bootstrap
|
||||||
|
|
Loading…
Reference in a new issue