mirror of
https://github.com/hassio-addons/addon-phlex.git
synced 2025-05-04 11:11:28 +00:00
🔨 Rewrite to use bashio
This commit is contained in:
parent
2f230c47ab
commit
4a9cdd344e
5 changed files with 11 additions and 37 deletions
|
@ -1,26 +1,8 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bashio
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Community Hass.io Add-ons: Phlex
|
# Community Hass.io Add-ons: Phlex
|
||||||
# This files check if all user configuration requirements are met
|
# This files check if all user configuration requirements are met
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /usr/lib/hassio-addons/base.sh
|
|
||||||
|
|
||||||
# Check SSL requirements, if enabled
|
# Check SSL requirements, if enabled
|
||||||
if hass.config.true 'ssl'; then
|
bashio::config.require.ssl 'ssl' 'certfile' 'keyfile'
|
||||||
if ! hass.config.has_value 'certfile'; then
|
|
||||||
hass.die 'SSL is enabled, but no certfile was specified'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! hass.config.has_value 'keyfile'; then
|
|
||||||
hass.die 'SSL is enabled, but no keyfile was specified'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! hass.file_exists "/ssl/$(hass.config.get 'certfile')"; then
|
|
||||||
hass.die 'The configured certfile is not found'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! hass.file_exists "/ssl/$(hass.config.get 'keyfile')"; then
|
|
||||||
hass.die 'The configured keyfile is not found'
|
|
||||||
fi
|
|
||||||
fi
|
|
|
@ -1,12 +1,10 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bashio
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Community Hass.io Add-ons: Phlex
|
# Community Hass.io Add-ons: Phlex
|
||||||
# Configures Phlex
|
# Configures Phlex
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /usr/lib/hassio-addons/base.sh
|
|
||||||
|
|
||||||
if ! hass.file_exists '/data/config.php'; then
|
if ! bashio::fs.file_exists '/data/config.php'; then
|
||||||
cp /opt/default_config.php /data/config.php
|
cp /opt/default_config.php /data/config.php
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,26 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bashio
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Community Hass.io Add-ons: Phlex
|
# Community Hass.io Add-ons: Phlex
|
||||||
# Configures NGINX for use with Phlex
|
# Configures NGINX for use with Phlex
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /usr/lib/hassio-addons/base.sh
|
|
||||||
|
|
||||||
declare certfile
|
declare certfile
|
||||||
declare keyfile
|
declare keyfile
|
||||||
|
|
||||||
# Enable SSL
|
# Enable SSL
|
||||||
if hass.config.true 'ssl'; then
|
if bashio::config.true 'ssl'; then
|
||||||
rm /etc/nginx/nginx.conf
|
rm /etc/nginx/nginx.conf
|
||||||
mv /etc/nginx/nginx-ssl.conf /etc/nginx/nginx.conf
|
mv /etc/nginx/nginx-ssl.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
certfile=$(hass.config.get 'certfile')
|
certfile=$(bashio::.config 'certfile')
|
||||||
keyfile=$(hass.config.get 'keyfile')
|
keyfile=$(bashio::.config 'keyfile')
|
||||||
|
|
||||||
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx.conf
|
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx.conf
|
||||||
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx.conf
|
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disables IPv6 in case its disabled by the user
|
# Disables IPv6 in case its disabled by the user
|
||||||
if ! hass.config.true 'ipv6'; then
|
if ! bashio::config.true 'ipv6'; then
|
||||||
sed -i '/listen \[::\].*/ d' /etc/nginx/nginx.conf
|
sed -i '/listen \[::\].*/ d' /etc/nginx/nginx.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bashio
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Community Hass.io Add-ons: Phlex
|
# Community Hass.io Add-ons: Phlex
|
||||||
# Runs the NGINX daemon
|
# Runs the NGINX daemon
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /usr/lib/hassio-addons/base.sh
|
|
||||||
|
|
||||||
# Wait for PHP-FPM to become available
|
# Wait for PHP-FPM to become available
|
||||||
s6-svwait -u -t 5000 /var/run/s6/services/php-fpm
|
s6-svwait -u -t 5000 /var/run/s6/services/php-fpm
|
||||||
|
|
||||||
hass.log.info "Starting Phlex..."
|
bashio::log.info "Starting Phlex..."
|
||||||
exec nginx -g "daemon off;"
|
exec nginx -g "daemon off;"
|
||||||
|
|
|
@ -3,7 +3,5 @@
|
||||||
# Community Hass.io Add-ons: Phlex
|
# Community Hass.io Add-ons: Phlex
|
||||||
# Runs the PHP-FPM daemon
|
# Runs the PHP-FPM daemon
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /usr/lib/hassio-addons/base.sh
|
|
||||||
|
|
||||||
exec php-fpm7 --nodaemonize
|
exec php-fpm7 --nodaemonize
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue