mrrl-containers

MRRL version of container scripts
git clone https://ccx.te2000.cz/git/mrrl-containers
Log | Files | Refs

commit 26cbb8f507df1673b97a4103d94acc135096851c
parent b491fd9f47b65b5fad91bfebc790a8be24a75b9a
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date:   Wed, 12 Oct 2022 22:57:05 +0200

export USER variable for xsession-setup script
Diffstat:
Mservice_scripts/alsa/run | 19+++++++++++++------
Mservice_scripts/generic/run | 2+-
Mservice_scripts/xsession/run | 2+-
3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/service_scripts/alsa/run b/service_scripts/alsa/run @@ -1,4 +1,4 @@ -#!/command/execlineb +#!/command/execlineb -P fdmove -c 2 1 s6-envdir env @@ -12,6 +12,7 @@ multisubstitute { define CONTAINER_TMPFS /run/containers/${CONTAINER_NAME}.${CONTAINER_USER} # define CONTAINER_DATA /mnt/volumes/containers/user/${CONTAINER_USER}/${CONTAINER_NAME} define -s tmpfs_dirs "home run tmp inbox run/inbox tmp/.X11-unix" + importas -D ns -s -C -u CONTAINER_MNT_DIRS CONTAINER_MNT_DIRS } getpid NS_PID @@ -24,13 +25,21 @@ foreground { } if { rm -rf ${CONTAINER_TMPFS} } -if { mkdir -p ${CONTAINER_TMPFS}/${tmpfs_dirs} } +if { mkdir -p ${CONTAINER_TMPFS}/${tmpfs_dirs} ${CONTAINER_TMPFS}/mnt/${CONTAINER_MNT_DIRS} } if { chmod 1770 ${CONTAINER_TMPFS}/${tmpfs_dirs} } if { chown root:${CONTAINER_USER} ${CONTAINER_TMPFS}/${tmpfs_dirs} } if { mount -a --fstab data/fstab } -# Put UID/GID of user and their exclusive group (same group name as user name) -#s6-envuidgid -B ${CONTAINER_USER}:${CONTAINER_USER} +# Put UID/GID/GIDLIST into environment for use by s6-applyuidgid below +s6-envuidgid ${CONTAINER_USER} + +# Run user's setup script (optional) +if { + if -n -t { s6-test -e ${CONTAINER_USER_HOME}/container-setup } + env HOME=${CONTAINER_USER_HOME} USER=${CONTAINER_USER} + s6-applyuidgid -U + ${CONTAINER_USER_HOME}/container-setup ${CONTAINER_TMPFS} ${CONTAINER_NAME} +} #multisubstitute { importas -i UID UID importas -i GID GID } env @@ -42,9 +51,7 @@ unshare -n # make new network namespace if { ip addr add 127.0.0.1/8 dev lo } if { ip addr add ::1/128 dev lo } if { ip link set lo up } - # Put UID/GID/GIDLIST into environment for use by s6-applyuidgid below -s6-envuidgid ${CONTAINER_USER} emptyenv -c ns_run data/root /mnt/ns/bin/s6-applyuidgid -U diff --git a/service_scripts/generic/run b/service_scripts/generic/run @@ -36,7 +36,7 @@ s6-envuidgid ${CONTAINER_USER} # Run user's setup script (optional) if { if -n -t { s6-test -e ${CONTAINER_USER_HOME}/container-setup } - env HOME=${CONTAINER_USER_HOME} + env HOME=${CONTAINER_USER_HOME} USER=${CONTAINER_USER} s6-applyuidgid -U ${CONTAINER_USER_HOME}/container-setup ${CONTAINER_TMPFS} ${CONTAINER_NAME} } diff --git a/service_scripts/xsession/run b/service_scripts/xsession/run @@ -36,7 +36,7 @@ s6-envuidgid ${CONTAINER_USER} # Run user's script to populate /home /run and/or /tmp if { - env HOME=${CONTAINER_USER_HOME} + env HOME=${CONTAINER_USER_HOME} USER=${CONTAINER_USER} s6-applyuidgid -U ${CONTAINER_USER_HOME}/xsession-setup ${CONTAINER_TMPFS} ${vtN} }