From d56ece61a67b1bd07aba52aef3a33df7fd5c74f8 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Wed, 27 Oct 2021 14:52:30 -0400 Subject: [PATCH 01/91] Working on a new installation method --- Birders_Guide_Installer.sh | 23 ++++------------------- scripts/birdnet-pi-config | 4 ++-- scripts/uninstall.sh | 8 +++++--- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index eec2292..b336f95 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e my_dir=${HOME}/BirdNET-Pi -branch=testing +branch=newinstaller trap '${my_dir}/scripts/dump_logs.sh && exit' EXIT SIGHUP SIGINT @@ -47,21 +47,6 @@ EOF cd ~ curl -s -O "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" chmod +x Birders_Guide_Installer.sh - cat << EOF | sudo tee /etc/systemd/user/birdnet-system-installer.service &> /dev/null -[Unit] -Description=A BirdNET-Pi Installation Script Service -After=graphical.target network-online.target - -[Service] -Type=simple -Restart=on-failure -RestartSec=3s -ExecStart=lxterminal -e /home/pi/Birders_Guide_Installer.sh - -[Install] -WantedBy=default.target -EOF - systemctl --user enable birdnet-system-installer.service echo echo "Stage 1 complete" touch ${HOME}/stage_1_complete @@ -119,10 +104,10 @@ stage_2() { echo "Follow the instructions to fill out the LATITUDE and LONGITUDE variables and set the passwords for the live audio stream. Save the file after editing and then close the Mouse Pad editing window to continue." - if ( env | grep SSH_CONNECTION &> /dev/null );then - editor=nano - else + if [ -z $SSH_CONNECTION ];then editor=mousepad + else + editor=nano fi $editor ${my_dir}/Birders_Guide_Installer_Configuration.txt while pgrep $editor &> /dev/null;do diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index b6e5a9c..bf62f53 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -5,7 +5,7 @@ # See LICENSE file for copyright and license details # Copyright (c) 2012 Alex Bradbury -my_dir=$(realpath $(dirname $0)) +branch=newinstaller INTERACTIVE=True ASK_TO_REBOOT=0 BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf @@ -718,7 +718,7 @@ do_update() { } do_install_birdnet() { - ${my_dir}/Birders_Guide_Installer.sh + curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | bash ASK_TO_REBOOT=1 } diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 9cd8ce5..c6033fc 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash # Uninstall script to remove everything -# set -x # Uncomment to debug +#set -x # Uncomment to debug trap 'rm -f ${TMPFILE}' EXIT +my_dir=/home/pi/BirdNET-Pi/scripts source /etc/birdnet/birdnet.conf &> /dev/null SCRIPTS=(birdnet_analysis.sh birdnet_recording.sh @@ -44,8 +45,8 @@ tmux uninstall.sh update_species.sh ${HOME}/.gotty) - -services=$(awk '/service/ && /systemctl/ && !/php/ {print $3}' ${my_dir}/install_services.sh | sort) +set -x +services=($(awk '/service/ && /systemctl/ && !/php/ {print $3}' ${my_dir}/install_services.sh | sort)) remove_services() { for i in "${services[@]}"; do @@ -59,6 +60,7 @@ remove_services() { sudo rm -drf /etc/systemd/system/"${i}" fi done + set +x remove_icecast remove_crons } From 13b54e4693f61dcd1d909c2782e5eeb8e702b9c8 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Wed, 27 Oct 2021 14:55:07 -0400 Subject: [PATCH 02/91] altering for some preliminary tests --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ff375f..c18457c 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The BirdNET-Pi project is built on the [TFLite version of BirdNET](https://githu The system can be installed with: ``` -curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/main/Birders_Guide_Installer.sh | bash +curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/newinstaller/birdnet-pi-config | USER=pi HOME=/home/pi sudo bash ``` The script first enables and configures the zRAM kernel module for swapping, and reboots. From 9c56da0dc4e4270a0bc7f19867be4174f82d461b Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:08:40 -0400 Subject: [PATCH 03/91] adding debugging for testing --- Birders_Guide_Installer.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index b336f95..5915686 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -42,15 +42,6 @@ ExecStop=/sbin/swapoff /dev/zram0 WantedBy=multi-user.target EOF sudo systemctl enable zram - echo - echo "Installing stage 2 installation script now." - cd ~ - curl -s -O "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" - chmod +x Birders_Guide_Installer.sh - echo - echo "Stage 1 complete" - touch ${HOME}/stage_1_complete - echo echo "Rebooting the system in 5 seconds" sleep 5 sudo reboot @@ -104,11 +95,13 @@ stage_2() { echo "Follow the instructions to fill out the LATITUDE and LONGITUDE variables and set the passwords for the live audio stream. Save the file after editing and then close the Mouse Pad editing window to continue." + set -x if [ -z $SSH_CONNECTION ];then editor=mousepad else editor=nano fi + echo $editor && exit $editor ${my_dir}/Birders_Guide_Installer_Configuration.txt while pgrep $editor &> /dev/null;do sleep 1 From 3cbdc109372ba190a6168814076a047628801eec Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:13:29 -0400 Subject: [PATCH 04/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 5915686..e43e77c 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash set -e +USER=pi +HOME=/home/pi my_dir=${HOME}/BirdNET-Pi branch=newinstaller trap '${my_dir}/scripts/dump_logs.sh && exit' EXIT SIGHUP SIGINT @@ -82,9 +84,9 @@ stage_2() { echo "Connected!" echo if [ ! -d ${my_dir} ];then - cd ~ || exit 1 + cd ${HOME} || exit 1 echo "Cloning the BirdNET-Pi repository $branch branch into your home directory" - git clone --depth 1 -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ~/BirdNET-Pi + git clone --depth 1 -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi else cd ${my_dir} && git checkout ${branch} fi @@ -101,6 +103,7 @@ and then close the Mouse Pad editing window to continue." else editor=nano fi + echo $editor && exit $editor ${my_dir}/Birders_Guide_Installer_Configuration.txt while pgrep $editor &> /dev/null;do From 624a774d6718d51b83fe2c4f109cc54931ca5b84 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:15:34 -0400 Subject: [PATCH 05/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index bf62f53..c9adb65 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -718,7 +718,7 @@ do_update() { } do_install_birdnet() { - curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | bash + curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -upi bash ASK_TO_REBOOT=1 } From f51637d53de3bd1ecb104ae7650a8decb7757618 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:20:28 -0400 Subject: [PATCH 06/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index c9adb65..a6b2cf2 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -718,6 +718,7 @@ do_update() { } do_install_birdnet() { + env && exit curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -upi bash ASK_TO_REBOOT=1 } From 1191665d6607c5ef9919841f6db6275a24876802 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:23:53 -0400 Subject: [PATCH 07/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index e43e77c..48908ce 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -5,7 +5,7 @@ HOME=/home/pi my_dir=${HOME}/BirdNET-Pi branch=newinstaller trap '${my_dir}/scripts/dump_logs.sh && exit' EXIT SIGHUP SIGINT - +env && exit if [ "$(uname -m)" != "aarch64" ];then echo "BirdNET-Pi requires a 64-bit OS. From c2f29d4e2482c536cbbf6066bd976a593c34eb90 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:24:20 -0400 Subject: [PATCH 08/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index a6b2cf2..c9adb65 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -718,7 +718,6 @@ do_update() { } do_install_birdnet() { - env && exit curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -upi bash ASK_TO_REBOOT=1 } From 8824826e0bb4e1d0d6eab9b180ddfcd5e909b2f8 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:27:41 -0400 Subject: [PATCH 09/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index c9adb65..f2aaf50 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -4,7 +4,7 @@ # # See LICENSE file for copyright and license details # Copyright (c) 2012 Alex Bradbury - +birdnetpi_dir=/home/pi/BirdNET-Pi branch=newinstaller INTERACTIVE=True ASK_TO_REBOOT=0 @@ -718,7 +718,11 @@ do_update() { } do_install_birdnet() { - curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -upi bash + if [ -f ${birdnetpi_dir}Birders_Guide_Installer.sh} ];then + sudo -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh + else + curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -upi bash + fi ASK_TO_REBOOT=1 } From c24f0d33d1b278ac11a0a0dad5ca8566ada6d65f Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:43:01 -0400 Subject: [PATCH 10/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index f2aaf50..6404231 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -440,14 +440,6 @@ get_autologin() { fi } -do_update() { - apt-get update && - apt-get install birdnetpi-config && - printf "Sleeping 5 seconds before reloading birdnetpi-config\n" && - sleep 5 && - exec birdnetpi-config -} - do_audio() { if is_pulseaudio ; then oIFS="$IFS" @@ -719,9 +711,9 @@ do_update() { do_install_birdnet() { if [ -f ${birdnetpi_dir}Birders_Guide_Installer.sh} ];then - sudo -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh + sudo -E -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh else - curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -upi bash + curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -E -upi bash fi ASK_TO_REBOOT=1 } From 3f8eb78aace99d71bf5645980ceeefffd5a90c2f Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:43:47 -0400 Subject: [PATCH 11/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 48908ce..e670a3c 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -5,7 +5,6 @@ HOME=/home/pi my_dir=${HOME}/BirdNET-Pi branch=newinstaller trap '${my_dir}/scripts/dump_logs.sh && exit' EXIT SIGHUP SIGINT -env && exit if [ "$(uname -m)" != "aarch64" ];then echo "BirdNET-Pi requires a 64-bit OS. From 32e1d0705a2bd128d4ede5c3fabe202ac4d0eb9d Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:44:45 -0400 Subject: [PATCH 12/91] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c18457c..f1244c0 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The BirdNET-Pi project is built on the [TFLite version of BirdNET](https://githu The system can be installed with: ``` -curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/newinstaller/birdnet-pi-config | USER=pi HOME=/home/pi sudo bash +curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/newinstaller/scripts/birdnet-pi-config | sudo -E bash ``` The script first enables and configures the zRAM kernel module for swapping, and reboots. From d48b6dd8783f84d70f36369bfe409038ce4068ff Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:46:14 -0400 Subject: [PATCH 13/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index e670a3c..f548d5f 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -102,8 +102,6 @@ and then close the Mouse Pad editing window to continue." else editor=nano fi - - echo $editor && exit $editor ${my_dir}/Birders_Guide_Installer_Configuration.txt while pgrep $editor &> /dev/null;do sleep 1 From 8caf9cc1187253f75fe2af88ce9847973c40082c Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:48:12 -0400 Subject: [PATCH 14/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index f548d5f..215fb23 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -97,7 +97,7 @@ stage_2() { and set the passwords for the live audio stream. Save the file after editing and then close the Mouse Pad editing window to continue." set -x - if [ -z $SSH_CONNECTION ];then + if [ -z "$SSH_CONNECTION" ];then editor=mousepad else editor=nano From 579b4963223a18037a166f658f5f8c80db3df4f8 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:55:29 -0400 Subject: [PATCH 15/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 215fb23..9618212 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -66,6 +66,7 @@ stage_1() { if [ ${ZRAM} -lt 4 ];then install_zram_swap else + touch ${HOME}/stage_1_complete echo "Stage 1 complete" stage_2 exit From 2280f360b0ccc500e1c1d573b6d3767d929d73b4 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 17:06:34 -0400 Subject: [PATCH 16/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 134 +------------------------------------- 1 file changed, 1 insertion(+), 133 deletions(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index 6404231..4de0e4f 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -398,48 +398,6 @@ do_vnc() { fi } -disable_raspi_config_at_boot() { - if [ -e /etc/profile.d/birdnetpi-config.sh ]; then - rm -f /etc/profile.d/birdnetpi-config.sh - if [ -e /etc/systemd/system/getty@tty1.service.d/birdnetpi-config-override.conf ]; then - rm /etc/systemd/system/getty@tty1.service.d/birdnetpi-config-override.conf - fi - telinit q - fi -} - -get_boot_cli() { - if systemctl get-default | grep -q multi-user ; then - echo 0 - else - echo 1 - fi -} - -get_autologin() { - if [ $(get_boot_cli) -eq 0 ]; then - # booting to CLI - # stretch or buster - is there an autologin conf file? - if [ -e /etc/systemd/system/getty@tty1.service.d/autologin.conf ] ; then - echo 0 - else - # stretch or earlier - check the getty service symlink for autologin - if [ $(deb_ver) -le 9 ] && grep -q autologin /etc/systemd/system/getty.target.wants/getty@tty1.service ; then - echo 0 - else - echo 1 - fi - fi - else - # booting to desktop - check the autologin for lightdm - if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then - echo 0 - else - echo 1 - fi - fi -} - do_audio() { if is_pulseaudio ; then oIFS="$IFS" @@ -531,75 +489,6 @@ EOF fi } -do_resolution() { - if [ "$INTERACTIVE" = True ]; then - CMODE=$(get_config_var hdmi_mode $CONFIG) - CGROUP=$(get_config_var hdmi_group $CONFIG) - if [ $CMODE -eq 0 ] ; then - CSET="Default" - elif [ $CGROUP -eq 2 ] ; then - CSET="DMT Mode "$CMODE - else - CSET="CEA Mode "$CMODE - fi - oIFS="$IFS" - IFS="/" - if tvservice -d /dev/null | grep -q Nothing ; then - value="Default/720x480/DMT Mode 4/640x480 60Hz 4:3/DMT Mode 9/800x600 60Hz 4:3/DMT Mode 16/1024x768 60Hz 4:3/DMT Mode 85/1280x720 60Hz 16:9/DMT Mode 35/1280x1024 60Hz 5:4/DMT Mode 51/1600x1200 60Hz 4:3/DMT Mode 82/1920x1080 60Hz 16:9/" - else - value="Default/Monitor preferred resolution/" - value=$value$(tvservice -m CEA | grep progressive | cut -b 12- | sed 's/mode \([0-9]\+\): \([0-9]\+\)x\([0-9]\+\) @ \([0-9]\+\)Hz \([0-9]\+\):\([0-9]\+\), clock:[0-9]\+MHz progressive/CEA Mode \1\/\2x\3 \4Hz \5:\6/' | tr '\n' '/') - value=$value$(tvservice -m DMT | grep progressive | cut -b 12- | sed 's/mode \([0-9]\+\): \([0-9]\+\)x\([0-9]\+\) @ \([0-9]\+\)Hz \([0-9]\+\):\([0-9]\+\), clock:[0-9]\+MHz progressive/DMT Mode \1\/\2x\3 \4Hz \5:\6/' | tr '\n' '/') - fi - RES=$(whiptail --default-item $CSET --menu "Choose screen resolution" 20 60 10 ${value} 3>&1 1>&2 2>&3) - STATUS=$? - IFS=$oIFS - if [ $STATUS -eq 0 ] ; then - GRS=$(echo "$RES" | cut -d ' ' -f 1) - MODE=$(echo "$RES" | cut -d ' ' -f 3) - if [ $GRS = "Default" ] ; then - MODE=0 - elif [ $GRS = "DMT" ] ; then - GROUP=2 - else - GROUP=1 - fi - fi - else - GROUP=$1 - MODE=$2 - STATUS=0 - fi - if [ $STATUS -eq 0 ]; then - if [ $MODE -eq 0 ]; then - clear_config_var hdmi_force_hotplug $CONFIG - clear_config_var hdmi_group $CONFIG - clear_config_var hdmi_mode $CONFIG - else - set_config_var hdmi_force_hotplug 1 $CONFIG - set_config_var hdmi_group $GROUP $CONFIG - set_config_var hdmi_mode $MODE $CONFIG - fi - if [ "$INTERACTIVE" = True ]; then - if [ $MODE -eq 0 ] ; then - whiptail --msgbox "The resolution is set to default" 20 60 1 - else - whiptail --msgbox "The resolution is set to $GRS mode $MODE" 20 60 1 - fi - fi - if [ $MODE -eq 0 ] ; then - TSET="Default" - elif [ $GROUP -eq 2 ] ; then - TSET="DMT Mode "$MODE - else - TSET="CEA Mode "$MODE - fi - if [ "$TSET" != "$CSET" ] ; then - ASK_TO_REBOOT=1 - fi - fi -} - list_wlan_interfaces() { for dir in /sys/class/net/*/wireless; do if [ -d "$dir" ]; then @@ -710,7 +599,7 @@ do_update() { } do_install_birdnet() { - if [ -f ${birdnetpi_dir}Birders_Guide_Installer.sh} ];then + if [ -f ${birdnetpi_dir}/Birders_Guide_Installer.sh} ];then sudo -E -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh else curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -E -upi bash @@ -764,25 +653,6 @@ do_system_menu() { fi } -do_display_menu() { - if is_pi ; then - FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnetpi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "Resolution" "Set a specific screen resolution" \ - 3>&1 1>&2 2>&3) - else - exit - fi - RET=$? - if [ $RET -eq 1 ]; then - return 0 - elif [ $RET -eq 0 ]; then - case "$FUN" in - Resolution*) do_resolution ;; - *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; - esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 - fi -} - do_interface_menu() { if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnetpi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ @@ -839,7 +709,6 @@ if [ "$INTERACTIVE" = True ]; then if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnetpi-config)" --backtitle "$(cat /proc/device-tree/model)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ "System Options" "Configure system settings" \ - "Display Options" "Configure display settings" \ "Interface Options" "Configure connections to peripherals" \ "Localisation Options" "Configure language and regional settings" \ "Update the OS" "Update the underlying operating system" \ @@ -854,7 +723,6 @@ if [ "$INTERACTIVE" = True ]; then elif [ $RET -eq 0 ]; then case "$FUN" in System*) do_system_menu ;; - Display*) do_display_menu ;; Interface*) do_interface_menu ;; Localisation*) do_internationalisation_menu ;; Update*) do_update;; From f08d4325385288ed4c1bf36580c4d7041c97489b Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 17:08:44 -0400 Subject: [PATCH 17/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index 4de0e4f..cb378f1 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -608,7 +608,6 @@ do_install_birdnet() { } do_finish() { - disable_raspi_config_at_boot if [ $ASK_TO_REBOOT -eq 1 ]; then whiptail --yesno "Would you like to reboot now?" 20 60 2 if [ $? -eq 0 ]; then # yes From 06ef79fa4370c23b81d7e1a9a5bc5fd4c74cfcaf Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 17:18:58 -0400 Subject: [PATCH 18/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 9618212..3c6aa12 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -103,6 +103,7 @@ and then close the Mouse Pad editing window to continue." else editor=nano fi + env && exit $editor ${my_dir}/Birders_Guide_Installer_Configuration.txt while pgrep $editor &> /dev/null;do sleep 1 From 79b2031b3197aa5394a5fa2b88972f136404deec Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 17:24:00 -0400 Subject: [PATCH 19/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 3c6aa12..a0f12dd 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -99,13 +99,13 @@ and set the passwords for the live audio stream. Save the file after editing and then close the Mouse Pad editing window to continue." set -x if [ -z "$SSH_CONNECTION" ];then - editor=mousepad + EDITOR=mousepad else - editor=nano + EDITOR=nano fi env && exit - $editor ${my_dir}/Birders_Guide_Installer_Configuration.txt - while pgrep $editor &> /dev/null;do + $EDITOR ${my_dir}/Birders_Guide_Installer_Configuration.txt + while pgrep $EDITOR &> /dev/null;do sleep 1 done source ${my_dir}/Birders_Guide_Installer_Configuration.txt || exit 1 From 7702141795beb777971ceb693754425c22667ea5 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 17:26:51 -0400 Subject: [PATCH 20/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index a0f12dd..73b499e 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -97,13 +97,12 @@ stage_2() { echo "Follow the instructions to fill out the LATITUDE and LONGITUDE variables and set the passwords for the live audio stream. Save the file after editing and then close the Mouse Pad editing window to continue." - set -x if [ -z "$SSH_CONNECTION" ];then EDITOR=mousepad else EDITOR=nano fi - env && exit + sex -x $EDITOR ${my_dir}/Birders_Guide_Installer_Configuration.txt while pgrep $EDITOR &> /dev/null;do sleep 1 From 81d61cdfaeabb4b18239b17b3732b451b0ab2194 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 17:29:05 -0400 Subject: [PATCH 21/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 73b499e..c2c88b1 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -102,7 +102,7 @@ and then close the Mouse Pad editing window to continue." else EDITOR=nano fi - sex -x + set -x $EDITOR ${my_dir}/Birders_Guide_Installer_Configuration.txt while pgrep $EDITOR &> /dev/null;do sleep 1 From 7618ff1a58e6eb95275412962d642a5d8e5a58b7 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 18:07:06 -0400 Subject: [PATCH 22/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index cb378f1..2107d28 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -599,7 +599,7 @@ do_update() { } do_install_birdnet() { - if [ -f ${birdnetpi_dir}/Birders_Guide_Installer.sh} ];then + if [ -f ${birdnetpi_dir}/Birders_Guide_Installer.sh ];then sudo -E -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh else curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -E -upi bash From e693285d751606f6b047348d9424c2d6f9f96404 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 18:36:22 -0400 Subject: [PATCH 23/91] Create newinstaller.sh --- newinstaller.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 newinstaller.sh diff --git a/newinstaller.sh b/newinstaller.sh new file mode 100644 index 0000000..ebb6d0c --- /dev/null +++ b/newinstaller.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Simple new installer +HOME=/home/pi +USER=pi +branch=newinstaller +sudo apt update +if ! which git &> /dev/null;then + sudo apt -y install git +fi +git clone --depth 1 -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi +${HOME}/BirdNET-Pi/birdnet-pi-config From c7fcb906f4f44da18b3d6292150591fa4cf40f41 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 18:37:03 -0400 Subject: [PATCH 24/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index 2107d28..d31310d 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -599,11 +599,7 @@ do_update() { } do_install_birdnet() { - if [ -f ${birdnetpi_dir}/Birders_Guide_Installer.sh ];then sudo -E -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh - else - curl -s "https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/${branch}/Birders_Guide_Installer.sh" | sudo -E -upi bash - fi ASK_TO_REBOOT=1 } From eb58eaa80475eb287034ac98bb61959665a3d933 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 18:39:57 -0400 Subject: [PATCH 25/91] Update newinstaller.sh --- newinstaller.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newinstaller.sh b/newinstaller.sh index ebb6d0c..77b5592 100644 --- a/newinstaller.sh +++ b/newinstaller.sh @@ -8,4 +8,4 @@ if ! which git &> /dev/null;then sudo apt -y install git fi git clone --depth 1 -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi -${HOME}/BirdNET-Pi/birdnet-pi-config +sudo -E ${HOME}/BirdNET-Pi/scripts/birdnet-pi-config From 31372726f8ecb10d08bf8f1eb45d20f5a29243ec Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 18:44:59 -0400 Subject: [PATCH 26/91] Update newinstaller.sh --- newinstaller.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/newinstaller.sh b/newinstaller.sh index 77b5592..74bc72f 100644 --- a/newinstaller.sh +++ b/newinstaller.sh @@ -8,4 +8,8 @@ if ! which git &> /dev/null;then sudo apt -y install git fi git clone --depth 1 -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi -sudo -E ${HOME}/BirdNET-Pi/scripts/birdnet-pi-config +echo 'Now, run the following script + + sudo -E ${HOME}/BirdNET-Pi/scripts/birdnet-pi-config + +' From 47d0df12b9da27a57dae25560fd9e2783894ec20 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Wed, 27 Oct 2021 19:06:31 -0400 Subject: [PATCH 27/91] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f1244c0..3bfad9e 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The BirdNET-Pi project is built on the [TFLite version of BirdNET](https://githu The system can be installed with: ``` -curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/newinstaller/scripts/birdnet-pi-config | sudo -E bash +curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/newinstaller/newinstaller.sh | bash ``` The script first enables and configures the zRAM kernel module for swapping, and reboots. From c2fbfd2b8635b53ee92650d9d9eb8e7209ab410b Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Thu, 28 Oct 2021 12:52:42 -0400 Subject: [PATCH 28/91] testing new installer --- Birders_Guide_Installer.sh | 54 +------------------------- scripts/birdnet-pi-config | 78 ++++++++++++++++++++++++++++++++++---- 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index c2c88b1..ea1f6ea 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -15,39 +15,6 @@ information" exit 1 fi -install_zram_swap() { - echo - echo "Configuring zram.service" - sudo touch /etc/modules-load.d/zram.conf - echo 'zram' | sudo tee /etc/modules-load.d/zram.conf - sudo touch /etc/modprobe.d/zram.conf - echo 'options zram num_devices=1' | sudo tee /etc/modprobe.d/zram.conf - sudo touch /etc/udev/rules.d/99-zram.rules - echo 'KERNEL=="zram0", ATTR{disksize}="4G",TAG+="systemd"' \ - | sudo tee /etc/udev/rules.d/99-zram.rules - sudo touch /etc/systemd/system/zram.service - echo "Installing zram.service" - cat << EOF | sudo tee /etc/systemd/system/zram.service &> /dev/null -[Unit] -Description=Swap with zram -After=multi-user.target - -[Service] -Type=oneshot -RemainAfterExit=true -ExecStartPre=/sbin/mkswap /dev/zram0 -ExecStart=/sbin/swapon /dev/zram0 -ExecStop=/sbin/swapoff /dev/zram0 - -[Install] -WantedBy=multi-user.target -EOF - sudo systemctl enable zram - echo "Rebooting the system in 5 seconds" - sleep 5 - sudo reboot -} - stage_1() { echo echo "Beginning Stage 1" @@ -61,16 +28,8 @@ stage_1() { echo "Installing git" sudo apt install -qqy git fi - ZRAM="$(swapon --show=SIZE,NAME | awk -FG '!/SIZE/ && /zram/ {print $1}')" - [ ! -z ${ZRAM} ] || ZRAM=0 - if [ ${ZRAM} -lt 4 ];then - install_zram_swap - else - touch ${HOME}/stage_1_complete - echo "Stage 1 complete" - stage_2 - exit - fi + touch ${HOME}/stage_1_complete + echo "Stage 1 complete" } stage_2() { @@ -102,7 +61,6 @@ and then close the Mouse Pad editing window to continue." else EDITOR=nano fi - set -x $EDITOR ${my_dir}/Birders_Guide_Installer_Configuration.txt while pgrep $EDITOR &> /dev/null;do sleep 1 @@ -133,14 +91,6 @@ Good luck!" exit 1 fi echo "Installing the BirdNET-Pi configuration file." - [ -f ${my_dir}/soundcard_params.txt ] || touch ${my_dir}/soundcard_params.txt - SOUND_PARAMS="${HOME}/BirdNET-Pi/soundcard_params.txt" - SOUND_CARD="$(sudo -u pi aplay -L \ - | grep -e '^hw' \ - | cut -d, -f1 \ - | grep -ve 'vc4' -e 'Head' -e 'PCH' \ - | uniq)" - script -c "arecord -D ${SOUND_CARD} --dump-hw-params" -a ${SOUND_PARAMS} &> /dev/null install_birdnet_config || exit 1 echo "Installing BirdNET-Lite" if ${my_dir}/scripts/install_birdnet.sh << EOF ; then diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index d31310d..4c18b10 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -1,9 +1,10 @@ -#!/bin/sh +#!/usr/bin/env bash # Altered from raspi-config tool below # https://github.com/RPi-Distro/birdnetpi-config # # See LICENSE file for copyright and license details # Copyright (c) 2012 Alex Bradbury +set -x birdnetpi_dir=/home/pi/BirdNET-Pi branch=newinstaller INTERACTIVE=True @@ -365,6 +366,65 @@ get_vnc() { fi } +do_config_zram() { + if [ -e /etc/udev/rules.d/99-zram.rules ]; then + ## get current swap allocation from /etc/udev/rules.d/99-zram.rules + size="$(awk -F\" '{print $4}' /etc/udev/rules.d/99-zram.rules)" + else + size="4G" + fi + new_size=$(whiptail --inputbox "How much memory (G) should the zRAM swap partition have? Choose 1G, 2G, or 4G - 4G recommended" \ + 19 70 -- "$size" 3>&1 1>&2 2>&3) + ASK_TO_REBOOT=1 +} + +do_install_zram() { + echo "Configuring zram.service" + touch /etc/modules-load.d/zram.conf + echo 'zram' > /etc/modules-load.d/zram.conf + touch /etc/modprobe.d/zram.conf + echo 'options zram num_devices=1' > /etc/modprobe.d/zram.conf + touch /etc/udev/rules.d/99-zram.rules + echo "KERNEL==\"zram0\", ATTR{disksize}=\"${new_size}\",TAG+=\"systemd\"" \ + > /etc/udev/rules.d/99-zram.rules + touch /etc/systemd/system/zram.service + echo "Installing zram.service" + cat << EOF > /etc/systemd/system/zram.service +[Unit] +Description=Swap with zram +After=multi-user.target + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStartPre=/sbin/mkswap /dev/zram0 +ExecStart=/sbin/swapon /dev/zram0 +ExecStop=/sbin/swapoff /dev/zram0 + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable zram +} + +do_zram_menu() { + whiptail --yesno "Would like to enable the zram swapping kernel module?" --defaultno 20 60 2 + RET=$? + if [ $RET -eq 0 ]; then + do_config_zram + do_install_zram + STATUS=enabled + elif [ $RET -eq 1 ]; then + if [ -e /etc/udev/rules.d/99-zram.rules ];then + systemctl disable --now zram + fi + STATUS=disabled + else + return $RET + fi + whiptail --msgbox "ZRAM swapping is $STATUS" 20 60 1 +} + do_vnc() { DEFAULT=--defaultno if [ $(get_vnc) -eq 0 ]; then @@ -593,7 +653,7 @@ do_wifi_ssid_passphrase() { return $RET } -do_update() { +do_update_os() { apt update && apt -y full-upgrade ASK_TO_REBOOT=1 } @@ -631,6 +691,9 @@ do_system_menu() { "Password" "Change password for the '$USER' user" \ "Audio" "Select audio device you'd like BirdNET-Pi to use" \ "Wireless LAN" "Enter SSID and passphrase" \ + "Update the OS" "Update the underlying operating system" \ + "Interface Options" "Enable/Disable SSH and VNC" \ + "Configure zRAM" "Enable/Disable zRAM" \ 3>&1 1>&2 2>&3) else exit @@ -643,6 +706,9 @@ do_system_menu() { Password*) do_change_pass ;; Audio*) do_audio ;; Wireless*) do_wifi_ssid_passphrase ;; + Update*) do_update_os ;; + Interface*) do_interface_menu ;; + Configure*) do_zram_menu ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi @@ -703,11 +769,9 @@ if [ "$INTERACTIVE" = True ]; then while true; do if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnetpi-config)" --backtitle "$(cat /proc/device-tree/model)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ - "System Options" "Configure system settings" \ - "Interface Options" "Configure connections to peripherals" \ "Localisation Options" "Configure language and regional settings" \ - "Update the OS" "Update the underlying operating system" \ "Install BirdNET-PI" "Install BirdNET-Pi" \ + "System Options" "Configure system settings" \ 3>&1 1>&2 2>&3) else exit @@ -717,11 +781,9 @@ if [ "$INTERACTIVE" = True ]; then do_finish elif [ $RET -eq 0 ]; then case "$FUN" in - System*) do_system_menu ;; - Interface*) do_interface_menu ;; Localisation*) do_internationalisation_menu ;; - Update*) do_update;; Install*) do_install_birdnet;; + System*) do_system_menu ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 else From 649bc8adf27c2484ca8564707e0522f77f03f61a Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 28 Oct 2021 12:53:54 -0400 Subject: [PATCH 29/91] Update README.md --- README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/README.md b/README.md index 3bfad9e..a95436c 100644 --- a/README.md +++ b/README.md @@ -34,14 +34,6 @@ The system can be installed with: curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/newinstaller/newinstaller.sh | bash ``` -The script first enables and configures the zRAM kernel module for swapping, and reboots. -After the reboot, the configuration file is opened for editing. Here, you will input your latitude and longitude and will set a few passwords to protect your Pi. When the installation has finished, the BirdNET-Pi is ready to start collecting and analyzing data on the next boot. - -If you have trouble with the installation script, you can cancel and rerun the installer: -``` -~/BirdNET-Pi/Birders_Guide_Installer.sh -``` - ## Access The BirdNET-Pi system can be accessed from any web browser on the same network: - http://birdnetpi.local From 06b5a6750819cf7600af26bb7e7165f93ba5e401 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 28 Oct 2021 13:51:29 -0400 Subject: [PATCH 30/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index ea1f6ea..bf677b4 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -328,14 +328,8 @@ Stage 2 guides you through configuring the essentials and installs the full Bird if [ ! -f ${HOME}/stage_1_complete ] ;then stage_1 + stage_2 else stage_2 - if [ -f ${HOME}/Birders_Guide_Installer.sh ];then - rm ${HOME}/Birders_Guide_Installer.sh - fi - rm ${HOME}/stage_1_complete - ${my_dir}/scripts/dump_logs.sh - systemctl --user disable --now birdnet-system-installer.service - sudo rm -f /etc/systemd/user/birdnet-system-installer.service fi From f3f78c8f5d0f318817e9780b638b9baddbbfdb03 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 28 Oct 2021 13:52:48 -0400 Subject: [PATCH 31/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index 4c18b10..5e1ec0d 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -747,8 +747,8 @@ do_internationalisation_menu() { return 0 elif [ $RET -eq 0 ]; then case "$FUN" in - Locale*) do_change_locale ;; - Time*) do_change_timezone ;; + Locale*) do_change_locale; do_finish ;; + Time*) do_change_timezone; do_finish ;; Key*) do_configure_keyboard ;; WLAN*) do_wifi_country ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; From 2338809301a84463f89917ce5bfe75666513fb7b Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 28 Oct 2021 13:59:33 -0400 Subject: [PATCH 32/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index 5e1ec0d..56312fd 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -4,7 +4,7 @@ # # See LICENSE file for copyright and license details # Copyright (c) 2012 Alex Bradbury -set -x +#set -x birdnetpi_dir=/home/pi/BirdNET-Pi branch=newinstaller INTERACTIVE=True From a22c0403be54dd005313eb20f7beeceebfef5a97 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Thu, 28 Oct 2021 14:26:23 -0400 Subject: [PATCH 33/91] some changes --- scripts/birdnet-pi-config | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index 56312fd..bd8fd11 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -216,18 +216,8 @@ do_configure_keyboard() { } do_change_locale() { - if [ "$INTERACTIVE" = True ]; then - dpkg-reconfigure locales - else - local LOCALE="$1" - if ! LOCALE_LINE="$(grep "^$LOCALE " /usr/share/i18n/SUPPORTED)"; then - return 1 - fi - local ENCODING="$(echo $LOCALE_LINE | cut -f2 -d " ")" - echo "$LOCALE $ENCODING" > /etc/locale.gen - sed -i "s/^\s*LANG=\S*/LANG=$LOCALE/" /etc/default/locale - dpkg-reconfigure -f noninteractive locales - fi + dpkg-reconfigure locales + ASK_TO_REBOOT=2 } do_change_timezone() { @@ -670,6 +660,8 @@ do_finish() { sync reboot fi + elif [ $ASK_TO_REBOOT -eq 2 ]; then + whiptail --yesno "You must reboot. Do that now?" 20 60 2 fi exit 0 } From ef28f81188e68da645113ec4c7ef44ddaf656418 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Thu, 28 Oct 2021 17:12:57 -0400 Subject: [PATCH 34/91] configures audio input now --- scripts/birdnet-pi-config | 152 ++++++++++++++------------------------ 1 file changed, 54 insertions(+), 98 deletions(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index bd8fd11..c8b56d2 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Altered from raspi-config tool below -# https://github.com/RPi-Distro/birdnetpi-config +# https://github.com/RPi-Distro/birdnet-pi-config # # See LICENSE file for copyright and license details # Copyright (c) 2012 Alex Bradbury @@ -217,7 +217,10 @@ do_configure_keyboard() { do_change_locale() { dpkg-reconfigure locales + if [ $? -eq 0 ];then + return 0 ASK_TO_REBOOT=2 + fi } do_change_timezone() { @@ -365,7 +368,12 @@ do_config_zram() { fi new_size=$(whiptail --inputbox "How much memory (G) should the zRAM swap partition have? Choose 1G, 2G, or 4G - 4G recommended" \ 19 70 -- "$size" 3>&1 1>&2 2>&3) - ASK_TO_REBOOT=1 + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi } do_install_zram() { @@ -395,6 +403,12 @@ ExecStop=/sbin/swapoff /dev/zram0 WantedBy=multi-user.target EOF systemctl enable zram + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi } do_zram_menu() { @@ -409,10 +423,9 @@ do_zram_menu() { systemctl disable --now zram fi STATUS=disabled - else - return $RET fi whiptail --msgbox "ZRAM swapping is $STATUS" 20 60 1 + return $RET } do_vnc() { @@ -451,92 +464,20 @@ do_vnc() { do_audio() { if is_pulseaudio ; then oIFS="$IFS" - if [ "$INTERACTIVE" = True ]; then - list=$(sudo -u $SUDO_USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pacmd list-sinks | grep -e index -e alsa.name | sed s/*//g | sed s/^[' '\\t]*//g | sed s/'index: '//g | sed s/'alsa.name = '//g | sed s/'bcm2835 '//g | sed s/\"//g | tr '\n' '/') - if ! [ -z "$list" ] ; then - IFS="/" - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 ${list} 3>&1 1>&2 2>&3) - else - whiptail --msgbox "No internal audio devices found" 20 60 1 - return 1 - fi + list=$(sudo -u $SUDO_USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pacmd list-sources | grep -B1 -e 'alsa.card_name' -e 'name.*input' | grep -A4 index | sed -e s/*//g | sed s/^[' '\\t]*//g | grep -e index -e card_name | sed s/'index: '//g | sed s/'alsa.card_name = '//g | sed s/\"//g | tr '\n' '\/') + if ! [ -z "$list" ] ; then + IFS="/" + AUDIO_IN=$(whiptail --menu "Choose the audio input" 20 60 10 ${list} 3>&1 1>&2 2>&3) + return 0 else - AUDIO_OUT=$1 - true + whiptail --msgbox "No internal audio devices found" 20 60 1 + return 1 fi if [ $? -eq 0 ]; then - sudo -u $SUDO_USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pactl set-default-sink $AUDIO_OUT + sudo -u $SUDO_USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pactl set-default-source "$AUDIO_IN" fi IFS=$oIFS - else - if aplay -l | grep -q "bcm2835 ALSA"; then - if [ "$INTERACTIVE" = True ]; then - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ - "0" "Auto" \ - "1" "Force 3.5mm ('headphone') jack" \ - "2" "Force HDMI" \ - 3>&1 1>&2 2>&3) - else - AUDIO_OUT=$1 - fi - if [ $? -eq 0 ]; then - amixer cset numid=3 "$AUDIO_OUT" - fi - else - ASPATH=$(getent passwd $USER | cut -d : -f 6)/.asoundrc - if [ "$INTERACTIVE" = True ]; then - CARD0=$(LC_ALL=C aplay -l | grep bcm2835 | grep "card 0" | cut -d [ -f 3 | cut -d ] -f 1 | cut -d ' ' -f 2-) - CARD1=$(LC_ALL=C aplay -l | grep bcm2835 | grep "card 1" | cut -d [ -f 3 | cut -d ] -f 1 | cut -d ' ' -f 2-) - CARD2=$(LC_ALL=C aplay -l | grep bcm2835 | grep "card 2" | cut -d [ -f 3 | cut -d ] -f 1 | cut -d ' ' -f 2-) - if ! [ -z "$CARD2" ]; then - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ - "0" "$CARD0" \ - "1" "$CARD1" \ - "2" "$CARD2" \ - 3>&1 1>&2 2>&3) - elif ! [ -z "$CARD1" ]; then - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ - "0" "$CARD0" \ - "1" "$CARD1" \ - 3>&1 1>&2 2>&3) - elif ! [ -z "$CARD0" ]; then - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ - "0" "$CARD0" \ - 3>&1 1>&2 2>&3) - else - whiptail --msgbox "No internal audio devices found" 20 60 1 - false - fi - else - AUDIO_OUT=$1 - fi - if [ $? -eq 0 ]; then - cat << EOF > $ASPATH -pcm.!default { - type asym - playback.pcm { - type plug - slave.pcm "output" - } - capture.pcm { - type plug - slave.pcm "input" - } -} - -pcm.output { - type hw - card $AUDIO_OUT -} - -ctl.!default { - type hw - card $AUDIO_OUT -} -EOF - fi fi - fi } list_wlan_interfaces() { @@ -653,6 +594,16 @@ do_install_birdnet() { ASK_TO_REBOOT=1 } +insist_on_reboot() { + if [ $ASK_TO_REBOOT -eq 2 ]; then + whiptail --yesno "You really should reboot. Do that now?" 20 60 2 + if [ $? -eq 0 ]; then # yes + sync + reboot + fi + fi +} + do_finish() { if [ $ASK_TO_REBOOT -eq 1 ]; then whiptail --yesno "Would you like to reboot now?" 20 60 2 @@ -661,13 +612,18 @@ do_finish() { reboot fi elif [ $ASK_TO_REBOOT -eq 2 ]; then - whiptail --yesno "You must reboot. Do that now?" 20 60 2 + whiptail --yesno "You really should reboot. Do that now?" 20 60 2 + if [ $? -eq 0 ]; then # yes + sync + reboot + fi fi exit 0 } + # Everything else needs to be run as root if [ $(id -u) -ne 0 ]; then - printf "Script must be run as root. Try 'sudo birdnetpi-config'\n" + printf "Script must be run as root. Try 'sudo birdnet-pi-config'\n" exit 1 fi @@ -679,7 +635,7 @@ fi do_system_menu() { if is_pi ; then - FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnetpi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "Password" "Change password for the '$USER' user" \ "Audio" "Select audio device you'd like BirdNET-Pi to use" \ "Wireless LAN" "Enter SSID and passphrase" \ @@ -708,7 +664,7 @@ do_system_menu() { do_interface_menu() { if is_pi ; then - FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnetpi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "SSH" "Enable/disable remote command line access using SSH" \ "VNC" "Enable/disable graphical remote access using RealVNC" \ 3>&1 1>&2 2>&3) @@ -728,7 +684,7 @@ do_interface_menu() { } do_internationalisation_menu() { - FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnetpi-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "Locale" "Configure language and regional settings" \ "Timezone" "Configure time zone" \ "Keyboard" "Set keyboard layout to match your keyboard" \ @@ -739,8 +695,8 @@ do_internationalisation_menu() { return 0 elif [ $RET -eq 0 ]; then case "$FUN" in - Locale*) do_change_locale; do_finish ;; - Time*) do_change_timezone; do_finish ;; + Locale*) do_change_locale; insist_on_reboot;; + Time*) do_change_timezone; insist_on_reboot ;; Key*) do_configure_keyboard ;; WLAN*) do_wifi_country ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; @@ -754,15 +710,15 @@ if [ "$INTERACTIVE" = True ]; then [ -e $CONFIG ] || touch $CONFIG calc_wt_size while [ "$USER" = "root" ] || [ -z "$USER" ]; do - if ! USER=$(whiptail --inputbox "birdnetpi-config could not determine the default user.\\n\\nWhat user should these settings apply to?" 20 60 pi 3>&1 1>&2 2>&3); then + if ! USER=$(whiptail --inputbox "birdnet-pi-config could not determine the default user.\\n\\nWhat user should these settings apply to?" 20 60 pi 3>&1 1>&2 2>&3); then return 0 fi done while true; do if is_pi ; then - FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnetpi-config)" --backtitle "$(cat /proc/device-tree/model)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ - "Localisation Options" "Configure language and regional settings" \ - "Install BirdNET-PI" "Install BirdNET-Pi" \ + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --backtitle "$(cat /proc/device-tree/model)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ + "Step 1" "Configure language and regional settings" \ + "Step 2" "Install BirdNET-Pi" \ "System Options" "Configure system settings" \ 3>&1 1>&2 2>&3) else @@ -773,9 +729,9 @@ if [ "$INTERACTIVE" = True ]; then do_finish elif [ $RET -eq 0 ]; then case "$FUN" in - Localisation*) do_internationalisation_menu ;; - Install*) do_install_birdnet;; - System*) do_system_menu ;; + *1) do_internationalisation_menu ;; + *2) do_install_birdnet;; + Sys*) do_system_menu ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 else From 1ca1e75957fc8d316eef108ab7eea18528928f0c Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Thu, 28 Oct 2021 17:16:17 -0400 Subject: [PATCH 35/91] reloads pulse now --- scripts/birdnet-pi-config | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index c8b56d2..391e7e2 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -478,6 +478,7 @@ do_audio() { fi IFS=$oIFS fi + sudo -u $SUDO_USER pulseaudio -k } list_wlan_interfaces() { From c131439f4f4f293ba788b4ef67779e2b995a9990 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Fri, 29 Oct 2021 12:05:53 -0400 Subject: [PATCH 36/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index bf677b4..c4a5080 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -45,7 +45,7 @@ stage_2() { if [ ! -d ${my_dir} ];then cd ${HOME} || exit 1 echo "Cloning the BirdNET-Pi repository $branch branch into your home directory" - git clone --depth 1 -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi + git clone -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi else cd ${my_dir} && git checkout ${branch} fi From fe478c235bc869f19af1080a9c345abff46668b8 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Fri, 29 Oct 2021 16:13:55 -0400 Subject: [PATCH 37/91] fixing some things, adding birdnet.conf configuration tools --- scripts/birdnet-pi-config | 346 ++++++++++++++++++++------------------ scripts/write_config.sh | 10 ++ 2 files changed, 197 insertions(+), 159 deletions(-) create mode 100755 scripts/write_config.sh diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index 391e7e2..3281a3b 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -4,8 +4,9 @@ # # See LICENSE file for copyright and license details # Copyright (c) 2012 Alex Bradbury -#set -x +set -x birdnetpi_dir=/home/pi/BirdNET-Pi +birders_config=${birdnetpi_dir}/Birders_Guide_Installer_Configuration.txt branch=newinstaller INTERACTIVE=True ASK_TO_REBOOT=0 @@ -130,70 +131,6 @@ calc_wt_size() { WT_MENU_HEIGHT=$(($WT_HEIGHT-7)) } -set_config_var() { - lua - "$1" "$2" "$3" < "$3.bak" -local key=assert(arg[1]) -local value=assert(arg[2]) -local fn=assert(arg[3]) -local file=assert(io.open(fn)) -local made_change=false -for line in file:lines() do - if line:match("^#?%s*"..key.."=.*$") then - line=key.."="..value - made_change=true - end - print(line) -end - -if not made_change then - print(key.."="..value) -end -EOF -mv "$3.bak" "$3" -} - -clear_config_var() { - lua - "$1" "$2" < "$2.bak" -local key=assert(arg[1]) -local fn=assert(arg[2]) -local file=assert(io.open(fn)) -for line in file:lines() do - if line:match("^%s*"..key.."=.*$") then - line="#"..line - end - print(line) -end -EOF -mv "$2.bak" "$2" -} - -get_config_var() { - lua - "$1" "$2" < /etc/timezone - dpkg-reconfigure -f noninteractive tzdata - fi + dpkg-reconfigure tzdata && \ + return 0 } get_wifi_country() { CODE=${1:-0} IFACE="$(list_wlan_interfaces | head -n 1)" if [ -z "$IFACE" ]; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "No wireless interface found" 20 60 - fi + whiptail --msgbox "No wireless interface found" 20 60 return 1 fi if ! wpa_cli -i "$IFACE" status > /dev/null 2>&1; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Could not communicate with wpa_supplicant" 20 60 - fi + whiptail --msgbox "Could not communicate with wpa_supplicant" 20 60 return 1 fi wpa_cli -i "$IFACE" save_config > /dev/null 2>&1 @@ -266,28 +187,19 @@ get_wifi_country() { do_wifi_country() { IFACE="$(list_wlan_interfaces | head -n 1)" if [ -z "$IFACE" ]; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "No wireless interface found" 20 60 - fi + whiptail --msgbox "No wireless interface found" 20 60 return 1 fi if ! wpa_cli -i "$IFACE" status > /dev/null 2>&1; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Could not communicate with wpa_supplicant" 20 60 - fi + whiptail --msgbox "Could not communicate with wpa_supplicant" 20 60 return 1 fi oIFS="$IFS" - if [ "$INTERACTIVE" = True ]; then - value=$(cat /usr/share/zoneinfo/iso3166.tab | tail -n +26 | tr '\t' '/' | tr '\n' '/') - IFS="/" - COUNTRY=$(whiptail --menu "Select the country in which the Pi is to be used" 20 60 10 ${value} 3>&1 1>&2 2>&3) - else - COUNTRY=$1 - true - fi + value=$(cat /usr/share/zoneinfo/iso3166.tab | tail -n +26 | tr '\t' '/' | tr '\n' '/') + IFS="/" + COUNTRY=$(whiptail --menu "Select the country in which the Pi is to be used" 20 60 10 ${value} 3>&1 1>&2 2>&3) if [ $? -eq 0 ];then wpa_cli -i "$IFACE" set country "$COUNTRY" wpa_cli -i "$IFACE" save_config > /dev/null 2>&1 @@ -302,9 +214,7 @@ do_wifi_country() { done fi fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Wireless LAN country set to $COUNTRY" 20 60 1 - fi + whiptail --msgbox "Wireless LAN country set to $COUNTRY" 20 60 1 fi IFS=$oIFS } @@ -326,14 +236,9 @@ do_ssh() { if [ $(get_ssh) -eq 0 ]; then DEFAULT= fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno \ - "Would you like the SSH server to be enabled?\n\nCaution: Default and weak passwords are a security risk when SSH is enabled!" \ - $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi + whiptail --yesno \ + "Would you like the SSH server to be enabled?\n\nCaution: Default and weak passwords are a security risk when SSH is enabled!" $DEFAULT 20 60 2 + RET=$? if [ $RET -eq 0 ]; then ssh-keygen -A && update-rc.d ssh enable && @@ -346,9 +251,7 @@ do_ssh() { else return $RET fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The SSH server is $STATUS" 20 60 1 - fi + whiptail --msgbox "The SSH server is $STATUS" 20 60 1 } get_vnc() { @@ -433,12 +336,7 @@ do_vnc() { if [ $(get_vnc) -eq 0 ]; then DEFAULT= fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the VNC Server to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi + whiptail --yesno "Would you like the VNC Server to be enabled?" $DEFAULT 20 60 2 if [ $RET -eq 0 ]; then if is_installed realvnc-vnc-server || apt-get install realvnc-vnc-server; then systemctl enable vncserver-x11-serviced.service && @@ -456,9 +354,7 @@ do_vnc() { else return $RET fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The VNC Server is $STATUS" 20 60 1 - fi + whiptail --msgbox "The VNC Server is $STATUS" 20 60 1 } do_audio() { @@ -495,25 +391,21 @@ do_wifi_ssid_passphrase() { IFACE="$(echo "$IFACE_LIST" | head -n 1)" if [ -z "$IFACE" ]; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "No wireless interface found" 20 60 - fi + whiptail --msgbox "No wireless interface found" 20 60 return 1 fi if ! wpa_cli -i "$IFACE" status > /dev/null 2>&1; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Could not communicate with wpa_supplicant" 20 60 - fi + whiptail --msgbox "Could not communicate with wpa_supplicant" 20 60 return 1 fi - if [ "$INTERACTIVE" = True ] && [ -z "$(get_wifi_country)" ]; then + if [ -z "$(get_wifi_country)" ]; then do_wifi_country fi SSID="$1" - while [ -z "$SSID" ] && [ "$INTERACTIVE" = True ]; do + while [ -z "$SSID" ] ; do SSID=$(whiptail --inputbox "Please enter SSID" 20 60 3>&1 1>&2 2>&3) if [ $? -ne 0 ]; then return 0 @@ -523,14 +415,12 @@ do_wifi_ssid_passphrase() { done PASSPHRASE="$2" - while [ "$INTERACTIVE" = True ]; do - PASSPHRASE=$(whiptail --passwordbox "Please enter passphrase. Leave it empty if none." 20 60 3>&1 1>&2 2>&3) - if [ $? -ne 0 ]; then - return 0 - else - break - fi - done + PASSPHRASE=$(whiptail --passwordbox "Please enter passphrase. Leave it empty if none." 20 60 3>&1 1>&2 2>&3) + if [ $? -ne 0 ]; then + return 0 + else + return 1 + fi # Escape special characters for embedding in regex below local ssid="$(echo "$SSID" \ @@ -572,9 +462,7 @@ do_wifi_ssid_passphrase() { wpa_cli -i "$IFACE" enable_network "$ID" > /dev/null 2>&1 else wpa_cli -i "$IFACE" remove_network "$ID" > /dev/null 2>&1 - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Failed to set SSID or passphrase" 20 60 - fi + whiptail --msgbox "Failed to set SSID or passphrase" 20 60 fi wpa_cli -i "$IFACE" save_config > /dev/null 2>&1 @@ -585,13 +473,82 @@ do_wifi_ssid_passphrase() { return $RET } +do_get_db_root_pwd() { + db_root_pwd=$(whiptail --inputbox "Please set the password the 'root' user will use to access the database." \ + 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_get_db_pwd() { + db_pwd=$(whiptail --inputbox "Please set the password the 'birder' user will use to access the database." \ + 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_get_ice_pwd() { + ice_pwd=$(whiptail --inputbox "Please set the password for the live stream." \ + 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_get_caddy_pwd() { + caddy_pwd=$(whiptail --inputbox "Please set the password for the web interface." \ + 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + + +do_get_lon() { + lon="$(curl -s4 ifconfig.co/json | awk '/lon/ {print $2}' | tr -d ',')" + new_lon=$(whiptail --inputbox "Please set the longitude where recordings will take place." \ + 19 70 -- "$lon" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_get_lat() { + lat="$(curl -s4 ifconfig.co/json | awk '/lat/ {print $2}' | tr -d ',')" + new_lat=$(whiptail --inputbox "Please set the latitude where recordings will take place." \ + 19 70 -- "$lat" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + do_update_os() { apt update && apt -y full-upgrade ASK_TO_REBOOT=1 } do_install_birdnet() { - sudo -E -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh + sudo -E -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh ASK_TO_REBOOT=1 } @@ -628,12 +585,6 @@ if [ $(id -u) -ne 0 ]; then exit 1 fi -if [ -n "${OPT_MEMORY_SPLIT:-}" ]; then - set -e # Fail when a command errors - set_memory_split "${OPT_MEMORY_SPLIT}" - exit 0 -fi - do_system_menu() { if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ @@ -643,6 +594,9 @@ do_system_menu() { "Update the OS" "Update the underlying operating system" \ "Interface Options" "Enable/Disable SSH and VNC" \ "Configure zRAM" "Enable/Disable zRAM" \ + "Timezone" "Configure time zone" \ + "Keyboard" "Set keyboard layout to match your keyboard" \ + "WLAN Country" "Set legal wireless channels for your country" \ 3>&1 1>&2 2>&3) else exit @@ -658,6 +612,84 @@ do_system_menu() { Update*) do_update_os ;; Interface*) do_interface_menu ;; Configure*) do_zram_menu ;; + Time*) do_change_timezone; insist_on_reboot ;; + Key*) do_configure_keyboard ;; + WLAN*) do_wifi_country ;; + *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; + esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 + fi +} + +do_advanced_config() { + if is_pi ; then + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "BirdNET-Pi Configuration Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "Sensitivity" "Set the sigmoid sensitivity" \ + "Confidence" "Set the minimum confidence score required for a detection" \ + "Overlap" "Set the analysis overlap in seconds" \ + "BirdNET-Pi URLs" "Set the URLs your installation should use" \ + 3>&1 1>&2 2>&3) + else + exit + fi + RET=$? + if [ $RET -eq 1 ]; then + return 0 + elif [ $RET -eq 0 ]; then + case "$FUN" in + Sens*) do_get_sensitivity;; + Confi*) do_get_confidence;; + Overlap*) do_get_overlap;; + Bird*) do_get_birdnetpi_urls;; + *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; + esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 + fi +} + +do_get_db_pwds() { + if is_pi ; then + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Set Datbase Passwords" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "'birder' " "Set the database password for the 'birder' user" \ + "'root' " "Set the database password for the 'root' user" \ + 3>&1 1>&2 2>&3) + else + exit + fi + RET=$? + if [ $RET -eq 1 ]; then + return 0 + elif [ $RET -eq 0 ]; then + case "$FUN" in + *bird*) do_get_db_pwd;; + *root*) do_get_db_root_pwd;; + *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; + esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 + fi +} + +do_config_birdnet_menu() { + if is_pi ; then + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "BirdNET-Pi Configuration Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "Latitude " "Set the latitude your system should use" \ + "Longitude" "Set the longitude your system should use" \ + "Caddy Password" "Set the web interface password" \ + "IceCast2 Password" "Set the IceCast2 password" \ + "Database Passwords" "Set the passwords the MariaDB will use" \ + "Advanced Settings" "Sensitivity, Overlap, Confidence, URLs" \ + 3>&1 1>&2 2>&3) + else + exit + fi + RET=$? + if [ $RET -eq 1 ]; then + return 0 + elif [ $RET -eq 0 ]; then + case "$FUN" in + Lat*) do_get_lat;; + Lon*) do_get_lon;; + Cad*) do_get_caddy_pwd;; + Ice*) do_get_ice_pwd;; + Data*) do_get_db_pwds;; + Advanced*) do_advanced_config;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi @@ -687,9 +719,6 @@ do_interface_menu() { do_internationalisation_menu() { FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "Locale" "Configure language and regional settings" \ - "Timezone" "Configure time zone" \ - "Keyboard" "Set keyboard layout to match your keyboard" \ - "WLAN Country" "Set legal wireless channels for your country" \ 3>&1 1>&2 2>&3) RET=$? if [ $RET -eq 1 ]; then @@ -697,9 +726,6 @@ do_internationalisation_menu() { elif [ $RET -eq 0 ]; then case "$FUN" in Locale*) do_change_locale; insist_on_reboot;; - Time*) do_change_timezone; insist_on_reboot ;; - Key*) do_configure_keyboard ;; - WLAN*) do_wifi_country ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi @@ -718,8 +744,9 @@ if [ "$INTERACTIVE" = True ]; then while true; do if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --backtitle "$(cat /proc/device-tree/model)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ - "Step 1" "Configure language and regional settings" \ - "Step 2" "Install BirdNET-Pi" \ + "Step 1" "Configure language" \ + "Step 2" "Configure BirdNET-Pi before installation" \ + "Step 3" "Install BirdNET-Pi" \ "System Options" "Configure system settings" \ 3>&1 1>&2 2>&3) else @@ -731,7 +758,8 @@ if [ "$INTERACTIVE" = True ]; then elif [ $RET -eq 0 ]; then case "$FUN" in *1) do_internationalisation_menu ;; - *2) do_install_birdnet;; + *2) do_config_birdnet_menu ;; + *3) do_install_birdnet;; Sys*) do_system_menu ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 diff --git a/scripts/write_config.sh b/scripts/write_config.sh new file mode 100755 index 0000000..d8155ec --- /dev/null +++ b/scripts/write_config.sh @@ -0,0 +1,10 @@ +#!/usr/bin/bash +# Writes variables to config file +birdnetpi_dir=/home/pi/BirdNET-Pi +birders_conf=${birdnetpi_dir}/Birders_Guide_Installer_Configuration.txt +sed -i s/'^LATITUDE=$'/"LATITUDE=${new_lat}"/g ${birders_conf} +sed -i s/'^LONGITUDE=$'/"LONGITUDE=${new_lon}"/g ${birders_conf} +sed -i s/'^CADDY_PWD=$'/"CADDY_PWD=${caddy_pwd}"/g ${birders_conf} +sed -i s/'^ICE_PWD=$'/"ICE_PWD=${ice_pwd}"/g ${birders_conf} +sed -i s/'^DB_PWD=$'/"DB_PWD=${db_pwd}"/g ${birders_conf} +sed -i s/'^DB_ROOT_PWD=$'/"DB_ROOT_PWD=${db_root_pwd}"/g ${birders_conf} From 0153d86019a44594252f071f4c16cc95680ba1e3 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Fri, 29 Oct 2021 16:53:50 -0400 Subject: [PATCH 38/91] Update birdnet-pi-config --- scripts/birdnet-pi-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index 3281a3b..f99660d 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -548,7 +548,7 @@ do_update_os() { } do_install_birdnet() { - sudo -E -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh + sudo -E -upi ${birdnetpi_dir}/scripts/install_birdnet.sh ASK_TO_REBOOT=1 } From 1c927b8aa20749878bc2249f7a379da6c684e502 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Fri, 29 Oct 2021 17:07:51 -0400 Subject: [PATCH 39/91] tweaking based on a new test --- Birders_Guide_Installer.sh | 3 ++- scripts/birdnet-pi-config | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index c4a5080..a32a800 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -50,7 +50,8 @@ stage_2() { cd ${my_dir} && git checkout ${branch} fi - if [ -f ${my_dir}/Birders_Guide_Installer_Configuration.txt ];then + source ${my_dir}/Birders_Guide_Installer_Configuration.txt + if [ -z ${LATITUDE} ] || [ -z ${LONGITUDE} ] || [ -z ${CADDY_PWD} ] || [ -z ${ICE_PWD} ] || [ -z ${DB_PWD} ] || [ -z ${DB_ROOT_PWD} ];then echo echo echo "Follow the instructions to fill out the LATITUDE and LONGITUDE variables diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index f99660d..db68e3a 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -543,13 +543,13 @@ do_get_lat() { } do_update_os() { - apt update && apt -y full-upgrade - ASK_TO_REBOOT=1 + apt update && apt -y full-upgrade && \ + ASK_TO_REBOOT=1 } do_install_birdnet() { - sudo -E -upi ${birdnetpi_dir}/scripts/install_birdnet.sh - ASK_TO_REBOOT=1 + sudo -E -upi ${birdnetpi_dir}/Birders_Guide_Installer.sh && \ + ASK_TO_REBOOT=1 } insist_on_reboot() { From 7727056bae2eda401a604de7a1a15208beb55ffd Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Fri, 29 Oct 2021 17:15:12 -0400 Subject: [PATCH 40/91] fixing? --- Birders_Guide_Installer.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index a32a800..4a44550 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -52,11 +52,11 @@ stage_2() { source ${my_dir}/Birders_Guide_Installer_Configuration.txt if [ -z ${LATITUDE} ] || [ -z ${LONGITUDE} ] || [ -z ${CADDY_PWD} ] || [ -z ${ICE_PWD} ] || [ -z ${DB_PWD} ] || [ -z ${DB_ROOT_PWD} ];then - echo echo echo "Follow the instructions to fill out the LATITUDE and LONGITUDE variables and set the passwords for the live audio stream. Save the file after editing and then close the Mouse Pad editing window to continue." + echo if [ -z "$SSH_CONNECTION" ];then EDITOR=mousepad else @@ -68,12 +68,6 @@ and then close the Mouse Pad editing window to continue." done source ${my_dir}/Birders_Guide_Installer_Configuration.txt || exit 1 else - echo "Something went wrong. I can't find the configuration file." - exit 1 - fi - - if [ -z ${LATITUDE} ] || [ -z ${LONGITUDE} ] || [ -z ${CADDY_PWD} ] || [ -z ${ICE_PWD} ] || [ -z ${DB_PWD} ] || [ -z ${DB_ROOT_PWD} ];then - echo echo echo "It looks like you haven't filled out the Birders_Guide_Installer_Configuration.txt file completely. From f8dbd3b246a66ad155e9356d436e124a3d65fd6c Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Fri, 29 Oct 2021 17:23:55 -0400 Subject: [PATCH 41/91] another tweak --- Birders_Guide_Installer.sh | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 4a44550..5435bcf 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -67,23 +67,6 @@ and then close the Mouse Pad editing window to continue." sleep 1 done source ${my_dir}/Birders_Guide_Installer_Configuration.txt || exit 1 - else - echo - echo "It looks like you haven't filled out the Birders_Guide_Installer_Configuration.txt file -completely. - -Open that file to edit it. (Go to the folder icon in the top left and look for the \"BirdNET-Pi\" -folder and double-click the file called \"Birders_Guide_Installer_Configuration.txt\" -Enter the latitude and longitude of where the BirdNET-Pi will be. -You can find this information at https://maps.google.com - -Find your location on the map and right click to find your coordinates. -After you have filled out the configuration file, you can re-run this script. Just do the exact -same things you did to start this (copying and pasting from the Wiki) to try again. -Press Enter to close this window. -Good luck!" - read - exit 1 fi echo "Installing the BirdNET-Pi configuration file." install_birdnet_config || exit 1 From 1017bbbf22d5fa7d2891b44b76c91fdee1e04a50 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Fri, 29 Oct 2021 17:58:37 -0400 Subject: [PATCH 42/91] working better -- added URL configuration --- Birders_Guide_Installer.sh | 6 +-- Birders_Guide_Installer_Configuration.txt | 7 +++ scripts/birdnet-pi-config | 58 +++++++++++++++++++++-- scripts/write_config.sh | 3 ++ 4 files changed, 68 insertions(+), 6 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 5435bcf..9aeb68f 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -149,9 +149,9 @@ DO_RECORDING=y ## will be web-hosted. If you do not own a domain, or would just prefer to keep ## the BirdNET-Pi on your local network, keep this EMPTY. -BIRDNETPI_URL= -EXTRACTIONLOG_URL= -BIRDNETLOG_URL= +BIRDNETPI_URL=${BIRDNETPI_URL} +EXTRACTIONLOG_URL=${EXTRACTIONLOG_URL} +BIRDNETLOG_URL=${BIRDNETLOG_URL} ## CADDY_PWD is the plaintext password (that will be hashed) and used to access ## the "Processed" directory and live audio stream. This MUST be set if you diff --git a/Birders_Guide_Installer_Configuration.txt b/Birders_Guide_Installer_Configuration.txt index b2e0eed..78445fc 100644 --- a/Birders_Guide_Installer_Configuration.txt +++ b/Birders_Guide_Installer_Configuration.txt @@ -45,3 +45,10 @@ DB_ROOT_PWD= # detections. PUSHED_APP_SECRET= PUSHED_APP_KEY= + +# If you own your own domain, you can input that here to have caddy register +# TLS certificates for the web interface + +BIRDNETPI_URL= +BIRDNETLOG_URL= +EXTRACTIONLOG_URL= diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index db68e3a..96f0389 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -473,6 +473,39 @@ do_wifi_ssid_passphrase() { return $RET } +do_get_birdnetlog_url() { + birdnetlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetlog.pmcgui.xyz\"." \ + 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_get_extractionlog_url() { + extractionlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://extractionlog.pmcgui.xyz\"." \ + 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_get_birdnetpi_url() { + birdnetpi_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetpi.pmcgui.xyz\"." \ + 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + do_get_db_root_pwd() { db_root_pwd=$(whiptail --inputbox "Please set the password the 'root' user will use to access the database." \ 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh @@ -585,6 +618,25 @@ if [ $(id -u) -ne 0 ]; then exit 1 fi +do_get_urls_menu() { + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "BirdNET-Pi URL" "Set the main web interface URL" \ + "BirdNET Analysis Log URL" "Set the URL that will be used to view the BirdNET log" \ + "Audio Extraction Log URL" "Set the URL that will be used to view the Audio Extraction log" \ + 3>&1 1>&2 2>&3) + RET=$? + if [ $RET -eq 1 ]; then + return 0 + elif [ $RET -eq 0 ]; then + case "$FUN" in + *Pi*) do_get_birdnetpi_url;; + *Analysis*) do_get_extractionlog_url;; + Audio*) do_get_birdnetlog_url;; + *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; + esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 + fi +} + do_system_menu() { if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ @@ -620,7 +672,7 @@ do_system_menu() { fi } -do_advanced_config() { +do_advanced_config_menu() { if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "BirdNET-Pi Configuration Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "Sensitivity" "Set the sigmoid sensitivity" \ @@ -639,7 +691,7 @@ do_advanced_config() { Sens*) do_get_sensitivity;; Confi*) do_get_confidence;; Overlap*) do_get_overlap;; - Bird*) do_get_birdnetpi_urls;; + Bird*) do_get_birdnetpi_url; do_get_birdnetlog_url; do_get_extractionlog_url;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi @@ -689,7 +741,7 @@ do_config_birdnet_menu() { Cad*) do_get_caddy_pwd;; Ice*) do_get_ice_pwd;; Data*) do_get_db_pwds;; - Advanced*) do_advanced_config;; + Advanced*) do_advanced_config_menu;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi diff --git a/scripts/write_config.sh b/scripts/write_config.sh index d8155ec..424a753 100755 --- a/scripts/write_config.sh +++ b/scripts/write_config.sh @@ -8,3 +8,6 @@ sed -i s/'^CADDY_PWD=$'/"CADDY_PWD=${caddy_pwd}"/g ${birders_conf} sed -i s/'^ICE_PWD=$'/"ICE_PWD=${ice_pwd}"/g ${birders_conf} sed -i s/'^DB_PWD=$'/"DB_PWD=${db_pwd}"/g ${birders_conf} sed -i s/'^DB_ROOT_PWD=$'/"DB_ROOT_PWD=${db_root_pwd}"/g ${birders_conf} +sed -i s/'^BIRDNETPI_URL=$'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birders_conf} +sed -i s/'^EXTRACTIONLOG_URL=$'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birders_conf} +sed -i s/'^BIRDNETLOG_URL=$'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birders_conf} From a73720b7c8c3461273d632b6173f340fe0c4e5b7 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Sat, 30 Oct 2021 12:12:23 -0400 Subject: [PATCH 43/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 9aeb68f..8ac5ae6 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -295,15 +295,6 @@ EOF sudo ln -sf ${my_dir}/birdnet.conf /etc/birdnet/birdnet.conf } echo " -Welcome to the Birders Guide Installer script! - -The installer runs in two stages: -Stage 1 configures and enables the zRAM kernel module and allocates 4G - to its swapping size if needed. This will trigger a reboot. -Stage 1 also ensures the system is up to date. -Stage 2 guides you through configuring the essentials and installs the full BirdNET-Pi system." - - if [ ! -f ${HOME}/stage_1_complete ] ;then stage_1 stage_2 From 0de977fc488ac0143263b75e0b1a01994f50b3e0 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 31 Oct 2021 10:26:00 -0400 Subject: [PATCH 44/91] adding features to birdnet-pi-config can now adjust/set/reset the following: - sensitivity - overlap - minimum confidence score - custom BirdNET-Pi URLs - CADDY_PWD - Database Passwords - Lat and Lon --- scripts/birdnet-pi-config | 210 +++++++++++++++++++++++++++++++++++++- scripts/rewrite_config.sh | 45 ++++++++ 2 files changed, 253 insertions(+), 2 deletions(-) create mode 100755 scripts/rewrite_config.sh diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index 96f0389..a473113 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -473,6 +473,135 @@ do_wifi_ssid_passphrase() { return $RET } +do_reget_birdnetlog_url() { + birdnetlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetlog.pmcgui.xyz\"." \ + 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_reget_extractionlog_url() { + extractionlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://extractionlog.pmcgui.xyz\"." \ + 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_reget_birdnetpi_url() { + birdnetpi_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetpi.pmcgui.xyz\"." \ + 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_reget_db_root_pwd() { + db_root_pwd=$(whiptail --inputbox "Please set the password the 'root' user will use to access the database." \ + 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_reget_db_pwd() { + db_pwd=$(whiptail --inputbox "Please set the password the 'birder' user will use to access the database." \ + 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_reget_caddy_pwd() { + caddy_pwd=$(whiptail --inputbox "Please set the password for the web interface." \ + 19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + + +do_reget_lon() { + lon="$(curl -s4 ifconfig.co/json | awk '/lon/ {print $2}' | tr -d ',')" + new_lon=$(whiptail --inputbox "Please set the longitude where recordings will take place." \ + 19 70 -- "$lon" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_reget_lat() { + lat="$(curl -s4 ifconfig.co/json | awk '/lat/ {print $2}' | tr -d ',')" + new_lat=$(whiptail --inputbox "Please set the latitude where recordings will take place." \ + 19 70 -- "$lat" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + +do_get_confidence() { + confidence="$(awk -F= '/CONFIDENCE=/ {print $2}' ${birdnetpi_dir}/birdnet.conf)" + new_confidence=$(whiptail --inputbox "Please set the minimum confidence score BirdNET-Lite should use." \ + 19 70 -- "$confidence" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + + +do_get_overlap() { + overlap="$(awk -F= '/OVERLAP=/ {print $2}' ${birdnetpi_dir}/birdnet.conf)" + new_overlap=$(whiptail --inputbox "Please set the overlap BirdNET-Lite should use." \ + 19 70 -- "$overlap" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + + +do_get_sensitivity() { + sensitivity="$(awk -F= '/SENSITIVITY=/ {print $2}' ${birdnetpi_dir}/birdnet.conf)" + new_sensitivity=$(whiptail --inputbox "Please set the simoid sensitivty BirdNET-Lite should use." \ + 19 70 -- "$sensitivity" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + if [ $? -eq 0 ];then + return 0 + ASK_TO_REBOOT=2 + else + return 1 + fi +} + do_get_birdnetlog_url() { birdnetlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetlog.pmcgui.xyz\"." \ 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh @@ -672,6 +801,31 @@ do_system_menu() { fi } +do_advanced_reconfig_menu() { + if is_pi ; then + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "BirdNET-Pi Configuration Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "Sensitivity" "Set the sigmoid sensitivity" \ + "Confidence" "Set the minimum confidence score required for a detection" \ + "Overlap" "Set the analysis overlap in seconds" \ + "BirdNET-Pi URLs" "Set the URLs your installation should use" \ + 3>&1 1>&2 2>&3) + else + exit + fi + RET=$? + if [ $RET -eq 1 ]; then + return 0 + elif [ $RET -eq 0 ]; then + case "$FUN" in + Sens*) do_get_sensitivity;; + Confi*) do_get_confidence;; + Overlap*) do_get_overlap;; + Bird*) do_reget_birdnetpi_url; do_reget_birdnetlog_url; do_reget_extractionlog_url;; + *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; + esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 + fi +} + do_advanced_config_menu() { if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "BirdNET-Pi Configuration Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ @@ -697,6 +851,28 @@ do_advanced_config_menu() { fi } +do_reget_db_pwds() { + if is_pi ; then + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Reset Datbase Passwords" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "'birder' " "Set the database password for the 'birder' user" \ + "'root' " "Set the database password for the 'root' user" \ + 3>&1 1>&2 2>&3) + else + exit + fi + RET=$? + if [ $RET -eq 1 ]; then + return 0 + elif [ $RET -eq 0 ]; then + case "$FUN" in + *bird*) do_reget_db_pwd;; + *root*) do_reget_db_root_pwd;; + *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; + esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 + fi +} + + do_get_db_pwds() { if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Set Datbase Passwords" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ @@ -718,6 +894,34 @@ do_get_db_pwds() { fi } +do_reconfig_birdnet_menu() { + if is_pi ; then + FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "BirdNET-Pi Re-configuration Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "Latitude " "Set the latitude your system should use" \ + "Longitude" "Set the longitude your system should use" \ + "Caddy Password" "Set the web interface password" \ + "Database Passwords" "Set the passwords the MariaDB will use" \ + "Advanced Settings" "Sensitivity, Overlap, Confidence, URLs" \ + 3>&1 1>&2 2>&3) + else + exit + fi + RET=$? + if [ $RET -eq 1 ]; then + return 0 + elif [ $RET -eq 0 ]; then + case "$FUN" in + Lat*) do_reget_lat;; + Lon*) do_reget_lon;; + Cad*) do_reget_caddy_pwd;; + Data*) do_reget_db_pwds;; + Advanced*) do_advanced_reconfig_menu;; + *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; + esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 + fi +} + + do_config_birdnet_menu() { if is_pi ; then FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "BirdNET-Pi Configuration Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ @@ -726,7 +930,7 @@ do_config_birdnet_menu() { "Caddy Password" "Set the web interface password" \ "IceCast2 Password" "Set the IceCast2 password" \ "Database Passwords" "Set the passwords the MariaDB will use" \ - "Advanced Settings" "Sensitivity, Overlap, Confidence, URLs" \ + "Set Custom URLS" "Designate custom URLs for the web services if you've set that up" \ 3>&1 1>&2 2>&3) else exit @@ -741,7 +945,7 @@ do_config_birdnet_menu() { Cad*) do_get_caddy_pwd;; Ice*) do_get_ice_pwd;; Data*) do_get_db_pwds;; - Advanced*) do_advanced_config_menu;; + Set*) do_get_birdnetpi_url; do_get_birdnetlog_url; do_get_extractionlog_url;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi @@ -799,6 +1003,7 @@ if [ "$INTERACTIVE" = True ]; then "Step 1" "Configure language" \ "Step 2" "Configure BirdNET-Pi before installation" \ "Step 3" "Install BirdNET-Pi" \ + "Reconfigure BirdNET-Pi" "Reconfigure BirdNET-Pi AFTER installation" \ "System Options" "Configure system settings" \ 3>&1 1>&2 2>&3) else @@ -812,6 +1017,7 @@ if [ "$INTERACTIVE" = True ]; then *1) do_internationalisation_menu ;; *2) do_config_birdnet_menu ;; *3) do_install_birdnet;; + Reconf*) do_reconfig_birdnet_menu ;; Sys*) do_system_menu ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 diff --git a/scripts/rewrite_config.sh b/scripts/rewrite_config.sh new file mode 100755 index 0000000..94b794c --- /dev/null +++ b/scripts/rewrite_config.sh @@ -0,0 +1,45 @@ +#!/usr/bin/bash +# Writes variables to config file +set -x +birdnetpi_dir=/home/pi/BirdNET-Pi +birdnet_conf=${birdnetpi_dir}/birdnet.conf + +if ! [ -z ${new_lat} ];then +sed -i s/'^LATITUDE=.*'/"LATITUDE=${new_lat}"/g ${birdnet_conf} +fi + +if ! [ -z ${new_lon} ];then +sed -i s/'^LONGITUDE=.*'/"LONGITUDE=${new_lon}"/g ${birdnet_conf} +fi + +if ! [ -z ${caddy_pwd} ];then +sed -i s/'^CADDY_PWD=.*'/"CADDY_PWD=${caddy_pwd}"/g ${birdnet_conf} +hash_pwd=$(caddy hash-password -plaintext ${caddy_pwd}) +sed -i s/'birdnet\ .*'/"birdnet ${hash_pwd}"/g /etc/caddy/Caddyfile +systemctl reload caddy +fi + +if ! [ -z ${db_pwd} ];then +sed -i s/'^DB_PWD=.*'/"DB_PWD=${db_pwd}"/g ${birdnet_conf} +sudo -upi ${birdnetpi_dir}/scripts/update_db_pwd.sh +fi + +if ! [ -z ${db_root_pwd} ];then + exit 1 #for now +sed -i s/'^DB_ROOT_PWD=.*'/"DB_ROOT_PWD=${db_root_pwd}"/g ${birdnet_conf} +fi + +if ! [ -z ${birdnetpi_url} ];then +sed -i s/'^BIRDNETPI_URL=.*'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birdnet_conf} +sed -i s/'^EXTRACTIONLOG_URL=.*'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf} +sed -i s/'^BIRDNETLOG_URL=.*'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf} +sudo -upi ${birdnetpi_dir}/scripts/update_birdnetpi.sh +fi + +if ! [ -z ${new_sensitivity} ];then +sed -i s/'^SENSITIVITY=.*'/"SENSITIVITY=${new_sensitivity}"/g ${birdnet_conf} +fi + +if ! [ -z ${new_confidence} ];then +sed -i s/'^CONFIDENCE=.*'/"CONFIDENCE=${new_confidence}"/g ${birdnet_conf} +fi From a255b4b369811596fe3e6de78c2e79f3385b4112 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 31 Oct 2021 10:48:35 -0400 Subject: [PATCH 45/91] consolidated URL screen --- scripts/birdnet-pi-config | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config index a473113..27e1260 100755 --- a/scripts/birdnet-pi-config +++ b/scripts/birdnet-pi-config @@ -473,31 +473,9 @@ do_wifi_ssid_passphrase() { return $RET } -do_reget_birdnetlog_url() { - birdnetlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetlog.pmcgui.xyz\"." \ - 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh - if [ $? -eq 0 ];then - return 0 - ASK_TO_REBOOT=2 - else - return 1 - fi -} - -do_reget_extractionlog_url() { - extractionlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://extractionlog.pmcgui.xyz\"." \ - 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh - if [ $? -eq 0 ];then - return 0 - ASK_TO_REBOOT=2 - else - return 1 - fi -} - -do_reget_birdnetpi_url() { +do_reget_birdnetpi_urls() { birdnetpi_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetpi.pmcgui.xyz\"." \ - 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh + 19 70 -- "https://" 3>&1 1>&2 2>&3) extractionlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://extractionlog.pmcgui.xyz\"." 19 70 -- "https://" 3>&1 1>&2 2>&3) birdnetlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetlog.pmcgui.xyz\"." 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/rewrite_config.sh if [ $? -eq 0 ];then return 0 ASK_TO_REBOOT=2 @@ -820,7 +798,7 @@ do_advanced_reconfig_menu() { Sens*) do_get_sensitivity;; Confi*) do_get_confidence;; Overlap*) do_get_overlap;; - Bird*) do_reget_birdnetpi_url; do_reget_birdnetlog_url; do_reget_extractionlog_url;; + Bird*) do_reget_birdnetpi_urls;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi From 81d38ea795ba664a65e6a059caa97c4ee69539e4 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 31 Oct 2021 10:49:36 -0400 Subject: [PATCH 46/91] typo --- scripts/rewrite_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/rewrite_config.sh b/scripts/rewrite_config.sh index 94b794c..e49cc15 100755 --- a/scripts/rewrite_config.sh +++ b/scripts/rewrite_config.sh @@ -33,7 +33,7 @@ if ! [ -z ${birdnetpi_url} ];then sed -i s/'^BIRDNETPI_URL=.*'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birdnet_conf} sed -i s/'^EXTRACTIONLOG_URL=.*'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf} sed -i s/'^BIRDNETLOG_URL=.*'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf} -sudo -upi ${birdnetpi_dir}/scripts/update_birdnetpi.sh +sudo -upi ${birdnetpi_dir}/scripts/update_birdnet.sh fi if ! [ -z ${new_sensitivity} ];then From 0a9aa3eda6cd0d1efd44075c4153f31e599dfccf Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 31 Oct 2021 11:43:54 -0400 Subject: [PATCH 47/91] adding customized phpsysinfo files --- templates/green_bootstrap.css | 228 ++++++++ templates/index_bootstrap.html | 493 ++++++++++++++++ templates/phpsysinfo.ini | 987 +++++++++++++++++++++++++++++++++ 3 files changed, 1708 insertions(+) create mode 100644 templates/green_bootstrap.css create mode 100644 templates/index_bootstrap.html create mode 100644 templates/phpsysinfo.ini diff --git a/templates/green_bootstrap.css b/templates/green_bootstrap.css new file mode 100644 index 0000000..d3214f2 --- /dev/null +++ b/templates/green_bootstrap.css @@ -0,0 +1,228 @@ +body { + font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; + font-size: 13px; + padding-top: 80px; + color: #333; + background-color: rgb(119, 196, 135); +} + +body::-webkit-scrollbar { + display:none; +} + +wbr { + display: inline-block; +} + +.table td.rightCell, .table th.rightCell { + text-align: right; +} + +.percent { + text-align: center; +} + +.card { + border-color: #f2f2f2; +} + +.navbar { + background-color: rgb(119, 196, 135); + border-color: #33b667; +} + +.navbar-brand, .navbar-brand:hover { + color: #fff; + margin-right: 0; +} + +.treegrid-span { + display: table-cell; +} + +.treegrid-spanbold { + font-weight: bold; + display: table-cell; +} + +.treegrid-indent { + width: 16px; + height: 16px; + display: table-cell; +} + +.treegrid-expander { + width: 0px; + height: 16px; + display: table-cell; + cursor: pointer; +} + +.normalicon { + width: 16px; + height: 16px; + position: relative; + top: 1px; + display: table-cell; + font-style: normal; + font-weight: normal; + line-height: 1; + + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +.normalicon-right:before { + content: "\25ba"; +} +.normalicon-down:before { + content: "\25bc"; +} + +table.sortable thead th { + cursor: pointer; + position: relative; + top: 0; + left: 0; +} + +table.sortable thead th:hover { + background-color: #ececec; +} + +.sorttable_nosort { + cursor: auto!important; +} + +.table-hover > tbody > tr:hover { + color: #333; + background-color: #ececec; +} + +.table-hover > tfoot > tr:hover { + background-color: #ececec; +} + +table.borderless td, table.borderless th, table.noborderattop tr:first-child td, table.noborderattop tr:first-child th { + border: none!important; +} + +.table { + color: #333; + background-color: #fff!important; + margin: 0; + border: 0; +} + +.logo { + cursor: pointer; + width: 32px; +} + +.select { + color: #333; +} + +select { + background-color: #fefefe; +} + +.template { + cursor: pointer; + color: #333; +} + +.language { + cursor: pointer; + color: #333; +} + +.card-header { + background-color: #33b770!important; + border-color: #33b770!important; + color: #fff!important; +} + +.progress { + margin-bottom: 0; + background-color: #f5f5f5; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); +} + +.progress-bar-success { + background-color: #5bc0de; +} + +.progress-bar-info { + background-color: #5cb85c; +} + +.progress-bar-warning { + background-color: #f0ad4e; +} + +.progress-bar-danger { + background-color: #d9534f; +} + +.modal-content { + background-color: #fff; +} + +.list-group { + display: block; +} + +.list-group-item { + background-color: #fff; +} + +.reload { + background-image: url("../gfx/reload.gif"); + float: right; + cursor: pointer; + width: 16px; + height: 16px; +} + +.container { + padding:0; +} + +.table thead th { + border-top: none; +} + +a, a:visited { + color: #000; +} + +a:hover { + text-decoration: underline; + color: #000; +} + +.psihref, .psihref:visited { + color: #fff; +} + +.psihref:hover { + text-decoration: underline; + color: #fff; +} + +.col-lg-6, .col-lg-12 { + padding-bottom: 20px; +} + +.badge{ + font-size: 12px; + border-radius: 10px; + padding: 3px 7px; + float: right; +} + +.table-nopadding > tbody > tr > td, +.table-nopadding > tbody > tr > th { + padding: 0; +} diff --git a/templates/index_bootstrap.html b/templates/index_bootstrap.html new file mode 100644 index 0000000..90b1b9c --- /dev/null +++ b/templates/index_bootstrap.html @@ -0,0 +1,493 @@ + + + + + + + + + + + phpSysInfo <?php echo PSI_VERSION_STRING ?> + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + diff --git a/templates/phpsysinfo.ini b/templates/phpsysinfo.ini new file mode 100644 index 0000000..854987c --- /dev/null +++ b/templates/phpsysinfo.ini @@ -0,0 +1,987 @@ +; PSI Config File +; +; @category PHP +; @package PSI +; @author Michael Cramer +; @copyright 2009 phpSysInfo +; @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version +; @version SVN: $Id: phpsysinfo.ini.new 705 2012-11-11 00:33:29Z namiltd $ +; @link http://phpsysinfo.sourceforge.net + +[main] +; ******************************** +; MAIN PARAMETERS +; ******************************** + +; Turn on debugging of some functions and include errors and warnings in xml and provide a popup for displaying errors +; - false : no debug information are stored in xml or displayed +; - true : debug information stored in xml and displayed *be careful if set this to true, may include sensitive information from your pc* +; +DEBUG=false + +; Turn on logging/unlogging of functions executeProgram() and rfts() +; example : executeProgram () and rfts () record the results to the "/tmp/phpsysinfo.log" file +; LOG="/tmp/phpsysinfo.log" +; example : executeProgram () and rfts () read the results from the "/tmp/phpsysinfo.log" file +; LOG="-/tmp/phpsysinfo.log" +; example : executeProgram () and rfts () read the results from the "/tmp/phpsysinfo.log" file +; LOG="+/tmp/phpsysinfo.log", if lack in the log file it runs normally +; +LOG=false + +; Turn on/off compression for JavaScript file +; - JS_COMPRESSION=false //no compression (recommended with slow processor) +; - JS_COMPRESSION="None" //code minimizing +; - JS_COMPRESSION="Normal" //code packing +; +JS_COMPRESSION="Normal" + +; Additional paths where to look for installed programs +; Example : ADD_PATHS="/opt/bin,/opt/sbin" +; +ADD_PATHS=false + +; List of IP addresses of clients authorized to run +; Example : ALLOWED="127.0.0.1,192.168.1.48" //allowed IP 127.0.0.1 and 192.168.1.48 +; ALLOWED=false //no IP checking +; +ALLOWED=false + +; List of sudo commands +; Example : SUDO_COMMANDS="iptables-save" //execute "sudo iptables-save" instead "iptables-save" +; SUDO_COMMANDS=false //no sudo commands +; +SUDO_COMMANDS=false + +; Order of data blocks +; Example : BLOCKS="vitals,hardware,memory,filesystem,network,voltage,current,temperature,fans,power,other,ups" or BLOCKS=true //default order +; BLOCKS=false //hide all blocks +; +BLOCKS=true + +; Maximum time in seconds a script is allowed to run before it is terminated by the parser +; +;MAX_TIMEOUT=30 + +; executeProgram() timeout value in seconds +; +;EXEC_TIMEOUT=30 + +; snmprealwalk() and executeProgram("snmpwalk") number of seconds until the first timeout +; +;SNMP_TIMEOUT=3 + +; snmprealwalk() and executeProgram("snmpwalk") number of times to retry if timeouts occur +; +;SNMP_RETRY=0 + +; External WinNT server connection parameters +; Possibility available for WinNT and partly for LINUX (if wmic tool from wmic-linux or openvas-smb package is installed) +; These settings can also be entered for a specific plug-in so that only it connects to an external server +; For safety reasons make sure that phpsysinfo.ini cannot be read by the network or other users! +; +;WMI_HOSTNAME="hostname" +;WMI_USER="username" +;WMI_PASSWORD="password" + + +; Plugins that should be included in xml and output +; List of plugins should look like "plugin,plugin,plugin". See /plugins directory +; - PLUGINS="Raid,PS" //list of plugins +; - PLUGINS=false //no plugins +; included plugins: +; - Raid - show the software, fake, zpool or megaraid RAID status +; - PS - show a process tree of all running processes +; - PSStatus - show a graphical representation if a process is running or not +; - Quotas - show a table with all quotas that are active and there current state +; - SMART - show S.M.A.R.T. information from drives that support it +; - BAT - show battery state on a laptop, tablet or phone +; - UpdateNotifier - show update notifications (only for Ubuntu server) +; - SNMPPInfo - show printers info via SNMP +; - Uprecords - show uprecords info +; - PingTest - show Ping Test info +; - StableBit - show StableBit Scanner info (WinNT) +; - HyperV - show Hyper-V info (WinNT) +; - Docker - show docker stats +; - Viewer - show output of any command or file viewer.tmp contents +; +PLUGINS=false + + +; ******************************** +; DISPLAY PARAMETERS +; ******************************** + + +; Define the default display mode +; auto: let user browser choose the mode +; dynamic: use javascript to refresh data +; static: static page (use metatag to reload page) +; bootstrap: use twitter bootstrap template +; +DEFAULT_DISPLAY_MODE="auto" + + +; Define the default language +; +DEFAULT_LANG="en" + + +; Define the default template +; +DEFAULT_TEMPLATE="phpsysinfo" + + +; Define the default template for frontend "bootstrap" +; +DEFAULT_BOOTSTRAP_TEMPLATE="phpsysinfo" + + +; Show or hide language picklist +; +SHOW_PICKLIST_LANG=true + + +; Show or hide template picklist +; +SHOW_PICKLIST_TEMPLATE=true + + +; Show CPU list expanded +; +SHOW_CPULIST_EXPANDED=true + + +; Show CPU info expanded +; +SHOW_CPUINFO_EXPANDED=false + + +; Show memory infos expanded +; +SHOW_MEMORY_INFOS_EXPANDED=false + + +; Show virtualizer info for Linux, Android and WinNT +; +SHOW_VIRTUALIZER_INFO=true + + +; Hide loader for frontend "bootstrap" +; +HIDE_BOOTSTRAP_LOADER=false + + +; Increase the body width for the "dynamic" frontend by pixels. The value should be even +; - 0 : disabled +; - 200 : wider by 200px +; Default is 0 pixels +; +INCREASE_WIDTH=0 + + +; Define the interval for refreshing data in ms +; - 0 : disabled +; - 1000 : 1 second +; Default is 60 seconds +; +REFRESH=60000 + + +; Show a graph for current cpuload +; - true : displayed, but it's a performance hit (because we have to wait to get a value, 1 second) +; - "compact" : displayed like above but in compact mode +; - false : will not be displayed (also in Load Averages field) +; +LOAD_BAR="compact" + + +; Display the virtual host name and address +; - Default is canonical host name and address +; - Use USE_VHOST=true to display virtual host name. +; +USE_VHOST=false + + +; Controls the units & format for network, memory and filesystem +; - 1 KiB = 2^10 bytes = 1,024 bytes +; - 1 KB = 10^3 bytes = 1,000 bytes +; - "B" everything is in Byte +; - "PiB" everything is in PeBiByte +; - "TiB" everything is in TeBiByte +; - "GiB" everything is in GiBiByte +; - "MiB" everything is in MeBiByte +; - "KiB" everything is in KiBiByte +; - "auto_binary" everything is automatic done if value is to big for, e.g MiB then it will be in GiB +; - "PB" everything is in PetaByte +; - "TB" everything is in TeraByte +; - "GB" everything is in GigaByte +; - "MB" everything is in MegaByte +; - "KB" everything is in KiloByte +; - "auto_decimal" everything is automatic done if value is to big for, e.g MB then it will be in GB +; +BYTE_FORMAT="auto_binary" + + +; Format in which temperature is displayed +; - "c" shown in celsius +; - "f" shown in fahrenheit +; - "c-f" both shown first celsius and fahrenheit in braces +; - "f-c" both shown first fahrenheit and celsius in braces +; +TEMP_FORMAT="c" + + +; Show devices infos +; Example : SHOW_DEVICES_INFOS=true +; +SHOW_DEVICES_INFOS=true + + +; Show devices serial number +; Example : SHOW_DEVICES_SERIAL=true +; +SHOW_DEVICES_SERIAL=false + + +; Format in which datetime is displayed +; - "UTC" shown as UTC string +; - "locale" shown as Locale string +; +DATETIME_FORMAT="UTC" + + +; ******************************** +; SENSORS PARAMETERS +; ******************************** + + +; Define the motherboard monitoring program +; We support the following programs so far +; - HDDtemp http://www.guzu.net/linux/hddtemp.php (Linux) +; - LMSensors http://www.lm-sensors.org/ (Linux) +; - Healthd http://healthd.thehousleys.net/ (FreeBSD) +; - HWSensors http://www.openbsd.org/ (OpenBSD) +; - MBMon http://www.nt.phys.kyushu-u.ac.jp/shimizu/download/download.html (FreeBSD/Linux/NetBSD/OpenBSD) +; - MBM5 http://mbm.livewiredev.com/ (data from file data/MBM5.csv - WinNT) +; - CpuMem No addon tool neded (FreeBSD/Linux/WinNT or others but with the dmidecode utility installed) +; - IPMItool http://ipmitool.sourceforge.net/ (Linux) +; - FreeIPMI http://www.gnu.org/software/freeipmi/ (FreeBSD/Linux/OpenBSD/SunOS) +; - IPMIutil http://ipmiutil.sourceforge.net/ (Darwin/FreeBSD/Linux/SunOS/WinNT) +; - IPMIcfg http://www.supermicro.com/en/solutions/management-software/ipmi-utilities (Linux/WinNT) +; - K8Temp http://hur.st/k8temp/ (DragonFly/FreeBSD/NetBSD/OpenBSD) +; - PiTemp No addon tool neded (Raspberry Pi and Banana Pi - Linux) +; - OHM http://openhardwaremonitor.org/ (WinNT) +; - ThermalZone No addon tool neded (WinNT/Linux/Android) +; - QTSsnmp SNMP service enabled and snmp-utils package installed: opkg install snmp-utils (QNAP - QTS Linux) +; - Hwmon No addon tool neded (Linux) +; - SpeedFan http://www.almico.com/speedfan.php (required tool packaged in: tools/speedfan/SpeedFanGet_bin.zip) (WinNT) +; - Thinkpad No addon tool neded (Lenovo Thinkpad - Linux) +; - NvidiaSMI Nvidia GPU drivers (FreeBSD/Linux/SunOS/WinNT) +; +; Example: If you want to use lmsensors : SENSOR_PROGRAM="LMSensors" +; If you want to use lmsensors and IPMItool: SENSOR_PROGRAM="LMSensors,IPMItool" +; +SENSOR_PROGRAM=false + + +; Show events of sensors +; - true : show events +; - false : do not show events +; +SENSOR_EVENTS=true + + +; Sort sensors list +; +SORT_SENSORS_LIST=false + + +; Some sensors programs contain an additional configuration in the relevant sections [sensor_...] + + +; ******************************** +; FILESYSTEM PARAMETERS +; ******************************** + + +; Show mount point +; - true : show mount point +; - false : do not show mount point +; +SHOW_MOUNT_POINT=true + + +; Show mount option +; - true : show mount option +; - false : do not show mount option +; +SHOW_MOUNT_OPTION=true + + +; Show mount credentials +; - true : show mount credentials +; - false : do not show mount credentials +; +SHOW_MOUNT_CREDENTIALS=false + + +; Show inode usage +; - true : display used inodes in percent +; - false : hide them +; +SHOW_INODES=true + + +; Hide mounts +; Example : HIDE_MOUNTS="/home,/usr" +; +HIDE_MOUNTS="" + + +; Filesystem usage warning threshold in percent +; - 0 : disabled +; - 90 : 90% +; Default is 90% +; +FS_USAGE_THRESHOLD=90 + + +; Ignore usage and usage threshold for filesystem types +; Example : IGNORE_THRESHOLD_FS_TYPES="packagefs, iso9660, squashfs, devfs, devtmpfs, tmpfs, lxfs, udf, UDF, CDFS" +; +IGNORE_THRESHOLD_FS_TYPES="packagefs, iso9660, squashfs, devfs, devtmpfs, tmpfs, lxfs, udf, UDF, CDFS" + + +; Ignore usage of mounts +; Example : IGNORE_USAGE="/root,/mnt/c" +; +IGNORE_USAGE="" + + +; Ignore total size of mounts +; Example : IGNORE_TOTAL="/System/Volumes/VM,/System/Volumes/Prebot" +; +IGNORE_TOTAL="" + + +; Ignore free space size of mounts +; Example : IGNORE_FREE="/zfs/space,/zfs/data" +; +IGNORE_FREE="" + + +; Hide filesystem types +; Example : HIDE_FS_TYPES="tmpfs,devtmpfs,usbfs,bstfolder" +; +HIDE_FS_TYPES="" + + +; Hide partitions +; Example : HIDE_DISKS="rootfs,/dev/sda1" +; HIDE_DISKS=true //hide all partitions +; +HIDE_DISKS="" + + +; Hide totals information +; +HIDE_TOTALS=false + + +; ******************************** +; NETWORK PARAMETERS +; ******************************** + + +; Hide network interfaces +; Example : HIDE_NETWORK_INTERFACE="eth0,sit0" +; HIDE_NETWORK_INTERFACE=true //hide all network interfaces +; +HIDE_NETWORK_INTERFACE="" + + +; Use a regular expression in the name of a hidden network interface (e.g. HIDE_NETWORK_INTERFACE="docker.*") +; - true : use a regular expression +; - false : do not use a regular expression +; +HIDE_NETWORK_INTERFACE_REGEX=false + + +; Show network interfaces infos for Linux, Android, FreeBSD, NetBSD, OpenBSD, Haiku, Darwin, SunOS, Minix, QNX and WinNT +; Example : SHOW_NETWORK_INFOS=true +; +SHOW_NETWORK_INFOS=true + + +; Hide MAC address in the infos +; +HIDE_NETWORK_MACADDR=false + + +; Sort network interfaces list +; +SORT_NETWORK_INTERFACES_LIST=false + + +; Show network infos expanded +; +SHOW_NETWORK_INFOS_EXPANDED=false + + +; Show network active speed +; - true : display network active speed +; - "bps" : display network active speed in bits per second (b/s, Kb/s, etc...) +; - false : hide them +; +SHOW_NETWORK_ACTIVE_SPEED=false + + +; ******************************** +; UPS PARAMETERS +; ******************************** + + +; Define the ups monitoring program +; We support the following programs so far +; - Apcupsd http://www.apcupsd.com/ +; - Nut http://www.networkupstools.org/ +; - SNMPups monitoring via Simple Network Management Protocol (SNMP) +; - PowerSoftPlus http://ever.eu/ +; - pmset based on the result of the command "pmset -g batt" on Darwin system +; +; Example: If you want to use Apcupsd : UPS_PROGRAM="Apcupsd" +; If you want to use Apcupsd and Nut : UPS_PROGRAM="Apcupsd,Nut" +; +UPS_PROGRAM=false + + +; Apcupsd supports multiple UPSes +; You can specify comma delimited list in the form : or :. The defaults are: "127.0.0.1:3551" +; See the following parameters in apcupsd.conf: NETSERVER, NISIP, NISPORT +; It uses the defaults if not specified. +; +UPS_APCUPSD_LIST=false + + +; define how to access the Apcupsd data +; - "command" execute apcaccess command +; - "data" for reading data from file data/upsapcupsd{ups_number}.tmp +; content is the output from "apcaccess status" +; +UPS_APCUPSD_ACCESS="command" + + +; Apcupsd has a CGI monitoring utility called apcupsd-cgi +; You can set the parameter below to true if you have it installed - this will add apcupsd-cgi links to the UPS tree +; +UPS_APCUPSD_CGI_ENABLE=false + + +; Nut supports multiple UPSes +; You can specify comma delimited list in the form : or :. The defaults are: "127.0.0.1:3493" +; See the following parameters in upsd.conf: LISTEN +; It uses the defaults if not specified. +; +UPS_NUT_LIST=false + + +; define how to access the Nut data +; - "command" execute upsc command +; - "data" for reading data from file data/upsnut{ups_number}.tmp +; content is the output from "upsc {upsname}" +; +UPS_NUT_ACCESS="command" + + +; SNMPups supports multiple UPSes +; You can specify comma delimited list in the form : or :. The default port is 161 +; List must be specified. +; +UPS_SNMPUPS_LIST=false + + +; define how to access the SNMP data +; - "php-snmp" execute php snmprealwalk function (php-snmp module must be installed) +; - "command" execute snmpwalk command +; - "data" for reading data from file data/upssnmpups{ups_number}.tmp +; content is the output from: +; "snmpwalk -Ona -c public -v 1 -r 0 -t 3 {upsaddress} .1.3.6.1.4.1.318.1.1.1.1>upssnmpups{ups_number}.tmp +; snmpwalk -Ona -c public -v 1 -r 0 -t 3 {upsaddress} .1.3.6.1.4.1.318.1.1.1.2>>upssnmpups{ups_number}.tmp +; snmpwalk -Ona -c public -v 1 -r 0 -t 3 {upsaddress} .1.3.6.1.4.1.318.1.1.1.3>>upssnmpups{ups_number}.tmp +; snmpwalk -Ona -c public -v 1 -r 0 -t 3 {upsaddress} .1.3.6.1.4.1.318.1.1.1.4>>upssnmpups{ups_number}.tmp" +; +UPS_SNMPUPS_ACCESS="php-snmp" + + +; define how to access the PowerSoftPlus data +; - "command" execute powersoftplus command +; - "data" for reading data from file data/upspowersoftplus.tmp +; content is the output from "powersoftplus -p" +; +UPS_POWERSOFTPLUS_ACCESS="command" + + +; define how to access the pmset data +; - "command" execute pmset command +; - "data" for reading data from file data/upspmset.tmp +; content is the output from "pmset -g batt" +; +UPS_PMSET_ACCESS="command" + + +; ******************************** +; MISC PARAMETERS +; ******************************** + + +; define how to access the dmidecode data +; - "data" read data from file data/dmidecode.tmp; content is the output from "dmidecode -t 17") +; - "command" execute command: dmidecode -t 17 +; If access error try execute first: chmod 4755 /usr/sbin/dmidecode +; This method is not recommended for safety reasons! +; +DMIDECODE_ACCESS="command" + + +; ******************************** +; SENSORS PROGRAMS PARAMETERS +; ******************************** + + +[sensor_hddtemp] +; Hddtemp motherboard monitoring program configuration +; +; If the hddtemp program is available we can read the temperature, if hdd is smart capable +; !!ATTENTION!! hddtemp might be a security issue +; - ACCESS="command" //read data from 'hddtemp' command (must be set suid) +; - ACCESS="tcp" //read data from hddtemp deamon (localhost:7634) +; +ACCESS="command" + +[sensor_lmsensors] +; LMSensors motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'sensors' command +; - ACCESS="data" //read data from file data/lmsensors.tmp +; +ACCESS="command" + +[sensor_healthd] +; Healthd motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'healthdc' command +; - ACCESS="data" //read data from file data/healthd.tmp +; +ACCESS="command" + +[sensor_mbmon] +; MBMon motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'mbmon -c 1 -r' command +; - ACCESS="data" //read data from file data/mbmon.tmp +; - ACCESS="tcp" //read data from mbmon deamon (localhost:411) +; +ACCESS="command" + +[sensor_ipmitool] +; IPMItool motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'ipmitool sensor -v' command +; //if access error execute first: chmod 666 /dev/ipmi0 +; - ACCESS="data" //read data from file data/ipmitool.tmp +; +ACCESS="command" + +[sensor_freeipmi] +; FreeIPMI motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'ipmi-sensors --output-sensor-thresholds' program +; - ACCESS="data" //read data from file data/freeipmi.tmp +; +ACCESS="command" + +[sensor_ipmiutil] +; IPMIutil motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'ipmiutil sensor -stw' command +; //if access error execute first: chmod 666 /dev/ipmi0 +; - ACCESS="data" //read data from file data/ipmiutil.tmp +; +ACCESS="command" + +[sensor_ipmicfg] +; IPMIcfg motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'ipmicfg -sdr' and/or 'ipmicfg -psfruinfo' command +; - ACCESS="data" //read data from file data/ipmicfg.tmp (output from: "ipmicfg -sdr>ipmicfg.tmp; ipmicfg -psfruinfo>>ipmicfg.tmp") +; +ACCESS="command" + +; Execute power supply FRU health info +; - true : execute 'ipmicfg --psfruinfo' +; - false : don't execute 'ipmicfg --psfruinfo' +; - "only" : execute 'ipmicfg --psfruinfo' and don't execute 'ipmicfg -sdr' +; +PSFRUINFO=true + +[sensor_k8temp] +; K8Temp motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'k8temp' command +; - ACCESS="data" //read data from file data/k8temp.tmp +; +ACCESS="command" + +[sensor_thermalzone] +; ThermalZone motherboard monitoring program configuration +; +; - ACCESS="command" //on Linux information is retrieved everytime through system files / on WinNT information is retrieved everytime through WMI +; - ACCESS="data" //read data from file data/thermalzone.tmp (output of WinNT command "wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CriticalTripPoint,CurrentTemperature,InstanceName") +; +ACCESS="command" + +[sensor_speedfan] +; SpeedFan motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'speedfanget' command +; - ACCESS="data" //read data from file data/speedfan.tmp +; +ACCESS="command" + +[sensor_nvidiasmi] +; NvidiaSMI motherboard monitoring program configuration +; +; - ACCESS="command" //read data from 'nvidia-smi -q' command +; - ACCESS="data" //read data from file data/nvidiasmi.tmp +; +ACCESS="command" + +;The path to nvidia-smi.exe for the WinNT system +; +EXE_PATH="c:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi.exe" + + +; ******************************** +; PLUGINS PARAMETERS +; ******************************** + + +[bat] +; BAT Plugin configuration + +; define how to access the battery statistic data +; - "command" on Linux and Android read data from /proc/acpi/battery/BAT0/info and /proc/acpi/battery/BAT0/state +; or on newer kernel from /sys/class/power_supply/ +; or from 'upower -d' command (if UPOWER is true) +; on Android read data from /sys/class/power_supply/ +; on Darwin read data from 'ioreg -w0 -l -n AppleSmartBattery -r' command +; on FreeBSD read data from 'acpiconf -i batt' command +; on OpenBSD read data from 'sysctl hw.sensors.acpibat0' command +; - "data" (a file must be available in the data directory of the phpsysinfo installation +; with the filename "bat_info.tmp" and "bat_state.tmp"; content is the output +; from "cat /proc/acpi/battery/BAT0/info" and "cat /proc/acpi/battery/BAT0/state") +; +ACCESS="command" + +; on Lunux try executing 'upower -d' command +; +UPOWER=false + +; Show battery serial number +; +SHOW_SERIAL=false + + +[raid] +; Raid Plugin configuration + +; define how to access the raid statistic data +; - "command" - mdstat: file "/proc/mdstat" is read (on Linux only) +; - dmraid: command "dmraid -s -vv 2>&1" is run (on Linux only) +; If access error try execute first: chmod 4755 /sbin/dmraid +; This method is not recommended for safety reasons! +; - megactl: command "megactl" (on Linux only) +; downloaded from http://sourceforge.net/projects/megactl/ or http://github.com/hmage/megactl +; If permission error try execute first: chmod 4755 /usr/sbin/megactl +; - megasasctl: command "megasasctl" (on Linux only) +; downloaded from http://sourceforge.net/projects/megactl/ or http://github.com/hmage/megactl +; If permission error try execute first: chmod 4755 /usr/sbin/megasasctl +; - megaclisas-status: command "megaclisas-status" (or "megaclisas-status.py" on WinNT) +; downloaded from http://hwraid.le-vert.net or https://github.com/eLvErDe/hwraid (Python 2) or https://github.com/ElCoyote27/hwraid (Python 3) +; - 3ware-status: command "3ware-status" (or 3ware-status.py" on WinNT) +; downloaded from http://hwraid.le-vert.net or https://github.com/eLvErDe/hwraid or https://github.com/ElCoyote27/hwraid +; - graid: command "graid list" is run (on FreeBSD only) +; - zpool: command "zpool status" is run +; - idrac: command "snmpwalk -Ona -c public -v 1 -r 0 -t 3 {device} .1.3.6.1.4.1.674.10892.5.5.1.20" is run +; - "php-snmp"- idrac: execute php snmprealwalk function (php-snmp module must be installed) +; - for others the option is inactive (uses "command" instead) +; - "data" (a file must be available in the data directory of the phpsysinfo installation +; with the filename "raidmdstat.tmp" or "raiddmraid.tmp" or "raidmegactl.tmp" or "raidmegasasctl.tmp" +; or "raidmegaclisas-status.tmp" or "raidgraid.tmp" or "raidzpool.tmp" or "raididrac{device_number}.tmp") +; +ACCESS="command" + +; define possible programs +PROGRAM="mdstat,dmraid,megactl,megasasctl,megaclisas-status,3ware-status,graid,zpool,idrac" + +; Hide RAID devices +; Example : HIDE_DEVICES="md127" +; +HIDE_DEVICES="" + +; +; string contains a list of IDRAC devices that are checked +; Example : IDRAC_DEVICES="192.168.0.120" +; +IDRAC_DEVICES="" + +[ps] +; PS Plugin configuration + +; define how to access the ps statistic data +; - "command" ps command is run everytime the block gets refreshed or build / on WinNT +; information is retrieved everytime through WMI +; - "data" (a file must be available in the data directory of the phpsysinfo installation +; with the filename "ps.tmp"; content is the output from "ps -axo pid,ppid,pmem,pcpu,args") +; +ACCESS="command" + +; Memory Usage info +; +MEMORY_USAGE=true + +; CPU Usage info +; +CPU_USAGE=true + +; Show kthreadd child list expanded +; +SHOW_KTHREADD_EXPANDED=false + +; Show PID 1 child list expanded +; +SHOW_PID1CHILD_EXPANDED=false + + +[psstatus] +; PSStatus Plugin configuration + +; define how to access the psstatus statistic data +; - "command" pidof command is run everytime the block gets refreshed or build +; / on WinNT information is retrieved everytime through WMI +; - "data" a file must be available in the data directory of the phpsysinfo installation +; with the filename "psstatus.tmp"; content is the output from +; for ps in "apache2" "mysqld" "sshd"; do echo $ps "|" `pidof -s -x "$ps"`; done +; +ACCESS="command" + +; Regular expression search in the process name (e.g. "ddclient.*") for non-WinNT systems +; - true : Regular expression search (used pgrep command) +; - false : Normal search (used pidof command) +; +USE_REGEX=false + +; controls which processes are checked if they are running +; +; string contains a list of process names that are checked, names are seperated by a comma (on WinNT names must end with '.exe') +; +PROCESSES="mysqld, sshd, explorer.exe" + + +[quotas] +; Quotas Plugin configuration + +; define how to access the repquota statistic data +; - "command" repquota command is run everytime the block gets refreshed or build +; - "data" (a file must be available in the data directory of the phpsysinfo installation with the filename "quotas.tmp"; content is the output from "repquota -au") +; +ACCESS="command" + + +[smart] +; SMART Plugin configuration + +; Smartctl program +; If the smartctl program is available we can read S.M.A.R.T informations +; - "command" smartctl command is run everytime the block gets refreshed or build +; if error: Smartctl open device: /dev/sda failed: Permission denied +; Not recommended method: +; execute: chmod 4755 /usr/sbin/smartctl +; Second method: +; try to set: SUDO_COMMANDS="smartctl" and add to file /etc/sudoers line: apache ALL = (ALL) NOPASSWD: /usr/sbin/smartctl +; - "data" (a file must be available in the data directory of the +; phpsysinfo installation with the filename "smart{disk_number}.tmp"; +; content is the output from "smartctl --all device" +; or on WinNT only from "wmic /namespace:\\root\wmi path MSStorageDriver_ATAPISmartData get VendorSpecific | more +{disk_number}") +; - "wmi" information is retrieved everytime through WMI (WinNT only) +; +ACCESS="command" + +; Smartctl devices to monitor +; If the smartctl support is enabled, those disks information will be displayed +; - DEVICES="/dev/hda,/dev/hdb" //Will display those two disks informations +; You also can specify --device option value for smartctl command surrounded by parentheses eg: +; - DEVICES="(marvell)/dev/sda" +; or +; - DEVICES="(megaraid.0)/dev/sda" //comma in --device option value is replaced by a dot +; +DEVICES="/dev/sda, /dev/sdb" + +; Smartctl ID# and column name from "Vendor Specific SMART Attributes with Thresholds" table +; If the smartctl support is enabled, enter the ID#-COLUMN_NAME from "Vendor Specific SMART Attributes with Thresholds" table from smartctl output. +; or for no SCSI devices: ID#-COLUMN_NAME-REPLACEMENT_ID# where REPLACEMENT_ID# is an alternative ID number. +; COLUMN_NAME of this ID# will be displayed in the phpsysinfo S.M.A.R.T table. If you want RAW_VALUE to be displayed for the temperature (ID# 194) enter 194-RAW_VALUE +; - IDS="194-VALUE,4-VALUE,009-RAW_VALUE" //ID#-COLUMN_NAME, ID#-COLUMN_NAME, etc... +; The additional attributes: +; ATA Error Count is marked as 0-RAW_VALUE +; Non-medium Error Count is marked as 255-RAW_VALUE +; +IDS="005-RAW_VALUE,194-RAW_VALUE,009-RAW_VALUE,012-RAW_VALUE,193-RAW_VALUE-225,001-RAW_VALUE,007-RAW_VALUE,200-RAW_VALUE,197-RAW_VALUE,198-RAW_VALUE,0-RAW_VALUE" + + +[snmppinfo] +; SNMPPInfo Plugin configuration + +; define how to access the SNMP Printer Info statistic data +; - "php-snmp" execute php snmprealwalk function (php-snmp module must be installed) +; - "command" execute snmpwalk command +; - "data" a file must be available in the data directory of the +; phpsysinfo installation with the filename "snmppinfo{printer_number}.tmp"; +; content is the output from: +; LANG=C LC_ALL=C snmpwalk -On -c public -v 1 -r 0 -t 3 {printer_address} .1.3.6.1.2.1.1.5 > snmppinfo{printer_number}.tmp +; LANG=C LC_ALL=C snmpwalk -On -c public -v 1 -r 0 -t 3 {printer_address} .1.3.6.1.4.1.367.3.2.1.2.24.1.1 >> snmppinfo{printer_number}.tmp +; LANG=C LC_ALL=C snmpwalk -On -c public -v 1 -r 0 -t 3 {printer_address} .1.3.6.1.2.1.43.11.1.1 >> snmppinfo{printer_number}.tmp +; LANG=C LC_ALL=C snmpwalk -On -c public -v 1 -r 0 -t 3 {printer_address} .1.3.6.1.2.1.43.18.1.1 >> snmppinfo{printer_number}.tmp +; +ACCESS="php-snmp" + +;define the Printer devices +; +; string contains a list of printer addresses that are checked +; +DEVICES="192.168.0.5, 192.168.0.9" + + +[updatenotifier] +; Update Notifier Plugin configuration + +; define how to access the updatenotifier statistic data +; - "command" execute command /usr/lib/update-notifier/apt-check +; - "data" reads data from file defined in FILE parameter +; +ACCESS="data" + +; define the update info file format +; - true: Ubuntu Landscape format (file: /var/lib/update-notifier/updates-available) +; - false: universal format (format: A;B) +; A: total packages to update +; B: security packages to update +; +UBUNTU_LANDSCAPE_FORMAT=true + +; define the update info file. The default is: /var/lib/update-notifier/updates-available +; +FILE="/var/lib/update-notifier/updates-available" + + +[uprecords] +; Uprecords Plugin configuration + +; define how to access the uprecords statistic data +; - "command" uprecords command is run everytime the block gets refreshed or build +; if access error try execute first: chmod 4755 /usr/bin/uprecords +; This method is not recommended for safety reasons! +; - "data" (a file must be available in the data directory of the phpsysinfo installation +; with the filename "uprecords.tmp"; content is the output from "TZ=GMT uprecords -a -w") +; +ACCESS="command" + +; define the maximum number of entries to show (for command access) +; default is 10 +; +MAX_ENTRIES = 10 + +; define the short mode (do not print extra statistics) +; default is false +; +SHORT_MODE = false + +; denote current system session by asterisk (* at the end) instead by the arrow (-> at the beginning) +; default is false +; +DENOTE_BY_ASTERISK = false + + +[viewer] +; Viewer Plugin configuration + +; define how to access the data +; - "command" COMMAND command is run everytime the block gets refreshed or build +; - "data" (a file must be available in the data directory of the phpsysinfo installation with the filename "viewer.tmp") +; +ACCESS="command" + +; define COMMAND name (for command access) +; eg: +; - "iptables-save" iptables-save command is run everytime the block gets refreshed or build (Linux) +; if access error try to set: SUDO_COMMANDS="iptables-save" and add to file /etc/sudoers line: apache ALL = (ALL) NOPASSWD: /sbin/iptables-save +; - "systeminfo" systeminfo command is run everytime the block gets refreshed or build (WinNT) +; + +COMMAND="" + +; define COMMAND parameters (for command access) +; +PARAMS="" + +[pingtest] +; PingTest Plugin configuration + +; define how to access the psstatus statistic data +; - "command" ping command is run everytime the block gets refreshed or build +; - "data" (a file must be available in the data directory of the phpsysinfo installation +; with the filename "pingtest.tmp") +; +ACCESS="command" + +;define the Addresses +; +; string contains a list of addresses that are checked +; Example : ADDRESSES="127.0.0.1,8.8.8.8" +; +ADDRESSES="" + +; Define ping timeout in seconds +; - 0 : default ping command timeout +; - 3 : 3 seconds +; Default is 2 seconds +; +TIMEOUT=2 + +[stablebit] +; StableBit Plugin configuration + +; Show or hide disks serial number +; +SHOW_SERIAL=false + +[hyperv] +; HyperV Plugin configuration + +; define how to access the ps statistic data +; - "command" information is retrieved through WMI +; - "data" (a file must be available in the data directory of the phpsysinfo installation +; with the filename "hyperv.tmp") +; +ACCESS="command" + +[docker] +; Docker Plugin configuration + +; define how to access the docker statistic data +; - "command" docker command is run everytime the block gets refreshed or build +; - "data" (a file must be available in the data directory of the phpsysinfo installation +; with the filename "docker.tmp"; content is the output from "docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}'") +; +ACCESS="command" From 00977577152cd8322b8e470244c626cf27764fd4 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 31 Oct 2021 11:50:13 -0400 Subject: [PATCH 48/91] testing new php configuration in installer --- scripts/install_services.sh | 6 +++++- scripts/update_services.sh | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/install_services.sh b/scripts/install_services.sh index b73ffed..1d8150a 100755 --- a/scripts/install_services.sh +++ b/scripts/install_services.sh @@ -132,7 +132,11 @@ create_necessary_dirs() { sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/spectrogram.php ${EXTRACTED} sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/viewdb.php ${EXTRACTED} sudo -u ${USER} ln -fs ${HOME}/phpsysinfo ${EXTRACTED} - [ -L ${EXTRACTED}/phpsysinfo/phpsysinfo.ini ] || sudo -u ${USER} cp ${HOME}/phpsysinfo/phpsysinfo.ini.new ${HOME}/phpsysinfo/phpsysinfo.ini + sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phpsysinfo/ + sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/ + sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html + + } install_alsa() { diff --git a/scripts/update_services.sh b/scripts/update_services.sh index e05c1f8..cf66264 100755 --- a/scripts/update_services.sh +++ b/scripts/update_services.sh @@ -134,7 +134,10 @@ create_necessary_dirs() { sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/spectrogram.php ${EXTRACTED} sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/viewdb.php ${EXTRACTED} sudo -u ${USER} ln -fs ${HOME}/phpsysinfo ${EXTRACTED} - [ -L ${EXTRACTED}/phpsysinfo/phpsysinfo.ini ] || sudo -u ${USER} cp ${HOME}/phpsysinfo/phpsysinfo.ini.new ${HOME}/phpsysinfo/phpsysinfo.ini + sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phpsysinfo/ + sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/ + sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html + } install_alsa() { From 86803c02d9d9b55338c3426bd9e3ce2683625317 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 31 Oct 2021 11:55:22 -0400 Subject: [PATCH 49/91] added PiTemp to phpsysinfo --- templates/phpsysinfo.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/phpsysinfo.ini b/templates/phpsysinfo.ini index 854987c..97617ca 100644 --- a/templates/phpsysinfo.ini +++ b/templates/phpsysinfo.ini @@ -282,7 +282,7 @@ DATETIME_FORMAT="UTC" ; Example: If you want to use lmsensors : SENSOR_PROGRAM="LMSensors" ; If you want to use lmsensors and IPMItool: SENSOR_PROGRAM="LMSensors,IPMItool" ; -SENSOR_PROGRAM=false +SENSOR_PROGRAM="PiTemp" ; Show events of sensors From 61ee44605f1cd9fd5f004f1dfab741e9ee128b0c Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 31 Oct 2021 12:01:04 -0400 Subject: [PATCH 50/91] drops you off in the right place now --- scripts/update_inprogress.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update_inprogress.php b/scripts/update_inprogress.php index cd35c9b..af6f4d9 100644 --- a/scripts/update_inprogress.php +++ b/scripts/update_inprogress.php @@ -1,6 +1,6 @@ From ad8f224b5bf0d4a0f545165a4cc71cf536eb56fb Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 31 Oct 2021 12:12:56 -0400 Subject: [PATCH 51/91] another drop off fix --- scripts/restart_birdnet_analysis.php | 2 +- scripts/restart_services.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/restart_birdnet_analysis.php b/scripts/restart_birdnet_analysis.php index f99e013..2bca34d 100644 --- a/scripts/restart_birdnet_analysis.php +++ b/scripts/restart_birdnet_analysis.php @@ -1,4 +1,4 @@ diff --git a/scripts/restart_services.php b/scripts/restart_services.php index c1e7b55..ba15664 100644 --- a/scripts/restart_services.php +++ b/scripts/restart_services.php @@ -1,4 +1,4 @@ From 4d3ad4f08c9b1628290c4a3d26b5a6e0516dee17 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Sun, 31 Oct 2021 12:22:07 -0400 Subject: [PATCH 52/91] replaces all urls correctly --- scripts/install_services.sh | 8 ++++++++ scripts/update_services.sh | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/install_services.sh b/scripts/install_services.sh index 1d8150a..7e8b3e2 100755 --- a/scripts/install_services.sh +++ b/scripts/install_services.sh @@ -113,10 +113,18 @@ create_necessary_dirs() { if [ ! -z ${BIRDNETLOG_URL} ];then BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')" sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html + phpfiles="$(grep -l "birdnetpi.local:8080" ${my_dir}/*.php)" + for i in "${phpfiles[@]}";do + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" ${i} + done fi if [ ! -z ${EXTRACTIONLOG_URL} ];then EXTRACTIONLOG_URL="$(echo ${EXTRACTIONLOG_URL} | sed 's/\/\//\\\/\\\//g')" sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html + phpfiles="$(grep -l "birdnetpi.local:8888" ${my_dir}/*.php)" + for i in "${phpfiles[@]}";do + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" ${i} + done fi sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED} diff --git a/scripts/update_services.sh b/scripts/update_services.sh index cf66264..caf8e32 100755 --- a/scripts/update_services.sh +++ b/scripts/update_services.sh @@ -110,15 +110,21 @@ create_necessary_dirs() { [ -d ${PROCESSED} ] || sudo -u ${USER} mkdir -p ${PROCESSED} sudo -u ${USER} ln -fs $(dirname ${my_dir})/homepage/* ${EXTRACTED} - set -x if [ ! -z ${BIRDNETLOG_URL} ];then BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')" sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html + phpfiles="$(grep -l "birdnetpi.local:8080" ${my_dir}/*.php)" + for i in "${phpfiles[@]}";do + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" ${i} + done fi - set +x if [ ! -z ${EXTRACTIONLOG_URL} ];then EXTRACTIONLOG_URL="$(echo ${EXTRACTIONLOG_URL} | sed 's/\/\//\\\/\\\//g')" sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html + phpfiles="$(grep -l "birdnetpi.local:8888" ${my_dir}/*.php)" + for i in "${phpfiles[@]}";do + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" ${i} + done fi sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED} From cf491ea581455c1058727bd308ad330f77f029f7 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Sun, 31 Oct 2021 13:05:14 -0400 Subject: [PATCH 53/91] Update Birders_Guide_Installer.sh --- Birders_Guide_Installer.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 8ac5ae6..8b1ea33 100755 --- a/Birders_Guide_Installer.sh +++ b/Birders_Guide_Installer.sh @@ -294,7 +294,6 @@ EOF [ -d /etc/birdnet ] || sudo mkdir /etc/birdnet sudo ln -sf ${my_dir}/birdnet.conf /etc/birdnet/birdnet.conf } -echo " if [ ! -f ${HOME}/stage_1_complete ] ;then stage_1 stage_2 From 385007ad099b296a07a10b2dde78b9e9207904ae Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Sun, 31 Oct 2021 17:11:11 -0400 Subject: [PATCH 54/91] Update createdb.sh --- scripts/createdb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/createdb.sh b/scripts/createdb.sh index 80bee01..7f05db3 100755 --- a/scripts/createdb.sh +++ b/scripts/createdb.sh @@ -36,7 +36,7 @@ CREATE TABLE IF NOT EXISTS detections ( Sens FLOAT, Overlap FLOAT); GRANT ALL ON birds.* TO 'birder'@'localhost' IDENTIFIED BY '${DB_PWD}' WITH GRANT OPTION; - +FLUSH PRIVILEGES; exit EOF sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py From 5010f18cfa869f2fd10065b2e498df5e375ec967 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Sun, 31 Oct 2021 17:14:10 -0400 Subject: [PATCH 55/91] Update version.md --- version.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/version.md b/version.md index 84e5ccd..b4f8613 100644 --- a/version.md +++ b/version.md @@ -1,5 +1,5 @@ -# testing - 0.4 -## What's new -- New desktop web interface -- Better support for public installations - - Needs better documentation to explain how to set it up +# newinstaller v0.5 +- New `birdnet-pi-config` tool meant for: + - SSH-only installation + - Reconfiguring birdnet.conf + - Configuring system settings From 4ba1a1963e9e4d8787c6939df70d4905032cf635 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Mon, 1 Nov 2021 13:12:31 -0400 Subject: [PATCH 56/91] adjusting defaults --- .gitignore | 3 - birdnet.conf | 195 ++++++++++++++++++++++++++++++++++++++ birdnet.conf-defaults | 181 ++++++++++++++++------------------- scripts/clear_all_data.sh | 57 ++++++++--- 4 files changed, 322 insertions(+), 114 deletions(-) create mode 100644 birdnet.conf diff --git a/.gitignore b/.gitignore index 50425de..2fec127 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,6 @@ model/BirdNET_Soundscape_Model.pkl .vscode datasets/ -birdnet.conf -miniforge -scripts/install_miniforge.sh IdentifiedSoFar.txt IdentifiedSoFar.txt.bak Birders_Guide_Installer_Configuration.txt diff --git a/birdnet.conf b/birdnet.conf new file mode 100644 index 0000000..1d2afce --- /dev/null +++ b/birdnet.conf @@ -0,0 +1,195 @@ +################################################################################ +# Configuration settings for BirdNET-Pi # +################################################################################ + +############ CHANGE THE LATITUDE AND LONGITUDE TO STATIC VALUES ################ + + +## LATITUDE and LONGITUDE are self-explanatroy. Find them easily at +## maps.google.com. +## Example: these coordinates would indicate the Eiffel Tower in Paris, France. +## LATITUDE=48.858 +## LONGITUDE=2.294 + +## These are input as shell substitutions so that this will work out of the box. +## It guesses your latitude and longitude based off of your network information. +## THESE SHOULD BE CHANGED TO STATIC NUMBERS!!!! +LATITUDE="$(curl -s4 ifconfig.co/json | awk '/lat/ {print $2}' | tr -d ',')" +LONGITUDE="$(curl -s4 ifconfig.co/json | awk '/lon/ {print $2}' | tr -d ',')" + + +## RECS_DIR is the location birdnet_analysis.service will look for the data-set +## it needs to analyze. Be sure this directory is readable and writable for +## the BIRDNET_USER. If you are going to be accessing a remote data-set, you +## still need to set this, as this will be where the remote directory gets +## mounted locally. + +RECS_DIR=/home/pi/BirdSongs + +#----------------------- Web Interface User Password ------------------------# +#____________________The variable below sets the 'birdnet'_____________________# +#___________________user password for the live audio stream,___________________# +#_________________web tools, system info, and processed files__________________# + +## CADDY_PWD is the plaintext password (that will be hashed) and used to access +## certain parts of the web interface + +CADDY_PWD=changeme + +#------------------------- MariaDB User Passwords ---------------------------# +#_____________The variables below set the 'birder' and 'root'__________________# +#_______________________user passwords for the MariaDB_________________________# + +## DB_PWD is for the 'birder' user +DB_PWD=changeme +## DB_ROOT_PWD is for the 'root' user +DB_ROOT_PWD=changeme + +#------------------------- Live Audio Stream --------------------------------# +#_____________The variable below configures/enables the live___________________# +#_____________________________audio stream.____________________________________# + + +## ICE_PWD is the password that icecast2 will use to authenticate ffmpeg as a +## trusted source for the stream. You will never need to enter this manually +## anywhere other than here. + +ICE_PWD=changeme + +#----------------------- Web-hosting/Caddy File-server -----------------------# +#________The four variables below can be set to enable internet access_________# +#____________to your data,(e.g., extractions, raw data, live___________________# +#______________audio stream, BirdNET.selection.txt files)______________________# + + +## BIRDNETPI_URL is the URL where the extractions, data-set, and live-stream +## will be web-hosted. If you do not own a domain, or would just prefer to keep +## the BirdNET-Pi on your local network, keep this EMPTY. + +BIRDNETPI_URL= +EXTRACTIONLOG_URL= +BIRDNETLOG_URL= + + +#------------------- Mobile Notifications via Pushed.co ---------------------# +#____________The two variables below enable mobile notifications_______________# +#_____________See https://pushed.co/quick-start-guide to get___________________# +#_________________________these values for your app.___________________________# + +# Keep these EMPTY if haven't setup a Pushed.co App yet. # + +## Pushed.co App Key and App Secret + +PUSHED_APP_KEY= +PUSHED_APP_SECRET= + +################################################################################ +#-------------------------------- Defaults ----------------------------------# +################################################################################ + +#------------------------------- NoMachine ----------------------------------# +#_____________The variable below can be set include NoMachine__________________# +#_________________remote desktop software to be installed._____________________# + +# Keep this EMPTY if you do not want to install NoMachine. # + +## INSTALL_NOMACHINE is simply a setting that can be enabled to install +## NoMachine alongside the BirdNET-Pi for remote desktop access. This in- +## staller assumes personal use. Please reference the LICENSE file included +## in this repository for more information. +## Set this to Y or y to install NoMachine alongside the BirdNET-Lite + +INSTALL_NOMACHINE=y + +# +#------------------------------ Extraction Service ---------------------------# + +## DO_EXTRACTIONS is simply a setting for enabling the extraction.service. +## Set this to Y or y to enable extractions. + +DO_EXTRACTIONS=y + +#----------------------------- Recording Service ----------------------------# +#____________________The variable below can be set to enable __________________# +#________________________the birdnet_recording.service ________________________# + +## DO_RECORDING is simply a setting for enabling the 24/7 +## birdnet_recording.service. +## Set this to Y or y to enable recording. + +DO_RECORDING=y + +## REC_CARD is the sound card you would want the birdnet_recording.service to +## use. This setting is irrelevant if you are not planning on doing data +## collection via recording on this machine. The command substitution below +## looks for a USB microphone's dsnoop alsa device. The dsnoop device lets +## birdnet_recording.service and livestream.service share the raw audio stream +## from the microphone. If you would like to use a different microphone than +## what this produces, or if your microphone does not support creating a +## dsnoop device, you can set this explicitly from a list of the available +## devices from the output of running 'aplay -L' + +REC_CARD=default + +## PROCESSED is the directory where the formerly 'Analyzed' files are moved +## after extractions have been made from them. This includes both WAVE and +## BirdNET.selection.txt files. + +PROCESSED=${RECS_DIR}/Processed + +## EXTRACTED is the directory where the extracted audio selections are moved. + +EXTRACTED=${RECS_DIR}/Extracted + +## IDFILE is the file that keeps a complete list of every spececies that +## BirdNET has identified from your data-set. It is persistent across +## data-sets, so would need to be whiped clean through deleting or renaming +## it. A backup is automatically made from this variable each time it is +## updated (structure: ${IDFILE}.bak), and would also need to be removed +## or renamed to start a new file between data-sets. Alternately, you can +## change this variable between data-sets to preserve records of disparate +## data-sets according to name. + +IDFILE=${HOME}/BirdNET-Pi/IdentifiedSoFar.txt + +## OVERLAP is the value in seconds which BirdNET should use when analyzing +## the data. The values must be between 0.0-2.9. + +OVERLAP=0.0 + +## CONFIDENCE is the minimum confidence level from 0.0-1.0 BirdNET's analysis +## should reach before creating an entry in the BirdNET.selection.txt file. +## Don't set this to 1.0 or you won't have any results. + +CONFIDENCE=0.7 + +## SENSITIVITY is the detection sensitivity from 0.5-1.5. + +SENSITIVITY=1.25 + +## CHANNELS holds the variabel that corresponds to the number of channels the +## sound card supports. + +CHANNELS=2 + +## VENV is the virtual environment where the the BirdNET python build is found, +## i.e, VENV is the virtual environment miniforge built for BirdNET. + +VENV=/home/pi/BirdNET-Pi/birdnet + +## RECORDING_LENGTH sets the length of the recording that BirdNET-Lite will analyze. +RECORDING_LENGTH= + +## EXTRACTION_LENGTH sets the length of the audio extractions that will be made +## from each BirdNET-Lite detection. +EXTRACTION_LENGTH= + +## BIRDNET_USER should be the non-root user systemd should use to execute each +## service. + +BIRDNET_USER=pi + + +## These are just for debugging +LAST_RUN= +THIS_RUN= diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults index 118e0d4..0ba5c3c 100644 --- a/birdnet.conf-defaults +++ b/birdnet.conf-defaults @@ -1,91 +1,75 @@ ################################################################################ -# Configuration settings for BirdNET as a service # +# Configuration settings for BirdNET-Pi # ################################################################################ -INSTALL_DATE="$(date "+%D")" -#___________The four variables below are the only that are required.___________# -## BIRDNET_USER should be the non-root user systemd should use to execute each -## service. +############ CHANGE THE LATITUDE AND LONGITUDE TO STATIC VALUES ################ -BIRDNET_USER= + +## LATITUDE and LONGITUDE are self-explanatroy. Find them easily at +## maps.google.com. +## Example: these coordinates would indicate the Eiffel Tower in Paris, France. +## LATITUDE=48.858 +## LONGITUDE=2.294 + +## These are input as shell substitutions so that this will work out of the box. +## It guesses your latitude and longitude based off of your network information. +## THESE SHOULD BE CHANGED TO STATIC NUMBERS!!!! +LATITUDE="$(curl -s4 ifconfig.co/json | awk '/lat/ {print $2}' | tr -d ',')" +LONGITUDE="$(curl -s4 ifconfig.co/json | awk '/lon/ {print $2}' | tr -d ',')" ## RECS_DIR is the location birdnet_analysis.service will look for the data-set ## it needs to analyze. Be sure this directory is readable and writable for ## the BIRDNET_USER. If you are going to be accessing a remote data-set, you ## still need to set this, as this will be where the remote directory gets -## mounted locally. +## mounted locally. -RECS_DIR= +RECS_DIR=/home/pi/BirdSongs -## LATITUDE and LONGITUDE are self-explanatroy. Find them easily at -## maps.google.com. Only go to the thousanths place for these variables -## Example: these coordinates would indicate the Eiffel Tower in Paris, France. -## LATITUDE=48.858 -## LONGITUDE=2.294 - -LATITUDE= -LONGITUDE= - -################################################################################ -#------------------------------ Extraction Service ---------------------------# -#__________________The variable below can be set to enable the ________________# -#______________________________ extraction.service ____________________________# - -# Keep this EMPTY if you do not want this device to perform the extractions # - -## DO_EXTRACTIONS is simply a setting for enabling the extraction.service. -## Set this to Y or y to enable extractions. - -DO_EXTRACTIONS= - -################################################################################ -#----------------------------- Recording Service ----------------------------# -#____________________The variable below can be set to enable __________________# -#________________________the birdnet_recording.service ________________________# - -# Keep this EMPTY if you do not want this device to perform the recording. # - -## DO_RECORDING is simply a setting for enabling the 24/7 -## birdnet_recording.service. -## Set this to Y or y to enable recording. - -DO_RECORDING= - -################################################################################ -#----------------------- Web-hosting/Caddy File-server -----------------------# -#_______The two variables below can be set to enable internet access___________# -#____________to your data,(e.g., extractions, raw data, live___________________# -#______________audio stream, BirdNET.selection.txt files)______________________# - -# Leave these EMPTY if you do not want to enable web access # - -## BIRDNETPI_URL is the URL where the extractions, data-set, and live-stream -## will be web-hosted. If you do not own a domain, or would just prefer to keep -## BirdNET-Pi on your local network, keep this empty. - -BIRDNETPI_URL= +#----------------------- Web Interface User Password ------------------------# +#____________________The variable below sets the 'birdnet'_____________________# +#___________________user password for the live audio stream,___________________# +#_________________web tools, system info, and processed files__________________# ## CADDY_PWD is the plaintext password (that will be hashed) and used to access -## the "Processed" directory and live audio stream. This MUST be set if you -## choose to enable this feature. +## certain parts of the web interface -CADDY_PWD= +CADDY_PWD=changeme + +#------------------------- MariaDB User Passwords ---------------------------# +#_____________The variables below set the 'birder' and 'root'__________________# +#_______________________user passwords for the MariaDB_________________________# + +## DB_PWD is for the 'birder' user +DB_PWD=changeme +## DB_ROOT_PWD is for the 'root' user +DB_ROOT_PWD=changeme -################################################################################ #------------------------- Live Audio Stream --------------------------------# #_____________The variable below configures/enables the live___________________# #_____________________________audio stream.____________________________________# -# Keep this EMPTY if you do not wish to enable the live stream # -# or if this device is not doing the recording # ## ICE_PWD is the password that icecast2 will use to authenticate ffmpeg as a ## trusted source for the stream. You will never need to enter this manually ## anywhere other than here. -ICE_PWD= +ICE_PWD=changeme + +#----------------------- Web-hosting/Caddy File-server -----------------------# +#________The four variables below can be set to enable internet access_________# +#____________to your data,(e.g., extractions, raw data, live___________________# +#______________audio stream, BirdNET.selection.txt files)______________________# + + +## BIRDNETPI_URL is the URL where the extractions, data-set, and live-stream +## will be web-hosted. If you do not own a domain, or would just prefer to keep +## the BirdNET-Pi on your local network, keep this EMPTY. + +BIRDNETPI_URL= +EXTRACTIONLOG_URL= +BIRDNETLOG_URL= + -################################################################################ #------------------- Mobile Notifications via Pushed.co ---------------------# #____________The two variables below enable mobile notifications_______________# #_____________See https://pushed.co/quick-start-guide to get___________________# @@ -99,6 +83,9 @@ PUSHED_APP_KEY= PUSHED_APP_SECRET= ################################################################################ +#-------------------------------- Defaults ----------------------------------# +################################################################################ + #------------------------------- NoMachine ----------------------------------# #_____________The variable below can be set include NoMachine__________________# #_________________remote desktop software to be installed._____________________# @@ -109,14 +96,27 @@ PUSHED_APP_SECRET= ## NoMachine alongside the BirdNET-Pi for remote desktop access. This in- ## staller assumes personal use. Please reference the LICENSE file included ## in this repository for more information. -## Set this to Y or y to install NoMachine alongside the BirdNET-Pi +## Set this to Y or y to install NoMachine alongside the BirdNET-Lite -INSTALL_NOMACHINE= +INSTALL_NOMACHINE=y -################################################################################ -#-------------------------------- Defaults ----------------------------------# -#______The seven variables below are default settings that you (probably)______# -#__________________don't need to change at all, but can._______________________# +# +#------------------------------ Extraction Service ---------------------------# + +## DO_EXTRACTIONS is simply a setting for enabling the extraction.service. +## Set this to Y or y to enable extractions. + +DO_EXTRACTIONS=y + +#----------------------------- Recording Service ----------------------------# +#____________________The variable below can be set to enable __________________# +#________________________the birdnet_recording.service ________________________# + +## DO_RECORDING is simply a setting for enabling the 24/7 +## birdnet_recording.service. +## Set this to Y or y to enable recording. + +DO_RECORDING=y ## REC_CARD is the sound card you would want the birdnet_recording.service to ## use. This setting is irrelevant if you are not planning on doing data @@ -129,7 +129,7 @@ INSTALL_NOMACHINE= ## devices from the output of running 'aplay -L' REC_CARD=default - + ## PROCESSED is the directory where the formerly 'Analyzed' files are moved ## after extractions have been made from them. This includes both WAVE and ## BirdNET.selection.txt files. @@ -166,44 +166,29 @@ CONFIDENCE=0.7 SENSITIVITY=1.25 -################################################################################ -#------------------------------ Auto-Generated ------------------------------# -#_____________________The variables below are auto-generated___________________# -#______________________________during installation_____________________________# - ## CHANNELS holds the variabel that corresponds to the number of channels the ## sound card supports. -CHANNELS= - -# Don't touch the variables below - -## SYSTEMD_MOUNT is created from the RECS_DIR variable to comply with systemd -## mount naming requirements. - -SYSTEMD_MOUNT=$(echo ${RECS_DIR#/} | tr / -).mount +CHANNELS=2 ## VENV is the virtual environment where the the BirdNET python build is found, ## i.e, VENV is the virtual environment miniforge built for BirdNET. -VENV=$(dirname ${my_dir})/miniforge/envs/birdnet - -################################################################################ -#---------------------------------- Testing -----------------------------------# -#_____________These variables are for testing. Please don't touch______________# -#_______________them if you are not testing these features.____________________# - -# To test different values for RECORDING_LENGTH, first: -# 1) stop the birdnet_recording.service: -#### run: `sudo systemctl stop birdnet_recording.service` -# 2) remove any remaining audio files in the day's recording directory: -#### Example: to remove recordings for Saturday, October 2nd, 2021, you would -#### run: `rm -rf /home/pi/BirdSongs/October-2021/02-Saturday/*` -# 3) restart the birdnet_recording.service: -#### run: `sudo systemctl restart birdnet_recording.service` +VENV=/home/pi/BirdNET-Pi/birdnet +## RECORDING_LENGTH sets the length of the recording that BirdNET-Lite will analyze. RECORDING_LENGTH= +## EXTRACTION_LENGTH sets the length of the audio extractions that will be made +## from each BirdNET-Lite detection. EXTRACTION_LENGTH= +## BIRDNET_USER should be the non-root user systemd should use to execute each +## service. + +BIRDNET_USER=pi + + +## These are just for debugging LAST_RUN= +THIS_RUN= diff --git a/scripts/clear_all_data.sh b/scripts/clear_all_data.sh index d7b0035..f9ac89c 100755 --- a/scripts/clear_all_data.sh +++ b/scripts/clear_all_data.sh @@ -4,28 +4,59 @@ # you are okay will losing all the data that you've collected and processed # so far. source /etc/birdnet/birdnet.conf +HOME=/home/pi +my_dir=${HOME}/BirdNET-Pi/scripts echo "Stopping services" sudo systemctl stop birdnet_recording.service echo "Removing all data . . . " sudo rm -drf "${RECS_DIR}" sudo rm -f "${IDFILE}" echo "Recreating necessary directories" -[ -d ${RECS_DIR} ] || sudo -u ${BIRDNET_USER} mkdir -p ${RECS_DIR} -[ -d ${EXTRACTED} ] || sudo -u ${BIRDNET_USER} mkdir -p ${EXTRACTED} -[ -d ${EXTRACTED}/By_Date ] || sudo -u ${BIRDNET_USER} mkdir -p ${EXTRACTED}/By_Date -[ -d ${EXTRACTED}/By_Common_Name ] || sudo -u ${BIRDNET_USER} mkdir -p ${EXTRACTED}/By_Common_Name -[ -d ${EXTRACTED}/By_Scientific_Name ] || sudo -u ${BIRDNET_USER} mkdir -p ${EXTRACTED}/By_Scientific_Name -sudo -u ${BIRDNET_USER} ln -s /home/pi/BirdNET-Pi/templates/index.html ${EXTRACTED} -[ -d ${PROCESSED} ] || sudo -u ${BIRDNET_USER} mkdir -p ${PROCESSED} -[ -L ${EXTRACTED}/scripts ] || sudo -u ${BIRDNET_USER} ln -s /home/pi/BirdNET-Pi/scripts ${EXTRACTED}/ -[ -L ${EXTRACTED}/spectrogram.php ] || sudo -u ${BIRDNET_USER} ln -s /home/pi/BirdNET-Pi/scripts/spectrogram.php ${EXTRACTED} -[ -L ${EXTRACTED}/spectrogram.sh ] || sudo -u ${BIRDNET_USER} ln -s /home/pi/BirdNET-Pi/scripts/spectrogram.sh ${EXTRACTED} -[ -L ${EXTRACTED}/viewdb.php ] || sudo -u ${BIRDNET_USER} ln -s /home/pi/BirdNET-Pi/scripts/viewdb.php ${EXTRACTED} +echo "Creating necessary directories" +[ -d ${EXTRACTED} ] || sudo -u ${USER} mkdir -p ${EXTRACTED} +[ -d ${EXTRACTED}/By_Date ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Date +[ -d ${EXTRACTED}/By_Common_Name ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Common_Name +[ -d ${EXTRACTED}/By_Scientific_Name ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Scientific_Name +[ -d ${PROCESSED} ] || sudo -u ${USER} mkdir -p ${PROCESSED} + +sudo -u ${USER} ln -fs $(dirname ${my_dir})/homepage/* ${EXTRACTED} +if [ ! -z ${BIRDNETLOG_URL} ];then + BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')" + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html + phpfiles="$(grep -l "birdnetpi.local:8080" ${my_dir}/*.php)" + for i in "${phpfiles[@]}";do + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" ${i} + done +fi +if [ ! -z ${EXTRACTIONLOG_URL} ];then + EXTRACTIONLOG_URL="$(echo ${EXTRACTIONLOG_URL} | sed 's/\/\//\\\/\\\//g')" + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html + phpfiles="$(grep -l "birdnetpi.local:8888" ${my_dir}/*.php)" + for i in "${phpfiles[@]}";do + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" ${i} + done +fi + +sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED} +if [ ! -z ${BIRDNETPI_URL} ];then + BIRDNETPI_URL="$(echo ${BIRDNETPI_URL} | sed 's/\/\//\\\/\\\//g')" + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/"${BIRDNETPI_URL}"/g" $(dirname ${my_dir})/homepage/*.html + phpfiles="$(grep -l birdnetpi.local ${my_dir}/*.php)" + for i in "${phpfiles[@]}";do + sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/"${BIRDNETPI_URL}"/g" ${i} + done +fi + +sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/spectrogram.php ${EXTRACTED} +sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/viewdb.php ${EXTRACTED} sudo -u ${USER} ln -fs ${HOME}/phpsysinfo ${EXTRACTED} -[ -L ${EXTRACTED}/phpsysinfo.ini ] || sudo -u ${USER} cp ${HOME}/phpsysinfo/phpsysinfo.ini.new ${HOME}/phpsysinfo/phpsysinfo.ini +sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phpsysinfo/ +sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/ +sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html -sudo -u ${BIRDNET_USER} cp ~/BirdNET-Pi/templates/index.html ${EXTRACTED}/ + +sudo -u ${BIRDNET_USER} cp ~/BirdNET-Pi/homepage/index.html ${EXTRACTED}/ echo "Dropping and re-creating database" sudo /home/pi/BirdNET-Pi/scripts/createdb.sh echo "Restarting services" From e90318d3a3d8fed221cf784ee9a7ab4efcd1f6a3 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Mon, 1 Nov 2021 13:14:18 -0400 Subject: [PATCH 57/91] adding defaults to this --- scripts/birdnet_analysis.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/birdnet_analysis.sh b/scripts/birdnet_analysis.sh index d8f32c5..a7aedd8 100755 --- a/scripts/birdnet_analysis.sh +++ b/scripts/birdnet_analysis.sh @@ -6,6 +6,8 @@ source /etc/birdnet/birdnet.conf # Make a temporary file to compare the current birdnet.conf with # the birdnet.conf as it was the last time this script was called my_dir=$(realpath $(dirname $0)) +if [ -z ${THIS_RUN} ];then THIS_RUN=/home/pi/BirdNET-Pi/thisrun.txt;fi +if [ -z ${LAST_RUN} ];then LAST_RUN=/home/pi/BirdNET-Pi/thisrun.txt;fi make_thisrun() { sleep .4 awk '!/#/ && !/^$/ {print}' /etc/birdnet/birdnet.conf \ From d7f3f349c4f2bda4801808c3fad7bd09445ece95 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Mon, 1 Nov 2021 15:23:38 -0400 Subject: [PATCH 58/91] removed option to start after install --- scripts/install_birdnet.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/install_birdnet.sh b/scripts/install_birdnet.sh index 6b620fc..ef1af1f 100755 --- a/scripts/install_birdnet.sh +++ b/scripts/install_birdnet.sh @@ -99,9 +99,7 @@ echo " BirdNet is installed!! Visit the BirdNET-Pi homepage at http://birdnetpi.local" -echo -read -n1 -p " Would you like to run the birdnet_analysis.service now?" YN -echo + echo case $YN in [Yy] ) sudo systemctl start birdnet_analysis.service \ && journalctl -fu birdnet_analysis;; From 62076d83ae1c3228b62527e62d5d2c7c79ae1391 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Mon, 1 Nov 2021 15:27:58 -0400 Subject: [PATCH 59/91] properly configure /etc/hosts --- scripts/install_services.sh | 1 + scripts/update_services.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/install_services.sh b/scripts/install_services.sh index 7e8b3e2..da9e797 100755 --- a/scripts/install_services.sh +++ b/scripts/install_services.sh @@ -16,6 +16,7 @@ set_hostname() { echo "Setting hostname to 'birdnetpi'" hostnamectl set-hostname birdnetpi sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts + sed -i 's/localhost$/localhost birdnetpi.local/g' /etc/hosts fi } diff --git a/scripts/update_services.sh b/scripts/update_services.sh index caf8e32..1d33862 100755 --- a/scripts/update_services.sh +++ b/scripts/update_services.sh @@ -16,6 +16,7 @@ set_hostname() { echo "Setting hostname to 'birdnetpi'" hostnamectl set-hostname birdnetpi sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts + sed -i 's/localhost$/localhost birdnetpi.local/g' /etc/hosts fi } From c2749053720ac7218495938ca60fff605917b57a Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Mon, 1 Nov 2021 15:59:35 -0400 Subject: [PATCH 60/91] adding adminer --- scripts/adminer.php | 1795 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1795 insertions(+) create mode 100644 scripts/adminer.php diff --git a/scripts/adminer.php b/scripts/adminer.php new file mode 100644 index 0000000..762aaaf --- /dev/null +++ b/scripts/adminer.php @@ -0,0 +1,1795 @@ +$W){unset($tg[$z][$he]);if(is_array($W)){$tg[$z][stripslashes($he)]=$W;$tg[]=&$tg[$z][stripslashes($he)];}else$tg[$z][stripslashes($he)]=($ad?$W:stripslashes($W));}}}}function +bracket_escape($v,$Na=false){static$ui=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return +strtr($v,($Na?array_flip($ui):$ui));}function +min_version($Zi,$De="",$h=null){global$g;if(!$h)$h=$g;$nh=$h->server_info;if($De&&preg_match('~([\d.]+)-MariaDB~',$nh,$C)){$nh=$C[1];$Zi=$De;}return(version_compare($nh,$Zi)>=0);}function +charset($g){return(min_version("5.5.3",0,$g)?"utf8mb4":"utf8");}function +script($yh,$ti="\n"){return"$yh$ti";}function +script_src($Ni){return"\n";}function +nonce(){return' nonce="'.get_nonce().'"';}function +target_blank(){return' target="_blank" rel="noreferrer noopener"';}function +h($P){return +str_replace("\0","�",htmlspecialchars($P,ENT_QUOTES,'utf-8'));}function +nl_br($P){return +str_replace("\n","
",$P);}function +checkbox($D,$Y,$db,$me="",$uf="",$hb="",$ne=""){$I="".($uf?script("qsl('input').onclick = function () { $uf };",""):"");return($me!=""||$hb?"$I".h($me)."":$I);}function +optionlist($_f,$gh=null,$Ri=false){$I="";foreach($_f +as$he=>$W){$Af=array($he=>$W);if(is_array($W)){$I.='';$Af=$W;}foreach($Af +as$z=>$X)$I.=''.h($X);if(is_array($W))$I.='';}return$I;}function +html_select($D,$_f,$Y="",$tf=true,$ne=""){if($tf)return"".(is_string($tf)?script("qsl('select').onchange = function () { $tf };",""):"");$I="";foreach($_f +as$z=>$X)$I.="";return$I;}function +select_input($Ia,$_f,$Y="",$tf="",$fg=""){$Yh=($_f?"select":"input");return"<$Yh$Ia".($_f?">