]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: make --remote to forward --nohostname as -H to login
authorSami Kerola <kerolasa@iki.fi>
Sat, 1 Apr 2017 10:38:01 +0000 (11:38 +0100)
committerSami Kerola <kerolasa@iki.fi>
Mon, 3 Apr 2017 18:55:15 +0000 (19:55 +0100)
Without this change an attempt to remove hostname printing required following
rather clumsy agetty invocation.

  /sbin/agetty --nohostname --login-options '/bin/login -H -- \u'

After the change --nohostname behaves similar way with --host option, that
is when combined with --remote the effect is passed to login(1).

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
term-utils/agetty.8
term-utils/agetty.c

index 40be8b46c99a28746a00491ba62cd37991983f37..4431341c2a481d246d35c5803b01cf7394fca582 100644 (file)
@@ -100,8 +100,12 @@ Don't reset terminal cflags (control modes).  See \fBtermios\fP(3) for more
 details.
 .TP
 \-E, \-\-remote
-If an \fB\-H\fP \fIfakehost\fP option is given, then an \fB\-r\fP
-\fIfakehost\fP option is added to the \fB/bin/login\fP command line.
+If an \fB\-\-host\fP \fIfakehost\fP option is given, then an \fB\-h\fP
+\fIfakehost\fP option and argument are added to the \fB/bin/login\fP
+command line.
+.IP
+If an \fB\-\-nohostname\fR option is given, then an \fB\-H\fP option
+is added to the \fB/bin/login\fP command line.
 .TP
 \-f, \-\-issue\-file \fIissue_file\fP
 Display the contents of \fIissue_file\fP instead of \fI/etc/issue\fP.
index 6a2085a3c4bd899dede68c496df8397a6670a197..93a3843c776e9963d831d34a2b48870dfdd674cb 100644 (file)
@@ -493,9 +493,12 @@ int main(int argc, char **argv)
                login_options_to_argv(login_argv, &login_argc,
                                      options.logopt, username);
        } else {
-               if (fakehost && (options.flags & F_REMOTE)) {
-                       login_argv[login_argc++] = "-h";
-                       login_argv[login_argc++] = fakehost;
+               if (options.flags & F_REMOTE) {
+                       if (fakehost) {
+                               login_argv[login_argc++] = "-h";
+                               login_argv[login_argc++] = fakehost;
+                       } else if (options.flags & F_NOHOSTNAME)
+                               login_argv[login_argc++] = "-H";
                }
                if (username) {
                        if (options.autolog)