]> git.ozlabs.org Git - petitboot/commitdiff
utils/pb-console: Support agetty's autologin option
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 23 Apr 2018 04:46:37 +0000 (14:46 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 3 Dec 2018 03:39:57 +0000 (14:39 +1100)
If the getty arguments include '-a' do not set the '-l' option. This
implies the environment has been configured with users and will launch
the subsequent pb-console instance itself.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
utils/pb-console

index 282fca1193604ff57b7aff102844648ecd4e5f70..ef9ed0f61d455a8fc85757611d0dab374fa8e90c 100644 (file)
@@ -80,12 +80,24 @@ then
        then
                getty="$getty_arg"
        fi
+
+       login_arg="-l$0"
+       for ttyarg in "$@"
+       do
+               # If the getty args include autologin don't override with -l
+               # and leave calling petitboot-nc to the user's init
+               if [ "$ttyarg" == "-a" ]
+               then
+                       login_arg=""
+               fi
+       done
+
        if [ "$detach" = 1 ]
        then
-               $getty -l $0 "$@" &
+               $getty $login_arg "$@" &
                exit
        else
-               exec $getty -l $0 "$@"
+               exec $getty $login_arg "$@"
        fi
 fi