From 5fd80fcc49322a9ac5f2e4591d04db734342051c Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Fri, 15 Apr 2022 09:42:55 -0400 Subject: [PATCH] Update update_birdnet.sh --- scripts/update_birdnet.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/update_birdnet.sh b/scripts/update_birdnet.sh index 970dd04..be54a18 100755 --- a/scripts/update_birdnet.sh +++ b/scripts/update_birdnet.sh @@ -2,13 +2,16 @@ # Update BirdNET-Pi source /etc/birdnet/birdnet.conf trap 'exit 1' SIGINT SIGHUP -my_dir=${HOME}/BirdNET-Pi/scripts +my_dir=$(realpath $(dirname $0)) -sudo -u${USER} git -C $my_dir/BirdNET-Pi stash -sudo -u${USER} git -C $my_dir/BirdNET-Pi pull -f +sudo -u${USER} git -C $my_dir stash +sudo -u${USER} git -C $my_dir pull -f sudo systemctl daemon-reload -sudo -u${USER} git -C $my_dir/BirdNET-Pi stash pop +sudo -u${USER} git -C $my_dir stash pop sudo ln -sf $my_dir/* /usr/local/bin/ +if ! grep python3 <(head -n1 $my_dir/analyze.py);then + echo "Ensure all python scripts use the virtual environment" + sed -si "1 i\\#\!$(realpath $(dirname $my_dir))/BirdNET-Pi/birdnet/bin/python3" $my_dir/*.py if ! grep PRIVACY_MODE /etc/birdnet/birdnet.conf;then sudo -u${USER} echo "PRIVACY_MODE=off" >> /etc/birdnet/birdnet.conf fi