Fix setting and exporting configuration values

This commit is contained in:
Satu Koskinen 2022-10-23 17:03:54 +03:00
parent 48158a6d4d
commit 41b0f7470c
6 changed files with 12 additions and 6 deletions

View File

@ -6,4 +6,10 @@ else
CONFIG_FILE=/boot/hydrophonitor/hydrophonitor-config.txt CONFIG_FILE=/boot/hydrophonitor/hydrophonitor-config.txt
fi fi
export $(grep -v '^#' $CONFIG_FILE | tr -d '[:space:]' | xargs -d '\n') # Select non-comment lines in CONFIG_FILE, clean horizontal whitespace
args=$(grep -v '^#' $CONFIG_FILE | tr -d '[:blank:]' | tr '\n' ' ')
for arg in $args; do
echo "export $arg"
export "${arg?}"
done

View File

@ -10,7 +10,7 @@ echo "### Update file paths in config and start script files"
echo echo
# Update hydrophonitor-config.txt HOME_PATH to the current user's home # Update hydrophonitor-config.txt HOME_PATH to the current user's home
sudo sed -i "s|^HOME_PATH=.*$|HOME_PATH=$HOME|" $BOOT_DIR_PATH/hydrophonitor_config.txt sudo sed -i "s|^HOME_PATH=.*$|HOME_PATH=$HOME|" $BOOT_DIR_PATH/hydrophonitor-config.txt
# Update script path in start scripts to the current user's home # Update script path in start scripts to the current user's home
sudo sed -i "s|^SCRIPT_PATH=.*$|SCRIPT_PATH=$HOME/hydrophonitor/scripts|" $BOOT_DIR_PATH/scripts/start-all.sh sudo sed -i "s|^SCRIPT_PATH=.*$|SCRIPT_PATH=$HOME/hydrophonitor/scripts|" $BOOT_DIR_PATH/scripts/start-all.sh

View File

@ -6,7 +6,7 @@ set -x
SCRIPT_PATH=/home/pi/hydrophonitor/scripts SCRIPT_PATH=/home/pi/hydrophonitor/scripts
# Export the configuration values # Export the configuration values
$SCRIPT_PATH/export-config-values.sh . $SCRIPT_PATH/export-config-values.sh
# Create output directory # Create output directory
OUTPUT_DIR=$OUTPUT_PATH/$(date +"%Y-%m-%d_%H-%M-%S_output") OUTPUT_DIR=$OUTPUT_PATH/$(date +"%Y-%m-%d_%H-%M-%S_output")

View File

@ -4,7 +4,7 @@ set -x
# Export the configuration values # Export the configuration values
SCRIPT_PATH=/home/pi/hydrophonitor/scripts SCRIPT_PATH=/home/pi/hydrophonitor/scripts
$SCRIPT_PATH/export-config-values.sh . $SCRIPT_PATH/export-config-values.sh
AUDIO_TARGET_EXECUTABLE="audio" AUDIO_TARGET_EXECUTABLE="audio"

View File

@ -4,7 +4,7 @@ set -x
# Export the configuration values # Export the configuration values
SCRIPT_PATH=/home/pi/hydrophonitor/scripts SCRIPT_PATH=/home/pi/hydrophonitor/scripts
$SCRIPT_PATH/export-config-values.sh . $SCRIPT_PATH/export-config-values.sh
OPTIONS="--output $OUTPUT_DIR --interval $GPS_INTERVAL" OPTIONS="--output $OUTPUT_DIR --interval $GPS_INTERVAL"

View File

@ -4,7 +4,7 @@ set -x
# Export the configuration values # Export the configuration values
SCRIPT_PATH=/home/pi/hydrophonitor/scripts SCRIPT_PATH=/home/pi/hydrophonitor/scripts
$SCRIPT_PATH/export-config-values.sh . $SCRIPT_PATH/export-config-values.sh
OPTIONS="--output $OUTPUT_DIR --interval $DEPTH_INTERVAL" OPTIONS="--output $OUTPUT_DIR --interval $DEPTH_INTERVAL"