diff --git a/scripts/update_services.sh b/scripts/update_services.sh index 9b65664..18dbb4f 100755 --- a/scripts/update_services.sh +++ b/scripts/update_services.sh @@ -131,7 +131,13 @@ create_necessary_dirs() { fi sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED} - if [ ! -z ${BIRDNETPI_URL} ];then + if [ -z ${BIRDNETPI_URL} ];then + sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/homepage/*.html + phpfiles="$(grep -l birdnetpi.local ${my_dir}/*.php)" + for i in "${phpfiles[@]}";do + sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" ${i} + done + else BIRDNETPI_URL="$(echo ${BIRDNETPI_URL} | sed 's/\/\//\\\/\\\//g')" sudo -u${USER} sed -i "s/http:\/\/$(hostname).local/"${BIRDNETPI_URL}"/g" $(dirname ${my_dir})/homepage/*.html phpfiles="$(grep -l $(hostname).local ${my_dir}/*.php)"