A live bird collage card for your Home Assistant dashboard.
config: BIRDNET_USER=$USER added
frederik88d273f8fe70
diff --git a/scripts/clear_all_data.sh b/scripts/clear_all_data.shindex 7ca511f0..9330ef15 100755--- a/scripts/clear_all_data.sh+++ b/scripts/clear_all_data.sh@@ -5,8 +5,8 @@# so far.set -xsource /etc/birdnet/birdnet.conf-USER=$(awk -F: '/1000/ {print $1}' /etc/passwd)-HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)+USER=${BIRDNET_USER}+HOME=/home/${BIRDNET_USER}my_dir=${HOME}/BirdNET-Pi/scriptsecho "Stopping services"sudo systemctl stop birdnet_recording.servicediff --git a/scripts/install_config.sh b/scripts/install_config.shindex d77efe88..9456c613 100755--- a/scripts/install_config.sh+++ b/scripts/install_config.sh@@ -121,6 +121,11 @@ FLICKR_FILTER_EMAIL=#-------------------------------- Defaults ----------------------------------#################################################################################+## BIRDNET_USER is for scripts to easily find where BirdNET-Pi is installed+## DO NOT EDIT!++BIRDNET_USER=$USER+## 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.diff --git a/scripts/install_language_label.sh b/scripts/install_language_label.shindex 01292882..001ccb87 100755--- a/scripts/install_language_label.sh+++ b/scripts/install_language_label.sh@@ -14,7 +14,8 @@ while getopts "l:" o; dodoneshift $((OPTIND-1))-HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)+source /etc/birdnet/birdnet.conf+HOME=/home/${BIRDNET_USER}label_file_name="labels_${lang}.txt"diff --git a/scripts/install_language_label_nm.sh b/scripts/install_language_label_nm.shindex 4569a0c9..fb97bf8d 100755--- a/scripts/install_language_label_nm.sh+++ b/scripts/install_language_label_nm.sh@@ -14,7 +14,8 @@ while getopts "l:" o; dodoneshift $((OPTIND-1))-HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)+source /etc/birdnet/birdnet.conf+HOME=/home/${BIRDNET_USER}label_file_name="labels_${lang}.txt"diff --git a/scripts/update_birdnet.sh b/scripts/update_birdnet.shindex 340ecacd..e3332a60 100755--- a/scripts/update_birdnet.sh+++ b/scripts/update_birdnet.sh@@ -5,8 +5,13 @@ trap 'exit 1' SIGINT SIGHUPusage() { echo "Usage: $0 [-r <remote name>] [-b <branch name>]" 1>&2; exit 1; }-USER=$(awk -F: '/1000/ {print $1}' /etc/passwd)-HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)+if [ -n "${BIRDNET_USER}" ]; then+ USER=${BIRDNET_USER}+ HOME=/home/${BIRDNET_USER}+else+ USER=$(awk -F: '/1000/ {print $1}' /etc/passwd)+ HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)+fimy_dir=$HOME/BirdNET-Pi/scripts# Defaultsdiff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.shindex 80967343..bb51b0fe 100755--- a/scripts/update_birdnet_snippets.sh+++ b/scripts/update_birdnet_snippets.sh@@ -2,10 +2,15 @@set -x# Update BirdNET-Pitrap 'exit 1' SIGINT SIGHUP-USER=$(awk -F: '/1000/ {print $1}' /etc/passwd)-HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)-my_dir=$HOME/BirdNET-Pi/scriptssource /etc/birdnet/birdnet.conf+if [ -n "${BIRDNET_USER}" ]; then+ USER=${BIRDNET_USER}+ HOME=/home/${BIRDNET_USER}+else+ USER=$(awk -F: '/1000/ {print $1}' /etc/passwd)+ HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)+fi+my_dir=$HOME/BirdNET-Pi/scriptssource "$my_dir/install_helpers.sh"# Sets proper permissions and ownership@@ -65,6 +70,12 @@ if ! grep -E '^DATA_MODEL_VERSION=' /etc/birdnet/birdnet.conf &>/dev/null;thenecho "DATA_MODEL_VERSION=1" >> /etc/birdnet/birdnet.conffi+if ! grep -E '^BIRDNET_USER=' /etc/birdnet/birdnet.conf &>/dev/null;then+ echo "## BIRDNET_USER is for scripts to easily find where BirdNET-Pi is installed" >> /etc/birdnet/birdnet.conf+ echo "## DO NOT EDIT!" >> /etc/birdnet/birdnet.conf+ echo "BIRDNET_USER=$(awk -F: '/1000/ {print $1}' /etc/passwd)" >> /etc/birdnet/birdnet.conf+fi+if ! grep -E '^RTSP_STREAM_TO_LIVESTREAM=' /etc/birdnet/birdnet.conf &>/dev/null;thenecho "RTSP_STREAM_TO_LIVESTREAM=\"0\"" >> /etc/birdnet/birdnet.conffi