mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-06 21:22:29 +02:00
Improve ID setting
https://github.com/alexbelgium/hassio-addons/issues/1879
This commit is contained in:
@@ -68,20 +68,14 @@ bashio::log.blue \
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Global actions for all addons
|
# Global actions for all addons
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then
|
if bashio::config.has_value "PUID" && bashio::config.has_value "PGID" && id abc &>/dev/null; then
|
||||||
bashio::log.green ' Defining permissions for main user : '
|
bashio::log.green ' Defining permissions for main user : '
|
||||||
PUID="$(bashio::config "PUID")"
|
PUID="$(bashio::config "PUID")"
|
||||||
PGID="$(bashio::config "PGID")"
|
PGID="$(bashio::config "PGID")"
|
||||||
bashio::log.blue "User UID: $PUID"
|
usermod -o -u "$PUID" abc
|
||||||
bashio::log.blue "User GID: $PGID"
|
groupmod -o -g "$PGID" abc
|
||||||
|
bashio::log.blue "User UID: $(id -u abc)"
|
||||||
# Only modify user/group if they exist
|
bashio::log.blue "User GID: $(id -g abc)"
|
||||||
if id abc &>/dev/null; then
|
|
||||||
usermod -o -u "$PUID" abc &>/dev/null
|
|
||||||
fi
|
|
||||||
if getent group abc &>/dev/null; then
|
|
||||||
groupmod -o -g "$PGID" abc &>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
|
|||||||
Reference in New Issue
Block a user