diff --git a/scripts/setup-raspberry-pi.sh b/scripts/setup-raspberry-pi.sh index d889d26..841ae6e 100644 --- a/scripts/setup-raspberry-pi.sh +++ b/scripts/setup-raspberry-pi.sh @@ -63,6 +63,13 @@ echo cd "$DIR_PATH" && ./hydrophonitor/scripts/setup-pressure-depth.sh +# Setup shutdown button +echo +echo "### Setup shutdown button" +echo + +cd "$DIR_PATH" && ./hydrophonitor/scripts/setup-shutdown-button.sh + # Set up cron job to start the recordings at boot echo echo "### Set up a cron job to start the recordings at boot" diff --git a/scripts/setup-shutdown-button.sh b/scripts/setup-shutdown-button.sh new file mode 100644 index 0000000..acdc2f0 --- /dev/null +++ b/scripts/setup-shutdown-button.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -ex + +echo "Setting up shutdown button" + +config="dtoverlay=gpio-shutdown,gpio_pin=21,gpio_pull=up,active_low=1" + +if ! grep -q "$config" /boot/config.txt; then + echo "$config" | sudo tee -a /boot/config.txt +fi