Avoid root as user

https://github.com/alexbelgium/hassio-addons/issues/1197
This commit is contained in:
Alexandre
2024-01-22 22:10:34 +01:00
committed by GitHub
parent f7a44b8be5
commit fe4529e316

View File

@@ -31,6 +31,18 @@ for k in $(bashio::jq "/data/options.json" 'keys | .[]'); do
export "$k"="$(bashio::config "$k")"
done
##############
# Check PUID #
##############
bashio::log.info "Checking user type"
if [ "$PUID" = 0 ] || [ "$PGID" = 0 ]; then
bashio::log.warning "Can't run as root, the user will be set to 1000:1000"
bashio::addon.option "PUID" "1000"
bashio::addon.option "PGID" "1000"
bashio::addon.restart
fi
###############
# CONFIG YAML #
###############