Skip to content

Commit

Permalink
Set HOME directory for created user
Browse files Browse the repository at this point in the history
s6-setuidgid does not change the environment, so HOME is still set to
root's home directory.
See just-containers/s6-overlay#207

Fixes #20
  • Loading branch information
tribut committed Apr 9, 2021
1 parent 173d9b8 commit 9da9227
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion run
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if [ -n "$user" ]; then
bashio::log.notice "Replacing existing user with uid $PUID: $user"
deluser "$user"
fi
adduser -G "$GROUP" -D -H -u "$PUID" "$USER"
adduser -G "$GROUP" -D -u "$PUID" "$USER"

if [ -n "${EXTRA_GID:-}" ]; then
bashio::log.info "Resolving suppementary GIDs: $EXTRA_GID"
Expand Down Expand Up @@ -94,6 +94,9 @@ fi
bashio::log.info "Activating venv"
. "$VENV_PATH/bin/activate"

bashio::log.info "Setting new \$HOME"
export HOME="$( getent passwd "$USER" | cut -d: -f6 )"

# Everything below should be kept in sync with
# core:rootfs/etc/services.d/home-assistant/run
# from upstream:
Expand Down

0 comments on commit 9da9227

Please sign in to comment.