Update start scripts, add scripts for setup and config value exports
This commit is contained in:
parent
f41f6ee2ca
commit
8f398e90de
27
configuration/setup-raspberry-pi.sh
Normal file
27
configuration/setup-raspberry-pi.sh
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Copy the files to /home/pi
|
||||||
|
cd /home/pi
|
||||||
|
cp -R /boot/hydrophonitor .
|
||||||
|
cd hydrophonitor
|
||||||
|
|
||||||
|
# Install the Rust toolchain
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
|
|
||||||
|
# Setup audio
|
||||||
|
sh scripts/setup-audio.sh
|
||||||
|
|
||||||
|
# Setup GPS
|
||||||
|
sh scripts/setup-gps.sh
|
||||||
|
|
||||||
|
# Setup depth sensor
|
||||||
|
sh scripts/setup-pressure-depth.sh
|
||||||
|
|
||||||
|
# Setup cron job to start the recordings at boot
|
||||||
|
CRON_FILE=/etc/crontab
|
||||||
|
echo "@reboot root /home/pi/hydrophonitor/scripts/start-all.sh" >> $CRON_FILE
|
||||||
|
|
||||||
|
# Reboot
|
||||||
|
sudo reboot
|
5
scripts/export-config-values.sh
Normal file
5
scripts/export-config-values.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
CONFIG_FILE=/boot/hydrophonitor/hydrophonitor-config.txt
|
||||||
|
|
||||||
|
export $(grep -v '^#' $CONFIG_FILE | xargs -d '\n')
|
@ -1,3 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
(trap 'kill 0' SIGINT; ./scripts/start-gps.sh & ./scripts/start-audio.sh & ./scripts/start-pressure-depth.sh)
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Export the configuration values
|
||||||
|
. /home/pi/hydrophonitor/scripts/export-config-values.sh
|
||||||
|
|
||||||
|
# Create output directory
|
||||||
|
OUTPUT_DIR=$BASE_DIR_PATH/$(date +"%Y-%m-%d_%H-%M-%S_output")
|
||||||
|
|
||||||
|
mkdir -p $OUTPUT_DIR
|
||||||
|
|
||||||
|
(export OUTPUT_DIR=$OUTPUT_DIR; trap 'kill 0' SIGINT; ./scripts/start-gps.sh & ./scripts/start-audio.sh & ./scripts/start-pressure-depth.sh)
|
||||||
|
@ -1,7 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
AUDIO_TARGET_LOCATION="/home/shared/hydrophonitor/audio-logger/target/release"
|
# Export the configuration values
|
||||||
AUDIO_TARGET_EXECUTABLE="audio"
|
. /home/pi/hydrophonitor/scripts/export-config-values.sh
|
||||||
OPTIONS=""
|
|
||||||
|
|
||||||
cd $AUDIO_TARGET_LOCATION && ./AUDIO_TARGET_EXECUTABLE $OPTIONS
|
AUDIO_TARGET_LOCATION="/home/pi/hydrophonitor/audio-logger/target/release"
|
||||||
|
AUDIO_TARGET_EXECUTABLE="audio"
|
||||||
|
|
||||||
|
OPTIONS="rec \
|
||||||
|
--name audio_data \
|
||||||
|
--output $OUTPUT_DIR \
|
||||||
|
--batch-recording $BATCH_RECORD_LENGTH \
|
||||||
|
--sample-rate $SAMPLE_RATE \
|
||||||
|
--channels $CHANNELS \
|
||||||
|
--buffer-size 1024 \
|
||||||
|
alsa"
|
||||||
|
|
||||||
|
cd $AUDIO_TARGET_LOCATION && ./$AUDIO_TARGET_EXECUTABLE $OPTIONS
|
@ -1,6 +1,9 @@
|
|||||||
#!/usr/bin/sh
|
#!/usr/bin/sh
|
||||||
|
|
||||||
GPS_TARGET_LOCATION="/home/shared/hydrophonitor/gps-logger"
|
# Export the configuration values
|
||||||
OPTIONS=""
|
. /home/pi/hydrophonitor/scripts/export-config-values.sh
|
||||||
|
|
||||||
cd $GPS_TARGET_LOCATION && python record-gps.py $OPTIONS
|
GPS_EXECUTABLE_LOCATION="/home/pi/hydrophonitor/gps-logger"
|
||||||
|
OPTIONS="--output $OUTPUT_DIR --interval $GPS_INTERVAL"
|
||||||
|
|
||||||
|
cd $GPS_EXECUTABLE_LOCATION && python record-gps.py $OPTIONS
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#!/usr/bin/sh
|
#!/usr/bin/sh
|
||||||
|
|
||||||
DEPTH_TARGET_LOCATION="/home/shared/hydrophonitor/depth-logger"
|
# Export the configuration values
|
||||||
OPTIONS=""
|
. /home/pi/hydrophonitor/scripts/export-config-values.sh
|
||||||
|
|
||||||
|
DEPTH_EXECUTABLE_LOCATION="/home/pi/hydrophonitor/depth-logger"
|
||||||
|
|
||||||
|
OPTIONS="--output $OUTPUT_DIR --interval $DEPTH_INTERVAL"
|
||||||
|
|
||||||
cd $DEPTH_TARGET_LOCATION && python record-depth.py $OPTIONS
|
cd $DEPTH_TARGET_LOCATION && python record-depth.py $OPTIONS
|
||||||
|
Loading…
Reference in New Issue
Block a user