Skip to content

Commit

Permalink
fixing labels.txt overwrite durring update
Browse files Browse the repository at this point in the history
  • Loading branch information
mcguirepr89 committed Feb 1, 2022
1 parent 7d9550d commit 8fdcfc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions scripts/update_birdnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ remove_scripts() {
remove_services
remove_scripts

# Backup labels.txt
sudo -u${USER} cp -f ~/BirdNET-Pi/model/labels.txt{,.bak}
# Stage 2 does a git pull to fetch new things
sudo -u${USER} git -C ${HOME}/BirdNET-Pi checkout -f
sudo -u${USER} git -C ${HOME}/BirdNET-Pi pull -f
Expand Down
5 changes: 4 additions & 1 deletion scripts/update_birdnet2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ my_dir=${HOME}/BirdNET-Pi/scripts
sudo ${my_dir}/update_services.sh

# Stage 1.5: adding new birdnet.conf entries
if ! grep FULL_DISK ${birdnet_conf};then
if ! grep FULL_DISK ${birdnet_conf} &> /dev/null;then
cat << EOF >> ${birdnet_conf}
## FULL_DISK can be set to configure how the system reacts to a full disk
Expand All @@ -18,6 +18,9 @@ FULL_DISK=purge
EOF
fi

# Replace Backup labels.txt
sudo -u${USER} cp -f ~/BirdNET-Pi/model/labels.txt.bak ~/BirdNET-Pi/model/labels.txt

# Stage 2 restarts the services
newservices=($(awk '/systemctl/ && !/php/ && !/caddy/ && !/target/ {print $3}' <(sed -e 's/--now//g' ${my_dir}/update_services.sh) | sort | uniq ))
for i in ${newservices[@]};do
Expand Down

0 comments on commit 8fdcfc1

Please sign in to comment.