]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
units: Tell login to preserve environment (#6023)
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Wed, 24 May 2017 11:58:01 +0000 (14:58 +0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 9 Jul 2017 14:53:31 +0000 (10:53 -0400)
Make agetty started by *getty* units pass '-p' option to "login", so it
doesn't clear the environment and passes whatever was setup by systemd
to shells. This is needed especially for programs which are specified as
user shells, but won't read locale settings from anywhere but
environment.

[zj: cherry-pick just the second patch from the series, see discussion
on the pull request.]

units/console-getty.service.m4.in
units/container-getty@.service.m4.in
units/getty@.service.m4
units/serial-getty@.service.m4

index 413d94094b19a683af2d8a1c951befffb324154c..d9d0cba4d9a4a51a14b51548df761506082ba74b 100644 (file)
@@ -16,7 +16,10 @@ After=rc-local.service
 Before=getty.target
 
 [Service]
-ExecStart=-/sbin/agetty --noclear --keep-baud console 115200,38400,9600 $TERM
+# The '-o' option value tells agetty to replace 'login' arguments with an
+# option to preserve environment (-p), followed by '--' for safety, and then
+# the entered username.
+ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear --keep-baud console 115200,38400,9600 $TERM
 Type=idle
 Restart=always
 RestartSec=0
index e126f3a48999c8ce18351a6d33af93243659cd4d..fd0be86ba7f09a70aa5b9e763819703f6bb36060 100644 (file)
@@ -17,7 +17,10 @@ IgnoreOnIsolate=yes
 ConditionPathExists=/dev/pts/%I
 
 [Service]
-ExecStart=-/sbin/agetty --noclear --keep-baud pts/%I 115200,38400,9600 $TERM
+# The '-o' option value tells agetty to replace 'login' arguments with an
+# option to preserve environment (-p), followed by '--' for safety, and then
+# the entered username.
+ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear --keep-baud pts/%I 115200,38400,9600 $TERM
 Type=idle
 Restart=always
 RestartSec=0
index 5b82c13fc5eb08a979625353bf7bbf0509399198..2a84061ed67d3a3468048dfc2114a7121bc16d15 100644 (file)
@@ -33,7 +33,10 @@ ConditionPathExists=/dev/tty0
 
 [Service]
 # the VT is cleared by TTYVTDisallocate
-ExecStart=-/sbin/agetty --noclear %I $TERM
+# The '-o' option value tells agetty to replace 'login' arguments with an
+# option to preserve environment (-p), followed by '--' for safety, and then
+# the entered username.
+ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM
 Type=idle
 Restart=always
 RestartSec=0
index 609c5b62ee2bfc14d2a2d1b9c341bf9250493f4e..b7caeaff449a364bc5c18e188b0500253d32d5f6 100644 (file)
@@ -28,7 +28,10 @@ Conflicts=rescue.service
 Before=rescue.service
 
 [Service]
-ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
+# The '-o' option value tells agetty to replace 'login' arguments with an
+# option to preserve environment (-p), followed by '--' for safety, and then
+# the entered username.
+ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,38400,9600 %I $TERM
 Type=idle
 Restart=always
 UtmpIdentifier=%I