changes that remove the default pi user

This commit is contained in:
mcguirepr89
2022-04-11 17:29:00 -04:00
parent 6495284d21
commit f69f04d19d
24 changed files with 169 additions and 153 deletions
+28 -22
View File
@@ -3,7 +3,10 @@
# starting all data-collection from scratch. Only run this if you are sure
# you are okay will losing all the data that you've collected and processed
# so far.
set -x
source /etc/birdnet/birdnet.conf
USER=$(awk -F: '/1000/ {print $1}' /etc/passwd)
HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)
my_dir=${HOME}/BirdNET-Pi/scripts
echo "Stopping services"
sudo systemctl stop birdnet_recording.service
@@ -14,32 +17,35 @@ sudo rm -drf "${RECS_DIR}"
sudo rm -f "${IDFILE}"
sudo rm -f $(dirname ${my_dir})/BirdDB.txt
echo "Creating necessary directories"
[ -d ${EXTRACTED} ] || mkdir -p ${EXTRACTED}
[ -d ${EXTRACTED}/By_Date ] || mkdir -p ${EXTRACTED}/By_Date
[ -d ${EXTRACTED}/Charts ] || mkdir -p ${EXTRACTED}/Charts
[ -d ${PROCESSED} ] || mkdir -p ${PROCESSED}
echo "Re-creating necessary directories"
[ -d ${EXTRACTED} ] || sudo -u ${USER} mkdir -p ${EXTRACTED}
[ -d ${EXTRACTED}/By_Date ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Date
[ -d ${EXTRACTED}/Charts ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/Charts
[ -d ${PROCESSED} ] || sudo -u ${USER} mkdir -p ${PROCESSED}
sudo -u ${USER} ln -fs $(dirname $my_dir)/exclude_species_list.txt $my_dir
sudo -u ${USER} ln -fs $(dirname $my_dir)/include_species_list.txt $my_dir
sudo -u ${USER} ln -fs $(dirname $my_dir)/homepage/* ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname $my_dir)/model/labels.txt ${my_dir}
sudo -u ${USER} ln -fs $my_dir ${EXTRACTED}
sudo -u ${USER} ln -fs $my_dir/play.php ${EXTRACTED}
sudo -u ${USER} ln -fs $my_dir/spectrogram.php ${EXTRACTED}
sudo -u ${USER} ln -fs $my_dir/overview.php ${EXTRACTED}
sudo -u ${USER} ln -fs $my_dir/stats.php ${EXTRACTED}
sudo -u ${USER} ln -fs $my_dir/todays_detections.php ${EXTRACTED}
sudo -u ${USER} ln -fs $my_dir/history.php ${EXTRACTED}
sudo -u ${USER} ln -fs $my_dir/homepage/images/favicon.ico ${EXTRACTED}
sudo -u ${USER} ln -fs ${HOME}/phpsysinfo ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname $my_dir)/templates/phpsysinfo.ini ${HOME}/phpsysinfo/
sudo -u ${USER} ln -fs $(dirname $my_dir)/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/
sudo -u ${USER} ln -fs $(dirname $my_dir)/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html
chmod -R g+rw $my_dir
chmod -R g+rw ${RECS_DIR}
ln -fs $(dirname ${my_dir})/homepage/* ${EXTRACTED}
ln -fs $(dirname ${my_dir})/model/labels.txt ${my_dir}/
ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED}
ln -fs $(dirname ${my_dir})/scripts/play.php ${EXTRACTED}
ln -fs $(dirname ${my_dir})/scripts/spectrogram.php ${EXTRACTED}
ln -fs $(dirname ${my_dir})/scripts/overview.php ${EXTRACTED}
ln -fs $(dirname ${my_dir})/scripts/stats.php ${EXTRACTED}
ln -fs $(dirname ${my_dir})/scripts/todays_detections.php ${EXTRACTED}
ln -fs $(dirname ${my_dir})/scripts/history.php ${EXTRACTED}
ln -fs $(dirname ${my_dir})/homepage/images/favicon.ico ${EXTRACTED}
ln -fs ${HOME}/phpsysinfo ${EXTRACTED}
ln -fs $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phpsysinfo/
ln -fs $(dirname ${my_dir})/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/
ln -fs $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html
sudo chmod -R g+rw $(dirname ${my_dir})
sudo chmod -R g+rw ${EXTRACTED}
echo "Dropping and re-creating database"
createdb.sh
echo "Generating BirdDB.txt"
echo "Re-generating BirdDB.txt"
touch $(dirname ${my_dir})/BirdDB.txt
echo "Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap" > $(dirname ${my_dir})/BirdDB.txt
ln -sf $(dirname ${my_dir})/BirdDB.txt ${my_dir}/BirdDB.txt