From 727ab9ae83e2e0a0033f23e3a86220a977984370 Mon Sep 17 00:00:00 2001 From: Satu Koskinen Date: Sat, 18 Feb 2023 22:29:03 +0200 Subject: [PATCH] Add configuration for a shutdown button --- scripts/setup-raspberry-pi.sh | 7 +++++++ scripts/setup-shutdown-button.sh | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 scripts/setup-shutdown-button.sh 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