mrrl-containers

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

commit 7376f66811749cb476645c11f16c65e0ba82c01b
parent 62efa5671d77be5a64d5c7ccf4a909ad3a8d4ac7
Author: Jan Pobříslo <ccx@te2000.cz>
Date:   Thu, 16 Dec 2021 15:21:31 +0000

Add NS_NO_PID1 environment variable.
Diffstat:
Msbin/ns_run | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sbin/ns_run b/sbin/ns_run @@ -20,6 +20,7 @@ ## - anything you wish to call before and for dropping privs, ## eg. s6-applyuidgid ## All statically linked of course. +## NS_NO_PID1 - Allow not running as init process of the namespace. # import variables from environment, with defaults multisubstitute { @@ -31,7 +32,11 @@ multisubstitute { # check we are PID1 (in a new PID namespace) getpid PID -ifelse { importas -i PID PID test 1 -ne $PID } { +ifelse { + importas -D "" NS_NO_PID1 NS_NO_PID1 + if -x 0 { test -z $NS_NO_PID1 } + importas -i PID PID test 1 -ne $PID +} { fdmove -c 1 2 echo "ns_run: fatal: not PID 1" exit 111