Skip to content

A live bird collage card for your Home Assistant dashboard.

testing new updater -- not for general testing

Patrick McGuire25fed66ae5cd
diff --git a/scripts/install_services.sh b/scripts/install_services.sh
index 388e0292..e090b71e 100755
--- a/scripts/install_services.sh
+++ b/scripts/install_services.sh
@@ -90,7 +90,7 @@ ExecStart=/usr/local/bin/species_notifier.sh
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now pushed_notifications
+ systemctl enable pushed_notifications.service
}
create_necessary_dirs() {
@@ -234,7 +234,7 @@ ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(avahi-resolve -4 -n %H
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now [email protected]
+ systemctl enable [email protected]
}
install_spectrogram_service() {
@@ -250,7 +250,7 @@ ExecStart=/usr/local/bin/spectrogram.sh
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now spectrogram_viewer.service
+ systemctl enable spectrogram_viewer.service
}
install_gotty_logs() {
@@ -277,7 +277,7 @@ ExecStart=/usr/local/bin/gotty -p 8080 --title-format "BirdNET-Pi Log" journalct
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now birdnet_log.service
+ systemctl enable birdnet_log.service
echo "Installing the extraction_log.service"
cat << EOF > /etc/systemd/system/extraction_log.service
[Unit]
@@ -294,7 +294,7 @@ ExecStart=/usr/local/bin/gotty -p 8888 --title-format "Extractions Log" journalc
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now extraction_log.service
+ systemctl enable extraction_log.service
}
install_sox() {
@@ -357,12 +357,12 @@ install_icecast() {
echo "icecast2 icecast2/icecast-setup boolean false" | debconf-set-selections
apt install -qqy icecast2
config_icecast
- systemctl enable --now icecast2
+ systemctl enable icecast2.service
/etc/init.d/icecast2 start
else
echo "Icecast2 is installed"
config_icecast
- systemctl enable --now icecast2
+ systemctl enable icecast2.service
/etc/init.d/icecast2 start
fi
}
@@ -395,7 +395,7 @@ ExecStart=/usr/local/bin/livestream.sh
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now livestream.service
+ systemctl enable livestream.service
}
install_nomachine() {
diff --git a/scripts/update_birdnet.sh b/scripts/update_birdnet.sh
index aeb041dd..96792ba4 100755
--- a/scripts/update_birdnet.sh
+++ b/scripts/update_birdnet.sh
@@ -8,69 +8,7 @@ HOME=/home/pi
my_dir=${HOME}/BirdNET-Pi/scripts
tmpfile=$(mktemp)
-scripts=(birdnet_analysis.sh
-birdnet_recording.sh
-birdnet_stats.sh
-cleanup.sh
-clear_all_data.php
-clear_all_data.sh
-createdb.sh
-disk_usage.sh
-dump_logs.sh
-edit_birdnet.conf.php
-edit_birdnet.conf.sh
-extract_new_birdsounds.sh
-install_birdnet.sh
-install_config.sh
-install_services.sh
-install_tmux_services.sh
-install_zram_service.sh
-livestream.sh
-pretty_date.sh
-reboot_system.php
-reboot_system.sh
-reconfigure_birdnet.sh
-restart_birdnet_analysis.php
-restart_birdnet_analysis.sh
-restart_birdnet_recording.php
-restart_birdnet_recording.sh
-restart_caddy.php
-restart_caddy.sh
-restart_extraction.php
-restart_extraction.sh
-restart_services.php
-restart_services.sh
-shutdown_system.php
-shutdown_system.sh
-species_notifier.sh
-spectrogram.php
-spectrogram.sh
-tmux
-uninstall.sh
-update_species.sh
-${HOME}/.gotty)
-
-
-# Change this to sourcing from current uninstall.sh
-# Create a pre-update services array for disabling
-# Create a post-update services array for restarting
-birdnet_analysis.service
-birdnet_log.service
-birdnet_recording.service
-birdstats.service
-birdterminal.service
-edit_birdnet_conf.service
-extraction_log.service
-extraction.service
-extraction.timer
-livestream.service
-pushed_notifications.service
-spectrogram_viewer.service)
+services=$(awk '/service/ && /systemctl/ && !/php/ {print $3}' ${my_dir}/install_services.sh | sort)
remove_services() {
for i in "${services[@]}"; do
@@ -109,34 +47,12 @@ remove_scripts() {
done
}
-restart_services() {
- for i in ${services[@]};do
- sudo systemctl restart ${i}
- done
-}
-
# Stage 1 removes old stuff
remove_services
remove_scripts
# Stage 2 does a git pull to fetch new things
-sudo -u${USER} git -C ${HOME}/BirdNET-Pi pull || exit 1
-
-# Stage 3 updates the services
-sudo ${my_dir}/update_services.sh
-
-# Stage 4 restarts the services
-birdnet_analysis.service
-birdnet_log.service
-birdnet_recording.service
-edit_birdnet_conf.service
-extraction_log.service
-extraction.service
-extraction.timer
-livestream.service
-pushed_notifications.service
-spectrogram_viewer.service)
-
-restart_services
+sudo -u${USER} git -C ${HOME}/BirdNET-Pi pull -f || exit 1
+# Trigger the new update_birdnet2.sh
+sudo -u${USER} ${my_dir}/update_birdnet2.sh
diff --git a/scripts/update_birdnet2.sh b/scripts/update_birdnet2.sh
new file mode 100644
index 00000000..2926e69c
--- /dev/null
+++ b/scripts/update_birdnet2.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+# Second stage of update
+
+
+# Stage 1 updates the services
+my_dir=${HOME}/BirdNET-Pi/scripts
+sudo ${my_dir}/update_services.sh
+
+# Stage 2 restarts the services
+birdnet_analysis.service
+birdnet_log.service
+birdnet_recording.service
+edit_birdnet_conf.service
+extraction_log.service
+extraction.service
+extraction.timer
+livestream.service
+pushed_notifications.service
+spectrogram_viewer.service)
+
+restart_services() {
+ for i in ${services[@]};do
+ sudo systemctl restart ${i}
+ done
+}
+
+restart_services
diff --git a/scripts/update_services.sh b/scripts/update_services.sh
index 97e3b4c5..15d2cfa0 100755
--- a/scripts/update_services.sh
+++ b/scripts/update_services.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# This installs the services that have been selected
+# This reinstalls the services
#set -x # Uncomment to enable debugging
trap 'rm -f ${tmpfile}' EXIT
trap 'exit 1' SIGINT SIGHUP
@@ -24,6 +24,8 @@ install_mariadb() {
apt -qqy install mariadb-server
echo "MariaDB Installed"
fi
+ sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
+ sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewdb.php
}
install_birdnet_analysis() {
@@ -88,7 +90,7 @@ ExecStart=/usr/local/bin/species_notifier.sh
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now pushed_notifications
+ systemctl enable pushed_notifications.service
}
create_necessary_dirs() {
@@ -104,7 +106,6 @@ create_necessary_dirs() {
[ -L ${EXTRACTED}/viewdb.php ] || sudo -u ${USER} ln -s $(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
-
}
install_alsa() {
@@ -232,7 +233,7 @@ ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(avahi-resolve -4 -n %H
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now [email protected]
+ systemctl enable [email protected]
}
install_spectrogram_service() {
@@ -248,7 +249,7 @@ ExecStart=/usr/local/bin/spectrogram.sh
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now spectrogram_viewer.service
+ systemctl enable spectrogram_viewer.service
}
install_gotty_logs() {
@@ -275,7 +276,7 @@ ExecStart=/usr/local/bin/gotty -p 8080 --title-format "BirdNET-Pi Log" journalct
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now birdnet_log.service
+ systemctl enable birdnet_log.service
echo "Installing the extraction_log.service"
cat << EOF > /etc/systemd/system/extraction_log.service
[Unit]
@@ -292,7 +293,7 @@ ExecStart=/usr/local/bin/gotty -p 8888 --title-format "Extractions Log" journalc
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now extraction_log.service
+ systemctl enable extraction_log.service
}
install_sox() {
@@ -354,12 +355,12 @@ install_icecast() {
echo "icecast2 icecast2/icecast-setup boolean false" | debconf-set-selections
apt install -qqy icecast2
config_icecast
- systemctl enable --now icecast2
+ systemctl enable icecast2.service
/etc/init.d/icecast2 start
else
echo "Icecast2 is installed"
config_icecast
- systemctl enable --now icecast2
+ systemctl enable icecast2.service
/etc/init.d/icecast2 start
fi
}
@@ -392,7 +393,7 @@ ExecStart=/usr/local/bin/livestream.sh
[Install]
WantedBy=multi-user.target
EOF
- systemctl enable --now livestream.service
+ systemctl enable livestream.service
}
install_nomachine() {