From 40fd17377707b2bf96c114f1285db083c8c412d0 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 8 Mar 2024 01:29:45 -0500 Subject: [PATCH] Make sure audible sudo prompts are available throughout configure-stormux and the start up process. --- pi4/files/etc/profile.d/stormux_first_boot.sh | 25 +++++++++++++------ pi4/files/usr/local/bin/configure-stormux | 11 ++++++-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/pi4/files/etc/profile.d/stormux_first_boot.sh b/pi4/files/etc/profile.d/stormux_first_boot.sh index 4d78372..ee17001 100755 --- a/pi4/files/etc/profile.d/stormux_first_boot.sh +++ b/pi4/files/etc/profile.d/stormux_first_boot.sh @@ -1,15 +1,25 @@ #!/usr/bin/env bash +if [[ "$(tty)" != "/dev/tty1" ]]; then + return +fi + if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then - exit 0 + return fi -if ! [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then - exit 0 +if ! [[ -x /usr/local/bin/configure-stormux ]]; then + return fi -if [[ "$(tty)" = "/dev/tty1" ]]; then - cat << "EOF" +# For audible sudo prompts: +unset sudoFlags +if [[ -x /etc/audibleprompt.sh ]]; then + export SUDO_ASKPASS=/etc/audibleprompt.sh + export sudoFlags=("-A") +fi + +cat << "EOF" Hello, and welcome to Stormux! Let's get you set up. After you press enter, you will be prompted for the sudo password. @@ -20,6 +30,5 @@ Once again, the password is stormux in all lower case letters. Please press enter to continue. EOF - read -r - sudo configure-stormux -fi +read -r +sudo "${sudoFlags[@]}" configure-stormux diff --git a/pi4/files/usr/local/bin/configure-stormux b/pi4/files/usr/local/bin/configure-stormux index 51a3578..a87ba20 100755 --- a/pi4/files/usr/local/bin/configure-stormux +++ b/pi4/files/usr/local/bin/configure-stormux @@ -1,6 +1,12 @@ #!/bin/bash -export SUDO_ASKPASS=/etc/audibleprompt.sh +# For audible sudo prompts: +unset sudoFlags +if [[ -x /etc/audibleprompt.sh ]]; then + export SUDO_ASKPASS=/etc/audibleprompt.sh + export sudoFlags=("-A") +fi + trap 'popd &> /dev/null' EXIT if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then @@ -11,7 +17,8 @@ fi if [[ ! -d /opt/configure-stormux ]]; then # Offer to switch fenrir layout. - echo "Would you like to switch Fenrir to laptop layout? (y/n)" + echo "Would you like to switch Fenrir to laptop layout?" + echo "Press y for yes or n for no followed by enter." read -r continue continue="${continue::1}" if [[ "${continue,}" == "y" ]];then