[systemd-devel] [PATCH] Add the most common consoles that MeeGo needs

Lennart Poettering lennart at poettering.net
Fri Jul 1 13:54:59 PDT 2011


On Fri, 01.07.11 09:19, Chris Ferron (chris.e.ferron at linux.intel.com) wrote:

Heya,

> MeeGo will use several consoles depending on the hardware adaptations.
> This patch adds the most common to the serial-getty unit Install
> section so when systemd is built for MeeGo as its distribution, you
> get the most common Aliased for installation by the user.

Hmm, this patch is borked, due to line breaks done by your mailer.

>  After=dev-%i.device systemd-user-sessions.service
> plymouth-quit-wait.service
> +m4_ifdef(`TARGET_MEEGO',
> +After=dev-%i.device systemd-user-sessions.service
> +)m4_dnl

Why repeat the previous line? Note that multiple After= lines are
merged, so this appears fully redundant to me?

>  m4_ifdef(`TARGET_FEDORA',
>  After=rc-local.service
>  )m4_dnl
> @@ -44,3 +47,9 @@ KillMode=process
>  # Some login implementations ignore SIGTERM, so we send SIGHUP
>  # instead, to ensure that login terminates cleanly.
>  KillSignal=SIGHUP
> +
> +m4_ifdef(`TARGET_MEEGO',
> +[Install]
> +Alias=sysinit.target.wants/serial-getty at ttyS0.service
> sysinit.target.wants/serial-getty at ttyS1.service
> sysinit.target.wants/serial-getty at tty01.service
> sysinit.target.wants/serial-getty at ttyO2.service
> +)m4_dnl
> +

Hmm, what's the rationale behind this? if those devices never show up
then you end up spawning services with dependencies that necessarily
time out (i.e. the non-existing serial ports). To make this nicer I'd
turn this around: write a simple udev rule that matches against all ttys
you are interested in and pull in a getty for each with
SYSTEMD_WANTS. Something like this should do the job:

SUBSYSTEM=="tty", KERNEL=="ttyS*|ttyO*|tty0*", TAG="systemd", ENV{SYSTEMD_WANTS}="serial-getty@%k.service"

If you do this, then you'll spawn exactly the gettys that match your
system, and this stuff is even hotpluggable. (i.e. if you extend this
for ttyUSB you could get a getty on it as you plug it in, how awesome is
that!).

Also, this really looks like something that is more appropriately done
with "ln -s" lines in the RPM .spec %post script?

And the other gettys are pulled in by getty.target, which appears more
appropriate than sysinit.target.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list