[PATCH 1/2] units: Merge halt/poweroff/reboot for the different distros

Gustavo Sverzut Barbieri barbieri at profusion.mobi
Thu Sep 9 08:47:21 PDT 2010


On Thu, Sep 9, 2010 at 12:37 PM, Bill Nottingham <notting at redhat.com> wrote:
> Santi (santi at agolina.net) said:
>>  Makefile.am                   |   23 ++++++-------------
>>  units/.gitignore              |    3 ++
>>  units/arch/halt.service       |   19 ----------------
>>  units/arch/poweroff.service   |   19 ----------------
>>  units/arch/reboot.service     |   19 ----------------
>>  units/debian/halt.service     |   19 ----------------
>>  units/debian/poweroff.service |   19 ----------------
>>  units/debian/reboot.service   |   19 ----------------
>>  units/fedora/halt.service     |   19 ----------------
>>  units/fedora/poweroff.service |   19 ----------------
>>  units/fedora/reboot.service   |   19 ----------------
>>  units/gentoo/halt.service     |   19 ----------------
>>  units/gentoo/poweroff.service |   19 ----------------
>>  units/gentoo/reboot.service   |   18 ---------------
>>  units/halt.service.m4         |   49 +++++++++++++++++++++++++++++++++++++++++
>>  units/poweroff.service.m4     |   49 +++++++++++++++++++++++++++++++++++++++++
>>  units/reboot.service.m4       |   48 ++++++++++++++++++++++++++++++++++++++++
>>  units/suse/halt.service       |   19 ----------------
>>  units/suse/poweroff.service   |   19 ----------------
>>  units/suse/reboot.service     |   19 ----------------
>
> I would argue that it's better to work on a native, common, no-hacks
> implementation thereof, and leave the current distro-specific
> ones intact. (Or, in fact, move them out of systemd entirely
> to some distro-specific place.)

It would be good to discuss the preferred approach to implement such
utilities in systemd. We could create special unit type "finalize"
that could take as FinalizationMethod=(halt|poweroff|reboot|kexec).
The options most distro give to the /sbin/halt and /sbin/reboot in
these scripts are basically to do the minimum: they disable writing to
wtmp and like, so it would be easy to have these in systemd process.
Even killall5 (killproc and other scripts) is super-easy if you're
doing it from init as we don't need to ignore our own process or
parent, and we could easily avoid stupid hacks like "sleep 10;
/sbin/killall15 -9" as we are notified if the process are still there
or not, we could even log_debug("killing process %d (%s) with SIGKILL
as it remained after SIGTERM")

I can try to help there, but I don't want to do things in a way and
later people say it should be the other :-)


-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbieri at gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202


More information about the systemd-devel mailing list