adusting for bullseye mariadb versions
This commit is contained in:
@@ -51,7 +51,7 @@ stage_2() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
source ${my_dir}/Birders_Guide_Installer_Configuration.txt
|
source ${my_dir}/Birders_Guide_Installer_Configuration.txt
|
||||||
if [ -z ${LATITUDE} ] || [ -z ${LONGITUDE} ] || [ -z ${CADDY_PWD} ] || [ -z ${ICE_PWD} ] || [ -z ${DB_PWD} ] || [ -z ${DB_ROOT_PWD} ];then
|
if [ -z ${LATITUDE} ] || [ -z ${LONGITUDE} ] || [ -z ${CADDY_PWD} ] || [ -z ${ICE_PWD} ] || [ -z ${DB_PWD} ];then
|
||||||
echo
|
echo
|
||||||
echo "Follow the instructions to fill out the LATITUDE and LONGITUDE variables
|
echo "Follow the instructions to fill out the LATITUDE and LONGITUDE variables
|
||||||
and set the passwords for the live audio stream. Save the file after editing
|
and set the passwords for the live audio stream. Save the file after editing
|
||||||
|
|||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# This script performs the mysql_secure_installation
|
||||||
|
# Creates the birds database
|
||||||
|
# Creates the detections table
|
||||||
|
# Creates the birder user and grants them appropriate
|
||||||
|
# permissions
|
||||||
|
# If using this script to re-initialize (DROP then CREATE)
|
||||||
|
# the DB, be sure to run this as root or with sudo
|
||||||
|
source /etc/birdnet/birdnet.conf
|
||||||
|
DB_ROOT_PWD=staggerwontonpurporting
|
||||||
|
mysql_secure_installation << EOF
|
||||||
|
|
||||||
|
y
|
||||||
|
${DB_ROOT_PWD}
|
||||||
|
${DB_ROOT_PWD}
|
||||||
|
y
|
||||||
|
y
|
||||||
|
y
|
||||||
|
EOF
|
||||||
|
|
||||||
|
mysql << EOF
|
||||||
|
DROP DATABASE IF EXISTS birds;
|
||||||
|
CREATE DATABASE IF NOT EXISTS birds;
|
||||||
|
|
||||||
|
USE birds;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS detections (
|
||||||
|
Date DATE,
|
||||||
|
Time TIME,
|
||||||
|
Sci_Name VARCHAR(100) NOT NULL,
|
||||||
|
Com_Name VARCHAR(100) NOT NULL,
|
||||||
|
Confidence FLOAT,
|
||||||
|
Lat FLOAT,
|
||||||
|
Lon FLOAT,
|
||||||
|
Cutoff FLOAT,
|
||||||
|
Week INT,
|
||||||
|
Sens FLOAT,
|
||||||
|
Overlap FLOAT);
|
||||||
|
GRANT ALL ON birds.* TO 'birder'@'localhost' IDENTIFIED BY '${DB_PWD}' WITH GRANT OPTION;
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
exit
|
||||||
|
EOF
|
||||||
|
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
|
||||||
@@ -103,8 +103,6 @@ get_DB_PWDS() {
|
|||||||
if [ ! -z ${DB_PWD} ];then
|
if [ ! -z ${DB_PWD} ];then
|
||||||
read -p "Please set a password for your database: " DB_PWD
|
read -p "Please set a password for your database: " DB_PWD
|
||||||
echo
|
echo
|
||||||
read -p "Please set a root password for the database: " DB_ROOT_PWD
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +374,6 @@ RECORDING_LENGTH=
|
|||||||
EXTRACTION_LENGTH=
|
EXTRACTION_LENGTH=
|
||||||
|
|
||||||
DB_PWD=${DB_PWD}
|
DB_PWD=${DB_PWD}
|
||||||
DB_ROOT_PWD=${DB_ROOT_PWD}
|
|
||||||
|
|
||||||
LAST_RUN=$(dirname ${my_dir})/lastrun.txt
|
LAST_RUN=$(dirname ${my_dir})/lastrun.txt
|
||||||
THIS_RUN=$(dirname ${my_dir})/thisrun.txt
|
THIS_RUN=$(dirname ${my_dir})/thisrun.txt
|
||||||
|
|||||||
@@ -34,7 +34,12 @@ install_mariadb() {
|
|||||||
echo "MariaDB Installed"
|
echo "MariaDB Installed"
|
||||||
fi
|
fi
|
||||||
echo "Initializing the database"
|
echo "Initializing the database"
|
||||||
${my_dir}/createdb.sh
|
source /etc/os-release
|
||||||
|
if [[ "${VERSION_CODENAME}" == "buster" ]];then
|
||||||
|
${my_dir}/createdb_buster.sh
|
||||||
|
elif [[ "${VERSION_CODENAME}" == "bullseye" ]];then
|
||||||
|
${my_dir}/createdb_bullseye.sh
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_birdnet_analysis() {
|
install_birdnet_analysis() {
|
||||||
|
|||||||
@@ -24,11 +24,6 @@ sed -i s/'^DB_PWD=.*'/"DB_PWD=${db_pwd}"/g ${birdnet_conf}
|
|||||||
${birdnetpi_dir}/scripts/update_db_pwd.sh
|
${birdnetpi_dir}/scripts/update_db_pwd.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -z ${db_root_pwd} ];then
|
|
||||||
exit 1 #for now
|
|
||||||
sed -i s/'^DB_ROOT_PWD=.*'/"DB_ROOT_PWD=${db_root_pwd}"/g ${birdnet_conf}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [ -z ${birdnetpi_url} ];then
|
if ! [ -z ${birdnetpi_url} ];then
|
||||||
sed -i s/'^BIRDNETPI_URL=.*'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
sed -i s/'^BIRDNETPI_URL=.*'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||||
sed -i s/'^EXTRACTIONLOG_URL=.*'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
sed -i s/'^EXTRACTIONLOG_URL=.*'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||||
|
|||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Update database password
|
||||||
|
source /etc/birdnet/birdnet.conf
|
||||||
|
|
||||||
|
sudo mysql -e "
|
||||||
|
SET PASSWORD FOR 'birder'@'localhost' = PASSWORD('${DB_PWD}');
|
||||||
|
FLUSH PRIVILEGES";
|
||||||
|
git -C /home/pi/BirdNET-Pi checkout -f analyze.py
|
||||||
|
git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
||||||
|
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
|
||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Update database password
|
||||||
|
source /etc/birdnet/birdnet.conf
|
||||||
|
|
||||||
|
sudo mysql -e "
|
||||||
|
UPDATE mysql.user
|
||||||
|
SET Password=PASSWORD('${DB_PWD}')
|
||||||
|
WHERE USER='birder'
|
||||||
|
AND Host='localhost';
|
||||||
|
FLUSH PRIVILEGES";
|
||||||
|
git -C /home/pi/BirdNET-Pi checkout -f analyze.py
|
||||||
|
git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
||||||
|
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
|
||||||
@@ -33,7 +33,12 @@ install_mariadb() {
|
|||||||
apt -qqy install mariadb-server
|
apt -qqy install mariadb-server
|
||||||
echo "MariaDB Installed"
|
echo "MariaDB Installed"
|
||||||
fi
|
fi
|
||||||
${my_dir}/update_db_pwd.sh
|
source /etc/os-release
|
||||||
|
if [[ "${VERSION_CODENAME}" == "buster" ]];then
|
||||||
|
${my_dir}/update_db_pwd_buster.sh
|
||||||
|
elif [[ "${VERSION_CODENAME}" == "bullseye" ]];then
|
||||||
|
${my_dir}/update_db_pwd_bullseye.sh
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_birdnet_analysis() {
|
install_birdnet_analysis() {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ sed -i s/'^LONGITUDE=$'/"LONGITUDE=${new_lon}"/g ${birders_conf}
|
|||||||
sed -i s/'^CADDY_PWD=$'/"CADDY_PWD=${caddy_pwd}"/g ${birders_conf}
|
sed -i s/'^CADDY_PWD=$'/"CADDY_PWD=${caddy_pwd}"/g ${birders_conf}
|
||||||
sed -i s/'^ICE_PWD=$'/"ICE_PWD=${ice_pwd}"/g ${birders_conf}
|
sed -i s/'^ICE_PWD=$'/"ICE_PWD=${ice_pwd}"/g ${birders_conf}
|
||||||
sed -i s/'^DB_PWD=$'/"DB_PWD=${db_pwd}"/g ${birders_conf}
|
sed -i s/'^DB_PWD=$'/"DB_PWD=${db_pwd}"/g ${birders_conf}
|
||||||
sed -i s/'^DB_ROOT_PWD=$'/"DB_ROOT_PWD=${db_root_pwd}"/g ${birders_conf}
|
|
||||||
sed -i s/'^BIRDNETPI_URL=$'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
sed -i s/'^BIRDNETPI_URL=$'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
||||||
sed -i s/'^EXTRACTIONLOG_URL=$'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
sed -i s/'^EXTRACTIONLOG_URL=$'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
||||||
sed -i s/'^BIRDNETLOG_URL=$'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
sed -i s/'^BIRDNETLOG_URL=$'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
||||||
|
|||||||
Reference in New Issue
Block a user