commit 0d06f92f017d2bf9d2d824711143bfab613010bc
parent 5c2530d1c389addf01bb5818ddda6ed8a9a567d9
Author: ccx <ccx@te2000.cz>
Date: Mon, 18 Mar 2024 16:29:42 +0000
Rework argument handling in ns_run_unshared
Diffstat:
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/sbin/ns_run_unshared b/sbin/ns_run_unshared
@@ -24,12 +24,15 @@
# import variables from environment, with defaults
multisubstitute {
+ importas -i 1 1 # require first argument
importas -D container HOST HOST
importas -D /mnt/chroot NS_ROOT NS_ROOT
importas -D mnt/ns NS_TMPFS NS_TMPFS
importas -D /mnt/volumes/containers/bin NS_BIN NS_BIN
}
+shift -n 1 # remove first argument so we get clean $@ below
+
# check we are PID1 (in a new PID namespace)
getpid PID
ifelse {
@@ -89,7 +92,7 @@ if {
unexport NS_FSTAB
# container-specific setup
-if { runblock -n 1 1 }
+if { runblock 1 }
# now we can make /dev immutable
if { mount -o remount,ro dev }
@@ -98,5 +101,8 @@ if { mount -o remount,ro dev }
# * does pivot_root to change rootdir
# * umounts all undesired filesystems
# * execs into $@
-importas -i -u NS_FINAL_SCRIPT NS_FINAL_SCRIPT
-runblock -r -n 1 1 emptyenv -c execlineb -S0 -c $NS_FINAL_SCRIPT $@
+multisubstitute {
+ importas -i -u NS_FINAL_SCRIPT NS_FINAL_SCRIPT
+ elgetpositionals
+}
+runblock -r 1 emptyenv -c execlineb -S0 -c $NS_FINAL_SCRIPT $@
diff --git a/service_scripts/xorg/finish b/service_scripts/xorg/finish
@@ -6,12 +6,10 @@ multisubstitute {
importas -i CONTAINER_NAME CONTAINER_NAME
importas -i CONTAINER_USER CONTAINER_USER
}
-multisubstitute {
- define CONTAINER_TMPFS /run/containers/${CONTAINER_NAME}.${CONTAINER_USER}
-}
-foreground { umount ${CONTAINER_TMPFS}/inbox }
-foreground { umount ${CONTAINER_TMPFS}/run }
-foreground { umount ${CONTAINER_TMPFS}/tmp }
+define CONTAINER_TMPFS /run/containers/${CONTAINER_NAME}.${CONTAINER_USER}
+#foreground { umount ${CONTAINER_TMPFS}/inbox }
+#foreground { umount ${CONTAINER_TMPFS}/run }
+#foreground { umount ${CONTAINER_TMPFS}/tmp }
#foreground { umount --recursive data/root/ }
foreground {
if { test -f ${CONTAINER_TMPFS}/run/uncaught-logs/current }