systemd: configure emergency.service to autologin if set on kernel co… #213
Conversation
@@ -52,6 +65,8 @@ autologin() { | |||
overlay_unit "getty@.service" | |||
overlay_unit "serial-getty@.service" | |||
fi | |||
|
|||
emergency_autologin "emergency.service" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems unnecessary for this to be an argument.
649f515
to
7f1e595
Compare
@@ -52,6 +64,8 @@ autologin() { | |||
overlay_unit "getty@.service" | |||
overlay_unit "serial-getty@.service" | |||
fi | |||
|
|||
emergency_autologin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be on the safe side, lets pass "${arg}" as an argument, the function should then exit early if arg is not empty but doesn't exist in /sys/class/tty/console/active
that way we don't open up a tty in emergency mode that wouldn't otherwise be open.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that multiple consoles may be listed but only the first is going to be applicable (only one can be stdin) so something like:
if [[ -n "$1" ]]; then
egrep -q "^$1( |$)" /sys/class/tty/console/active || return
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
er, wait, or is it the last one? damnit... I always forget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last one, so can be simplified to merely: grep -q "$1$" /sys/class/tty/console/active || return
if "$1" is blank it'll still match so no need for the extra if.
7f1e595
to
49d7238
Compare
fixes coreos/bugs#1433 |
LGTM |
…mmandline