adding update feature --untested from main

This commit is contained in:
Patrick McGuire
2021-10-14 17:21:57 -04:00
parent 6fb031433e
commit fe16926627
5 changed files with 1004 additions and 41 deletions
+11 -40
View File
@@ -92,6 +92,9 @@ create_necessary_dirs() {
[ -L ${EXTRACTED}/scripts ] || sudo -u ${USER} ln -s $(dirname ${my_dir})/scripts ${EXTRACTED}
[ -L ${EXTRACTED}/spectrogram.php ] || sudo -u ${USER} ln -s $(dirname ${my_dir})/scripts/spectrogram.* ${EXTRACTED}
[ -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() {
@@ -242,10 +245,6 @@ http://birdlog.local {
http://extractionlog.local {
reverse_proxy localhost:8888
}
http://birdstats.local {
reverse_proxy localhost:9090
}
EOF
systemctl reload caddy
}
@@ -272,9 +271,6 @@ ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(avahi-resolve -4 -n %H
WantedBy=multi-user.target
EOF
systemctl enable --now avahi-alias@birdnetpi.local.service
systemctl enable --now avahi-alias@birdlog.local.service
systemctl enable --now avahi-alias@extractionlog.local.service
systemctl enable --now avahi-alias@birdstats.local.service
}
install_spectrogram_service() {
@@ -335,35 +331,6 @@ ExecStart=/usr/local/bin/gotty -p 8888 --title-format "Extractions Log" journalc
WantedBy=multi-user.target
EOF
systemctl enable --now extraction_log.service
echo "Installing the birdstats.service"
cat << EOF > /etc/systemd/system/birdstats.service
[Unit]
Description=BirdNET Statistics Log
[Service]
Restart=on-failure
RestartSec=3
Type=simple
User=${USER}
Environment=TERM=xterm-256color
ExecStart=/usr/local/bin/gotty -p 9090 --title-format "BirdNET-Pi Statistics" tmux new -A -s birdstats /usr/local/bin/birdnet_stats.sh
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now birdstats.service
}
install_tmux() {
echo "Installing tmux dependencies"
apt -qqy install libevent-2* \
libevent-dev \
ncurses-bin \
ncurses-base \
ncurses-term \
libncurses-dev
cp $(dirname ${my_dir})/templates/tmux.conf /etc/tmux.conf
}
install_sox() {
@@ -381,7 +348,7 @@ install_php() {
if ! which pip &> /dev/null || ! which php-fpm7.3;then
echo "Installing PHP modules"
apt -qq update
apt install -qqy php php-fpm php7.3-mysql
apt install -qqy php php-fpm php7.3-mysql php-xml
else
echo "PHP and PHP-FPM installed"
fi
@@ -393,6 +360,11 @@ install_php() {
caddy ALL=(ALL) NOPASSWD: ALL
EOF
chmod 0440 /etc/sudoers.d/010_caddy-nopasswd
if [ -d ${HOME}/phpsysinfo ];then
echo "Fetching phpSysInfo"
sudo -u ${USER} git clone https://github.com/phpsysinfo/phpsysinfo.git \
${HOME}/phpsysinfo
fi
}
install_edit_birdnet_conf() {
@@ -406,7 +378,7 @@ RestartSec=3
Type=simple
User=pi
Environment=TERM=xterm-256color
ExecStart=/usr/local/bin/gotty -w -p 9898 --title-format "Edit birdnet.conf" tmux new -A -s editbirdnet nano /home/pi/BirdNET-Pi/birdnet.conf
ExecStart=/usr/local/bin/gotty -w -p 9898 --title-format "Edit birdnet.conf" nano /home/pi/BirdNET-Pi/birdnet.conf
[Install]
WantedBy=multi-user.target
@@ -501,7 +473,6 @@ install_selected_services() {
if [[ "${DO_EXTRACTIONS}" =~ [Yy] ]];then
install_extraction_service
create_necessary_dirs
fi
if [[ "${DO_RECORDING}" =~ [Yy] ]];then
@@ -520,7 +491,6 @@ install_selected_services() {
install_Caddyfile
install_avahi_aliases
install_gotty_logs
install_tmux
install_sox
install_mariadb
install_php
@@ -541,6 +511,7 @@ install_selected_services() {
install_systemd_overrides
fi
create_necessary_dirs
install_cleanup_cron
}