mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-02 22:04:06 +02:00
Improve logic
This commit is contained in:
@@ -13,22 +13,22 @@ fi
|
|||||||
|
|
||||||
# Define slug
|
# Define slug
|
||||||
slug="${HOSTNAME/-/_}"
|
slug="${HOSTNAME/-/_}"
|
||||||
|
slug="${slug#*_}"
|
||||||
|
|
||||||
# Check type of config folder
|
# Check type of config folder
|
||||||
if [ ! -f /config/configuration.yaml ] && [ ! -f /config/configuration.json ]; then
|
if [ ! -f /config/configuration.yaml ] && [ ! -f /config/configuration.json ]; then
|
||||||
# New config location
|
# New config location
|
||||||
CONFIGLOCATION="/config"
|
CONFIGLOCATION="/config"
|
||||||
CONFIGFILEBROWSER="/addon_configs/$slug/${HOSTNAME#*_}.sh"
|
CONFIGFILEBROWSER="/addon_configs/${HOSTNAME/-/_}/$slug.sh"
|
||||||
else
|
else
|
||||||
# Legacy config location
|
# Legacy config location
|
||||||
slug="${HOSTNAME#*_}"
|
|
||||||
CONFIGLOCATION="/config/addons_autoscripts"
|
CONFIGLOCATION="/config/addons_autoscripts"
|
||||||
CONFIGFILEBROWSER="/homeassistant/addons_autoscripts/${slug}.sh"
|
CONFIGFILEBROWSER="/homeassistant/addons_autoscripts/$slug.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Default location
|
# Default location
|
||||||
mkdir -p "$CONFIGLOCATION" || true
|
mkdir -p "$CONFIGLOCATION" || true
|
||||||
CONFIGSOURCE="$CONFIGLOCATION/${HOSTNAME#*_}.sh"
|
CONFIGSOURCE="$CONFIGLOCATION/$slug.sh"
|
||||||
|
|
||||||
bashio::log.green "Execute $CONFIGFILEBROWSER if existing"
|
bashio::log.green "Execute $CONFIGFILEBROWSER if existing"
|
||||||
bashio::log.green "Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation"
|
bashio::log.green "Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation"
|
||||||
|
|||||||
Reference in New Issue
Block a user