Fix time in config.php

This commit is contained in:
Alexandre
2024-10-07 10:58:32 +02:00
committed by GitHub
parent 903116b261
commit f274e2f257

View File

@@ -73,6 +73,12 @@ mv /helpers/timedatectl /usr/bin/timedatectl
chown pi:pi /usr/bin/timedatectl
chmod a+x /usr/bin/timedatectl
# Correct timezone showing in config.php
sed -i -e '/<option disabled selected>/s/selected//' \
-e '/\$current_timezone = trim(shell_exec("timedatectl show --value --property=Timezone"));/d' \
-e "/\$date = new DateTime('now');/i \$current_timezone = trim(shell_exec(\"timedatectl show --value --property=Timezone\"));" \
-e "/\$date = new DateTime('now');/i date_default_timezone_set(\$current_timezone);" "$HOME/BirdNET-Pi/scripts/config.php"
# Correct language labels according to birdnet.conf
echo "... adapting labels according to birdnet.conf"
export "$(grep "^DATABASE_LANG" /config/birdnet.conf)" || bashio::log.warning "DATABASE_LANG not found in configuration. Using default labels."