[v2,01/13] utils/pb-console: Support agetty's autologin option
diff mbox series

Message ID 20181128042012.25916-2-sam@mendozajonas.com
State Accepted
Headers show
Series
  • User support and client permissions
Related show

Commit Message

Samuel Mendoza-Jonas Nov. 28, 2018, 4:20 a.m. UTC
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 | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/utils/pb-console b/utils/pb-console
index 282fca11..ef9ed0f6 100644
--- a/utils/pb-console
+++ b/utils/pb-console
@@ -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