app_containers: Detect the user home directory dynamically
...so that we can stop assuming the username inside the container (although the shortcut generation script still does, but we'll fix that later, hopefully)
This commit is contained in:
parent
8aa252305d
commit
fd3fcf1e36
|
@ -51,14 +51,18 @@ fi
|
|||
|
||||
# Default user
|
||||
run_as=$UID
|
||||
# We assume the user named `user` inside the container always has the same UID as
|
||||
# the user with uid $run_as on the host; this is currently not yet configurable
|
||||
homedir=/home/user
|
||||
if [ "$CONTAINER_RUN_AS_ROOT" = true ]; then
|
||||
run_as=0
|
||||
homedir=/root
|
||||
fi
|
||||
|
||||
homedir=/
|
||||
for line in $(sudo cat /var/lib/machines/$CONTAINER_NAME/etc/passwd); do
|
||||
if [ "$(echo "$line" | cut -d: -f3)" == "$run_as" ]; then
|
||||
homedir="$(echo "$line" | cut -d: -f6)"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Userns-related config
|
||||
# Default to identity mapping, which does not provide uid isolation but does for capabilities
|
||||
private_users=identity
|
||||
|
|
Loading…
Reference in a new issue