mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-19 11:27:21 +02:00
Merge pull request #2842 from alexbelgium/agent/fix-birdnet-pi-standalone-startup
Fix BirdNET-Pi standalone startup without D-Bus
This commit is contained in:
@@ -4,12 +4,12 @@
|
|||||||
# Correct /config permissions after startup
|
# Correct /config permissions after startup
|
||||||
chown pi:pi /config
|
chown pi:pi /config
|
||||||
|
|
||||||
# Waiting for dbus
|
# Set timezone without requiring Home Assistant Supervisor or D-Bus.
|
||||||
until [[ -e /var/run/dbus/system_bus_socket ]]; do
|
TZ_VALUE="${TZ:-}"
|
||||||
sleep 1s
|
if [[ -S /var/run/dbus/system_bus_socket ]] && command -v timedatectl > /dev/null 2>&1; then
|
||||||
done
|
TZ_VALUE="$(timedatectl show -p Timezone --value 2> /dev/null || true)"
|
||||||
|
fi
|
||||||
|
export TZ="${TZ_VALUE:-Etc/UTC}"
|
||||||
|
|
||||||
TZ_VALUE="$(timedatectl show -p Timezone --value)"
|
|
||||||
export TZ="$TZ_VALUE"
|
|
||||||
echo "Starting service: php pfm"
|
echo "Starting service: php pfm"
|
||||||
exec /usr/sbin/php-fpm* -F
|
exec /usr/sbin/php-fpm* -F
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# Waiting for dbus
|
# Waiting for dbus
|
||||||
until [[ -e /var/run/dbus/system_bus_socket ]]; do
|
until [[ -e /var/run/dbus/system_bus_socket ]]; do
|
||||||
|
|||||||
@@ -1,25 +1,29 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
# Dependencies
|
# Wait for PHP-FPM only. D-Bus is optional in standalone Docker mode and must
|
||||||
sockfile="empty"
|
# not prevent the web service from starting.
|
||||||
until [[ -e /var/run/dbus/system_bus_socket ]] && [[ -e "$sockfile" ]]; do
|
sockfile=""
|
||||||
|
until [[ -n "$sockfile" ]] && [[ -e "$sockfile" ]]; do
|
||||||
sleep 1s
|
sleep 1s
|
||||||
sockfile="$(find /run/php -name "*.sock")"
|
sockfile="$(find /run/php -name "*.sock" -print -quit 2> /dev/null || true)"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Correct fpm.sock
|
# Correct fpm.sock
|
||||||
chown caddy:caddy /run/php/php*-fpm.sock
|
chown caddy:caddy "$sockfile"
|
||||||
sed -i "s|/run/php/php-fpm.sock|$sockfile|g" /helpers/caddy_ingress.sh
|
sed -i "s|/run/php/php-fpm.sock|$sockfile|g" /helpers/caddy_ingress.sh
|
||||||
sed -i "s|/run/php/php-fpm.sock|$sockfile|g" /etc/caddy/Caddyfile
|
sed -i "s|/run/php/php-fpm.sock|$sockfile|g" /etc/caddy/Caddyfile
|
||||||
sed -i "s|/run/php/php-fpm.sock|$sockfile|g" "$HOME"/BirdNET-Pi/scripts/update_caddyfile.sh
|
sed -i "s|/run/php/php-fpm.sock|$sockfile|g" "$HOME"/BirdNET-Pi/scripts/update_caddyfile.sh
|
||||||
|
|
||||||
# Set timezone
|
# Set timezone without requiring D-Bus.
|
||||||
TZ_VALUE="$(timedatectl show -p Timezone --value)"
|
TZ_VALUE="${TZ:-}"
|
||||||
export TZ="$TZ_VALUE"
|
if [[ -S /var/run/dbus/system_bus_socket ]] && command -v timedatectl > /dev/null 2>&1; then
|
||||||
|
TZ_VALUE="$(timedatectl show -p Timezone --value 2> /dev/null || true)"
|
||||||
|
fi
|
||||||
|
export TZ="${TZ_VALUE:-Etc/UTC}"
|
||||||
|
|
||||||
# Update caddyfile with password
|
# Update caddyfile with password
|
||||||
/."$HOME"/BirdNET-Pi/scripts/update_caddyfile.sh &> /dev/null || true
|
"$HOME"/BirdNET-Pi/scripts/update_caddyfile.sh &> /dev/null || true
|
||||||
|
|
||||||
echo "Starting service: caddy"
|
echo "Starting service: caddy"
|
||||||
/usr/bin/caddy run --config /etc/caddy/Caddyfile
|
exec /usr/bin/caddy run --config /etc/caddy/Caddyfile
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user