Rollback code to 2.17.1-2

https://github.com/alexbelgium/hassio-addons/issues/745
This commit is contained in:
Alexandre
2023-03-08 13:44:07 +01:00
parent 1fdb5b9fb1
commit 6d735ad084
24 changed files with 71 additions and 90 deletions

View File

@@ -0,0 +1,9 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Take down the S6 supervision tree when Nginx fails
# ==============================================================================
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,12 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
bashio::log.info "Waiting for port 9000 to open..."
# Wait for transmission to become available
bashio::net.wait_for 9000 localhost 900
bashio::log.info "Starting NGinx..."
exec nginx

View File

@@ -0,0 +1,9 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Home Assistant Community Add-on: Portainer
# Take down the S6 supervision tree when Portainer fails
# ==============================================================================
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,87 @@
#!/usr/bin/env bashio
# shellcheck shell=bash
bashio::log.info "Starting Portainer..."
##################
# DEFINE OPTIONS #
##################
declare -a options
options+=(--data /data)
options+=(--bind 0.0.0.0:9000)
#options+=(--templates /opt/portainer/templates.json)
options+=(--host unix:///var/run/docker.sock)
##############
# SSL CONFIG #
##############
bashio::config.require.ssl
if bashio::config.true 'ssl'; then
bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths"
#set variables
CERTFILE="$(bashio::config 'certfile')"
KEYFILE="$(bashio::config 'keyfile')"
options+=(--sslcert /ssl/$CERTFILE)
options+=(--sslkey /ssl/$KEYFILE)
bashio::log.info "... ssl activated"
fi
################
# SET PASSWORD #
################
# Set password
CURRENTPASSWORD=""
PASSWORD=$(bashio::config 'password')
if ! bashio::config.has_value 'password'; then
PASSWORD="empty"
fi
touch "/data/portainer_password"
CURRENTPASSWORD=$( cat /data/portainer_password )
# Reset password if not first run
if bashio::fs.file_exists "/data/hidden"; then
if [ "$CURRENTPASSWORD" != "$PASSWORD" ]; then
mv -f /data/portainer.db /data/portainer.old || true
rm /data/hidden || true
bashio::log.warning "... password changed, database reseted. Previous version stored in /data/portainer.old"
fi
fi
# Define option
if bashio::config.has_value 'password' ; then
echo -n $PASSWORD > /data/portainer_password
options+=(--admin-password-file /data/portainer_password)
bashio::log.info "... password set to $PASSWORD"
else
echo -n $PASSWORD > /data/portainer_password
bashio::log.info "... starting without predefined password"
fi
###################
# HIDE CONTAINERS #
###################
# Hide Hassio containers by default, but only enforce on first run
if ! bashio::fs.file_exists "/data/hidden"; then
options+=(--hide-label io.hass.type=supervisor)
options+=(--hide-label io.hass.type=homeassistant)
options+=(--hide-label io.hass.type=base)
options+=(--hide-label io.hass.type=core)
# options+=(--hide-label io.hass.type=addon)
options+=(--hide-label io.hass.type=audio)
options+=(--hide-label io.hass.type=cli)
options+=(--hide-label io.hass.type=dns)
options+=(--hide-label io.hass.type=multicast)
options+=(--hide-label io.hass.type=observer)
bashio::log.info "... non-addon containers hidden"
touch /data/hidden
fi
####################
# LAUNCH PORTAINER #
####################
bashio::log.info "... portainer launched"
exec /opt/portainer/portainer "${options[@]}"