From 9cfb2e46d6ed2880e2045a0e057b88bb20e3a424 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Fri, 15 Apr 2022 09:50:21 -0400 Subject: [PATCH] Update update_birdnet.sh --- scripts/update_birdnet.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/update_birdnet.sh b/scripts/update_birdnet.sh index 87301f9..a48e7d6 100755 --- a/scripts/update_birdnet.sh +++ b/scripts/update_birdnet.sh @@ -2,6 +2,8 @@ # Update BirdNET-Pi source /etc/birdnet/birdnet.conf trap '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/scripts sudo -u${USER} git -C $my_dir stash @@ -11,7 +13,7 @@ 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 + sed -si "1 i\\#\!$HOME/BirdNET-Pi/birdnet/bin/python3" $my_dir/*.py fi if ! grep PRIVACY_MODE /etc/birdnet/birdnet.conf;then sudo -u${USER} echo "PRIVACY_MODE=off" >> /etc/birdnet/birdnet.conf