mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
Allow version without HA support
This commit is contained in:
@@ -4,7 +4,7 @@ set -e
|
||||
# ==============================================================================
|
||||
# Displays a simple add-on banner on startup
|
||||
# ==============================================================================
|
||||
if bashio::supervisor.ping; then
|
||||
if bashio::supervisor.ping 2>/dev/null; then
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
||||
@@ -39,23 +39,30 @@ if bashio::supervisor.ping; then
|
||||
' Provided by: https://github.com/alexbelgium/hassio-addons '
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# Global actions for all addons
|
||||
# ==============================================================================
|
||||
if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then
|
||||
bashio::log.green \
|
||||
' Defining permissions for main user : '
|
||||
PUID="$(bashio::config "PUID")"
|
||||
PGID="$(bashio::config "PGID")"
|
||||
bashio::log.blue "User UID: $PUID"
|
||||
bashio::log.blue "User GID : $PGID"
|
||||
id -u abc &>/dev/null || usermod -o -u "$PUID" abc &>/dev/null || true
|
||||
id -g abc &>/dev/null || groupmod -o -g "$PGID" abc &>/dev/null || true
|
||||
# ==============================================================================
|
||||
# Global actions for all addons
|
||||
# ==============================================================================
|
||||
if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then
|
||||
bashio::log.green \
|
||||
' Defining permissions for main user : '
|
||||
PUID="$(bashio::config "PUID")"
|
||||
PGID="$(bashio::config "PGID")"
|
||||
bashio::log.blue "User UID: $PUID"
|
||||
bashio::log.blue "User GID : $PGID"
|
||||
id -u abc &>/dev/null || usermod -o -u "$PUID" abc &>/dev/null || true
|
||||
id -g abc &>/dev/null || groupmod -o -g "$PGID" abc &>/dev/null || true
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
fi
|
||||
|
||||
# Clean bashrc file
|
||||
if [ -f ~/.bashrc ]; then rm ~/.bashrc; fi
|
||||
|
||||
else
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue " Starting addon without HA support"
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
fi
|
||||
|
||||
# Clean bashrc file
|
||||
if [ -f ~/.bashrc ]; then rm ~/.bashrc; fi
|
||||
|
||||
Reference in New Issue
Block a user