Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Sep 2017 00:20:17 +0000 (UTC)
From:      David Bright <dab@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323252 - head/libexec/getty
Message-ID:  <201709070020.v870KHpO032436@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dab
Date: Thu Sep  7 00:20:17 2017
New Revision: 323252
URL: https://svnweb.freebsd.org/changeset/base/323252

Log:
  Add a new getty/gettytab capability to generate an initial message dynamically.
  
  This modification adds a new gettytab(5) option (iM) to specify a
  program to run that will generate the initial (banner) message that is
  displayed before the login prompt. Such a capability is useful when
  dynamic information is needed in the banner message that cannot be
  supplied by the set of % substitution sequences available in the "im"
  option.
  
  Reviewed by:	vangyzen, wblock, manpages
  Approved by:	vangyzen (mentor)
  MFC after:	1 week
  Relnotes:	yes
  Sponsored by:	Dell EMC
  Differential Revision:	https://reviews.freebsd.org/D12108

Modified:
  head/libexec/getty/gettytab.5
  head/libexec/getty/gettytab.h
  head/libexec/getty/init.c
  head/libexec/getty/main.c

Modified: head/libexec/getty/gettytab.5
==============================================================================
--- head/libexec/getty/gettytab.5	Wed Sep  6 23:43:20 2017	(r323251)
+++ head/libexec/getty/gettytab.5	Thu Sep  7 00:20:17 2017	(r323252)
@@ -28,7 +28,7 @@
 .\"     from: @(#)gettytab.5	8.4 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\" "
-.Dd February 2, 2017
+.Dd August 23, 2017
 .Dt GETTYTAB 5
 .Os
 .Sh NAME
@@ -130,6 +130,8 @@ hangup line on last close
 .It "ig	bool	false	ignore garbage characters in login name"
 .It "im	str" Ta Dv NULL
 .Ta No "initial (banner) message"
+.It "iM	str" Ta Dv NULL
+.Ta No "execute named file to generate initial (banner) message"
 .It "in	str" Ta So Li ^C
 .Sc Ta No "interrupt character"
 .It "is	num	unused	input speed"
@@ -146,7 +148,7 @@ hangup line on last close
 .It "mb	bool	false	do flow control based on carrier"
 .It "nc	bool	false	terminal does not supply carrier (set clocal)"
 .It "nl	bool	false	terminal has (or might have) a newline character"
-.It "np	bool	false	terminal uses no parity (i.e. 8-bit characters)"
+.It "np	bool	false	terminal uses no parity (i.e., 8-bit characters)"
 .It "nx	str	default	next table (for auto speed selection)"
 .It "o0	num	unused	tty output flags to write messages"
 .It "o1	num	unused	tty output flags to read login name"

Modified: head/libexec/getty/gettytab.h
==============================================================================
--- head/libexec/getty/gettytab.h	Wed Sep  6 23:43:20 2017	(r323251)
+++ head/libexec/getty/gettytab.h	Thu Sep  7 00:20:17 2017	(r323252)
@@ -88,6 +88,7 @@ struct gettyflags {
 #define AC	gettystrs[28].value
 #define AL	gettystrs[29].value
 #define DF	gettystrs[30].value
+#define IMP	gettystrs[31].value
 
 /*
  * Numeric definitions.

Modified: head/libexec/getty/init.c
==============================================================================
--- head/libexec/getty/init.c	Wed Sep  6 23:43:20 2017	(r323251)
+++ head/libexec/getty/init.c	Thu Sep  7 00:20:17 2017	(r323252)
@@ -82,6 +82,7 @@ struct	gettystrs gettystrs[] = {
 	{ "ac" },			/* modem answer-chat */
 	{ "al" },			/* user to auto-login */
 	{ "df", datefmt},		/* format for strftime() */
+	{ "iM" },			/* initial message program */
 	{ 0 }
 };
 

Modified: head/libexec/getty/main.c
==============================================================================
--- head/libexec/getty/main.c	Wed Sep  6 23:43:20 2017	(r323251)
+++ head/libexec/getty/main.c	Thu Sep  7 00:20:17 2017	(r323252)
@@ -324,6 +324,8 @@ main(int argc, char *argv[])
 		}
 		first_time = 0;
 
+		if (IMP && *IMP && !(PL && PP))
+			system(IMP);
 		if (IM && *IM && !(PL && PP))
 			putf(IM);
 		if (setjmp(timeout)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709070020.v870KHpO032436>