diff --git a/home-panel/rootfs/etc/cont-init.d/10-requirements.sh b/home-panel/rootfs/etc/cont-init.d/10-requirements.sh new file mode 100644 index 0000000..a9442a4 --- /dev/null +++ b/home-panel/rootfs/etc/cont-init.d/10-requirements.sh @@ -0,0 +1,34 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Timmo Hass.io Add-ons: Home Panel +# This checks if all user configuration requirements are met +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +# Check SSL requirements, if enabled +if hass.config.true 'ssl'; then + 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 + +if ! hass.config.has_value 'config_file'; then + hass.die 'No config file was specified' +fi + +if ! hass.file_exists "/config/$(hass.config.get 'config_file')"; then + hass.die 'No config file was specified' +fi diff --git a/home-panel/rootfs/etc/cont-init.d/10-config.sh b/home-panel/rootfs/etc/cont-init.d/20-config.sh similarity index 94% rename from home-panel/rootfs/etc/cont-init.d/10-config.sh rename to home-panel/rootfs/etc/cont-init.d/20-config.sh index 4357d06..58932d0 100644 --- a/home-panel/rootfs/etc/cont-init.d/10-config.sh +++ b/home-panel/rootfs/etc/cont-init.d/20-config.sh @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash # ============================================================================== -# Community Hass.io Add-ons: Home Panel +# Timmo Hass.io Add-ons: Home Panel # This copies the configs to their respective locations # ============================================================================== # shellcheck disable=SC1091 diff --git a/home-panel/rootfs/etc/cont-init.d/20-nginx.sh b/home-panel/rootfs/etc/cont-init.d/30-nginx.sh similarity index 96% rename from home-panel/rootfs/etc/cont-init.d/20-nginx.sh rename to home-panel/rootfs/etc/cont-init.d/30-nginx.sh index 53c1c55..4cd2be9 100644 --- a/home-panel/rootfs/etc/cont-init.d/20-nginx.sh +++ b/home-panel/rootfs/etc/cont-init.d/30-nginx.sh @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash # ============================================================================== -# Community Hass.io Add-ons: Home Panel +# Timmo Hass.io Add-ons: Home Panel # This copies the nginx configs to their respective locations # ============================================================================== # shellcheck disable=SC1091 diff --git a/home-panel/rootfs/etc/cont-init.d/30-api.sh b/home-panel/rootfs/etc/cont-init.d/40-api.sh similarity index 94% rename from home-panel/rootfs/etc/cont-init.d/30-api.sh rename to home-panel/rootfs/etc/cont-init.d/40-api.sh index 7d85188..39832c5 100644 --- a/home-panel/rootfs/etc/cont-init.d/30-api.sh +++ b/home-panel/rootfs/etc/cont-init.d/40-api.sh @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash # ============================================================================== -# Community Hass.io Add-ons: Home Panel +# Timmo Hass.io Add-ons: Home Panel # This copies the api files to their respective locations # ============================================================================== # shellcheck disable=SC1091 diff --git a/home-panel/rootfs/etc/services.d/api/finish b/home-panel/rootfs/etc/services.d/api/finish index 77ac620..8255b6e 100644 --- a/home-panel/rootfs/etc/services.d/api/finish +++ b/home-panel/rootfs/etc/services.d/api/finish @@ -1,6 +1,6 @@ #!/usr/bin/execlineb -S0 # ============================================================================== -# Community Hass.io Add-ons: Home Panel +# Timmo Hass.io Add-ons: Home Panel # Take down the S6 supervision tree when Home Panel fails # ============================================================================== if -n { s6-test $# -ne 0 } diff --git a/home-panel/rootfs/etc/services.d/api/run b/home-panel/rootfs/etc/services.d/api/run index 617bd4e..1104f3e 100644 --- a/home-panel/rootfs/etc/services.d/api/run +++ b/home-panel/rootfs/etc/services.d/api/run @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash # ============================================================================== -# Community Hass.io Add-ons: Home Panel +# Timmo Hass.io Add-ons: Home Panel # Starts server to serve the api # ============================================================================== # shellcheck disable=SC1091 diff --git a/home-panel/rootfs/etc/services.d/config/finish b/home-panel/rootfs/etc/services.d/config/finish index 77ac620..8255b6e 100644 --- a/home-panel/rootfs/etc/services.d/config/finish +++ b/home-panel/rootfs/etc/services.d/config/finish @@ -1,6 +1,6 @@ #!/usr/bin/execlineb -S0 # ============================================================================== -# Community Hass.io Add-ons: Home Panel +# Timmo Hass.io Add-ons: Home Panel # Take down the S6 supervision tree when Home Panel fails # ============================================================================== if -n { s6-test $# -ne 0 } diff --git a/home-panel/rootfs/etc/services.d/config/run b/home-panel/rootfs/etc/services.d/config/run index f785e99..7c93f9d 100644 --- a/home-panel/rootfs/etc/services.d/config/run +++ b/home-panel/rootfs/etc/services.d/config/run @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash # ============================================================================== -# Community Hass.io Add-ons: Home Panel +# Timmo Hass.io Add-ons: Home Panel # Keeps the config file up to date # ============================================================================== # shellcheck disable=SC1091 diff --git a/home-panel/rootfs/etc/services.d/nginx/finish b/home-panel/rootfs/etc/services.d/nginx/finish index 77ac620..8255b6e 100644 --- a/home-panel/rootfs/etc/services.d/nginx/finish +++ b/home-panel/rootfs/etc/services.d/nginx/finish @@ -1,6 +1,6 @@ #!/usr/bin/execlineb -S0 # ============================================================================== -# Community Hass.io Add-ons: Home Panel +# Timmo Hass.io Add-ons: Home Panel # Take down the S6 supervision tree when Home Panel fails # ============================================================================== if -n { s6-test $# -ne 0 } diff --git a/home-panel/rootfs/etc/services.d/nginx/run b/home-panel/rootfs/etc/services.d/nginx/run index 42d73d8..2b62e9a 100644 --- a/home-panel/rootfs/etc/services.d/nginx/run +++ b/home-panel/rootfs/etc/services.d/nginx/run @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash # ============================================================================== -# Community Hass.io Add-ons: Home Panel +# Timmo Hass.io Add-ons: Home Panel # Starts server to serve the webapp # ============================================================================== # shellcheck disable=SC1091