From 34aa5d17dc9679f657ed05e8974fa59c89b0fd0a Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Fri, 26 Apr 2024 23:46:13 -0400 Subject: [PATCH] Updates to setup from testing --- client/setup.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/setup.sh b/client/setup.sh index d688fa0..e7e488a 100644 --- a/client/setup.sh +++ b/client/setup.sh @@ -16,6 +16,12 @@ if [[ ! -f "$(pwd)/package.json" ]]; then exit 1 fi +# Check to make sure the pi user exists +if ! id "pi" &>/dev/null; then + echo "Error: User pi does not exist." + exit 1 +fi + ####------------------- Functions # Function to prompt user for input with a specific message and store the result in a variable prompt_user() { @@ -147,7 +153,8 @@ echo "Installing npm dependencies..." npm install # Get rid of PEP 668 -rm -rf /usr/lib/python3.11/EMTERNALL-MANAGED +rm -rf /usr/lib/python3.11/EMTERNALL-MANAGED # Not sure if this was an attrocious fat finger or if this is needed, doesn't throw an error, so... +rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED # Getting the Python DAB echo "Installing PDAB and Dependencies" @@ -181,7 +188,7 @@ echo "OP25_FULL_PATH=$op25_full_path" >> .env echo "" >> .env echo "# Core config, DO NOT TOUCH UNLESS YOU KNOW WHAT YOU ARE DOING" >> .env echo "CONFIG_PATH=./config/radioPresets.json" >> .env -python3 ./discordAudioBot/pdab/getDevices.py +runuser -l pi -c 'python3 ./discordAudioBot/pdab/getDevices.py' audio_device_id=$(prompt_user "Enter the ID of the 'input' audio device you would like to use (most often 'default')") echo "AUDIO_DEVICE_ID=$audio_device_id" >> .env echo "PDAB_PORT=3110" >> .env @@ -297,7 +304,7 @@ confirm="${confirm,,}" #echo "To configure the app, please go to http://$nodeIP:$nodePort" # TODO - uncomment when webapp is built echo "Thank you for joining the network!" -if [[ "$confirm" != "y" && "$confirm" != "yes" ]]; then +if [[ "$confirm" == "y" && "$confirm" == "yes" ]]; then # Prompt user to press any key before rebooting read -rsp $'System will now reboot, press any key to continue or Ctrl+C to cancel...\n' -n1 key echo "Rebooting..."