getty: Detect if you are in a namespace

This is an attempt at fixing #2213

If `INITGETTY` has been set then we are not in a namespace.

Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
Dave Tucker 2017-07-17 16:39:45 +01:00 committed by Avi Deitcher
parent 4327329265
commit f41c976406
2 changed files with 8 additions and 1 deletions

View File

@ -1 +0,0 @@
export PS1="(ns: getty) $PS1"

View File

@ -41,6 +41,14 @@ start_getty() {
infinite_loop setsid.getty -w /sbin/agetty $loginargs $line $speed $tty $term &
}
# check if we are namespaced, and, if so, indicate in the PS1
if [ -z "$INIGETTY" ]; then
cat >/etc/profile.d/namespace.sh <<"EOF"
export PS1="(ns: getty) $PS1"
EOF
fi
# check if we have /etc/getty.shadow
ROOTSHADOW=/hostroot/etc/getty.shadow
if [ -f $ROOTSHADOW ]; then