units: make use of agetty mandatory
This commit is contained in:
parent
41242c42bf
commit
92ab323c82
29
src/unit.c
29
src/unit.c
|
@ -826,6 +826,7 @@ fail:
|
||||||
*/
|
*/
|
||||||
int unit_start(Unit *u) {
|
int unit_start(Unit *u) {
|
||||||
UnitActiveState state;
|
UnitActiveState state;
|
||||||
|
Unit *following;
|
||||||
|
|
||||||
assert(u);
|
assert(u);
|
||||||
|
|
||||||
|
@ -840,16 +841,22 @@ int unit_start(Unit *u) {
|
||||||
if (UNIT_IS_ACTIVE_OR_RELOADING(state))
|
if (UNIT_IS_ACTIVE_OR_RELOADING(state))
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
|
|
||||||
/* If it is stopped, but we cannot start it, then fail */
|
|
||||||
if (!UNIT_VTABLE(u)->start)
|
|
||||||
return -EBADR;
|
|
||||||
|
|
||||||
/* If the conditions failed, don't do anything at all */
|
/* If the conditions failed, don't do anything at all */
|
||||||
if (!condition_test_list(u->meta.conditions)) {
|
if (!condition_test_list(u->meta.conditions)) {
|
||||||
log_debug("Starting of %s requested but condition failed. Ignoring.", u->meta.id);
|
log_debug("Starting of %s requested but condition failed. Ignoring.", u->meta.id);
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Forward to the main object, if we aren't it. */
|
||||||
|
if ((following = unit_following(u))) {
|
||||||
|
log_debug("Redirecting start request from %s to %s.", u->meta.id, following->meta.id);
|
||||||
|
return unit_start(following);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If it is stopped, but we cannot start it, then fail */
|
||||||
|
if (!UNIT_VTABLE(u)->start)
|
||||||
|
return -EBADR;
|
||||||
|
|
||||||
/* We don't suppress calls to ->start() here when we are
|
/* We don't suppress calls to ->start() here when we are
|
||||||
* already starting, to allow this request to be used as a
|
* already starting, to allow this request to be used as a
|
||||||
* "hurry up" call, for example when the unit is in some "auto
|
* "hurry up" call, for example when the unit is in some "auto
|
||||||
|
@ -859,7 +866,6 @@ int unit_start(Unit *u) {
|
||||||
unit_add_to_dbus_queue(u);
|
unit_add_to_dbus_queue(u);
|
||||||
|
|
||||||
unit_status_printf(u, "Starting %s...\n", unit_description(u));
|
unit_status_printf(u, "Starting %s...\n", unit_description(u));
|
||||||
|
|
||||||
return UNIT_VTABLE(u)->start(u);
|
return UNIT_VTABLE(u)->start(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -883,6 +889,7 @@ bool unit_can_isolate(Unit *u) {
|
||||||
*/
|
*/
|
||||||
int unit_stop(Unit *u) {
|
int unit_stop(Unit *u) {
|
||||||
UnitActiveState state;
|
UnitActiveState state;
|
||||||
|
Unit *following;
|
||||||
|
|
||||||
assert(u);
|
assert(u);
|
||||||
|
|
||||||
|
@ -890,13 +897,17 @@ int unit_stop(Unit *u) {
|
||||||
if (UNIT_IS_INACTIVE_OR_FAILED(state))
|
if (UNIT_IS_INACTIVE_OR_FAILED(state))
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
|
|
||||||
|
if ((following = unit_following(u))) {
|
||||||
|
log_debug("Redirecting stop request from %s to %s.", u->meta.id, following->meta.id);
|
||||||
|
return unit_stop(following);
|
||||||
|
}
|
||||||
|
|
||||||
if (!UNIT_VTABLE(u)->stop)
|
if (!UNIT_VTABLE(u)->stop)
|
||||||
return -EBADR;
|
return -EBADR;
|
||||||
|
|
||||||
unit_add_to_dbus_queue(u);
|
unit_add_to_dbus_queue(u);
|
||||||
|
|
||||||
unit_status_printf(u, "Stopping %s...\n", unit_description(u));
|
unit_status_printf(u, "Stopping %s...\n", unit_description(u));
|
||||||
|
|
||||||
return UNIT_VTABLE(u)->stop(u);
|
return UNIT_VTABLE(u)->stop(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -907,6 +918,7 @@ int unit_stop(Unit *u) {
|
||||||
*/
|
*/
|
||||||
int unit_reload(Unit *u) {
|
int unit_reload(Unit *u) {
|
||||||
UnitActiveState state;
|
UnitActiveState state;
|
||||||
|
Unit *following;
|
||||||
|
|
||||||
assert(u);
|
assert(u);
|
||||||
|
|
||||||
|
@ -923,6 +935,11 @@ int unit_reload(Unit *u) {
|
||||||
if (state != UNIT_ACTIVE)
|
if (state != UNIT_ACTIVE)
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
|
|
||||||
|
if ((following = unit_following(u))) {
|
||||||
|
log_debug("Redirecting reload request from %s to %s.", u->meta.id, following->meta.id);
|
||||||
|
return unit_reload(following);
|
||||||
|
}
|
||||||
|
|
||||||
unit_add_to_dbus_queue(u);
|
unit_add_to_dbus_queue(u);
|
||||||
return UNIT_VTABLE(u)->reload(u);
|
return UNIT_VTABLE(u)->reload(u);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,6 @@
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
m4_ifdef(`TARGET_FEDORA', `m4_define(`GETTY', `/sbin/agetty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_SUSE', `m4_define(`GETTY', `/sbin/agetty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_GENTOO', `m4_define(`GETTY', `/sbin/agetty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_ARCH', `m4_define(`GETTY', `/sbin/agetty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_DEBIAN', `m4_define(`GETTY', `/sbin/getty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_UBUNTU', `m4_define(`GETTY', `/sbin/getty')')m4_dnl
|
|
||||||
m4_dnl
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Getty on %I
|
Description=Getty on %I
|
||||||
BindTo=dev-%i.device
|
BindTo=dev-%i.device
|
||||||
|
@ -30,7 +23,7 @@ Before=getty.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment=TERM=linux
|
Environment=TERM=linux
|
||||||
ExecStart=-GETTY %I 38400
|
ExecStart=-/sbin/agetty %I 38400
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=0
|
RestartSec=0
|
||||||
UtmpIdentifier=%I
|
UtmpIdentifier=%I
|
||||||
|
|
|
@ -5,13 +5,6 @@
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
m4_ifdef(`TARGET_FEDORA', `m4_define(`GETTY', `/sbin/agetty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_SUSE', `m4_define(`GETTY', `/sbin/agetty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_GENTOO', `m4_define(`GETTY', `/sbin/agetty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_ARCH', `m4_define(`GETTY', `/sbin/agetty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_DEBIAN', `m4_define(`GETTY', `/sbin/getty')')m4_dnl
|
|
||||||
m4_ifdef(`TARGET_UBUNTU', `m4_define(`GETTY', `/sbin/getty')')m4_dnl
|
|
||||||
m4_dnl
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Serial Getty on %I
|
Description=Serial Getty on %I
|
||||||
BindTo=dev-%i.device
|
BindTo=dev-%i.device
|
||||||
|
@ -33,7 +26,7 @@ Environment=TERM=vt100-nav
|
||||||
m4_ifdef(`TARGET_FEDORA',
|
m4_ifdef(`TARGET_FEDORA',
|
||||||
ExecStartPre=-/sbin/securetty %I
|
ExecStartPre=-/sbin/securetty %I
|
||||||
)m4_dnl
|
)m4_dnl
|
||||||
ExecStart=-GETTY -s %I 115200,38400,9600
|
ExecStart=-/sbin/agetty -s %I 115200,38400,9600
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=0
|
RestartSec=0
|
||||||
UtmpIdentifier=%I
|
UtmpIdentifier=%I
|
||||||
|
|
Loading…
Reference in New Issue