[PATCH 1/2] units: Merge halt/poweroff/reboot for the different distros
Santi Béjar
santi at agolina.net
Thu Sep 9 00:01:14 PDT 2010
On Thu, Sep 9, 2010 at 2:30 AM, Gustavo Sverzut Barbieri
<barbieri at profusion.mobi> wrote:
> On Wed, Sep 8, 2010 at 9:11 PM, Santi <santi at agolina.net> wrote:
>> --- /dev/null
>> +++ b/units/halt.service.m4
>> @@ -0,0 +1,49 @@
>> +# This file is part of systemd.
>> +#
>> +# systemd is free software; you can redistribute it and/or modify it
>> +# under the terms of the GNU General Public License as published by
>> +# the Free Software Foundation; either version 2 of the License, or
>> +# (at your option) any later version.
>> +
>> +[Unit]
>> +Description=Halt
>> +DefaultDependencies=no
>> +m4_ifdef(`TARGET_SUSE', `',
>> +m4_ifdef(`TARGET_ARCH', `',
>> +Requires=shutdown.target umount.target killall.service
>> +After=shutdown.target umount.target killall.service
>> +)m4_dnl
>> +)m4_dnl
>> +m4_ifdef(`TARGET_FEDORA', `',
>> +m4_ifdef(`TARGET_DEBIAN', `',
>> +m4_ifdef(`TARGET_GENTOO', `',
>> +Requires=shutdown.target umount.target
>> +After=shutdown.target umount.target
>> +)m4_dnl
>> +)m4_dnl
>> +)m4_dnl
>> +
>> +[Service]
>> +Type=oneshot
>> +RemainAfterExit=yes
>> +m4_ifdef(`TARGET_FEDORA',
>> +Environment=INIT_HALT=HALT RUNLEVEL=0
>> +ExecStart=/etc/init.d/halt start
>> +)m4_dnl
>> +m4_ifdef(`TARGET_SUSE',
>> +Environment=INIT_HALT=HALT RUNLEVEL=0 COLD_BOOT=1
>> +ExecStart=/etc/init.d/halt
>> +)m4_dnl
>> +m4_ifdef(`TARGET_DEBIAN',
>> +Environment=INIT_HALT=HALT RUNLEVEL=0
>> +ExecStart=/etc/init.d/halt stop
>> +)m4_dnl
>> +m4_ifdef(`TARGET_GENTOO',
>> +Environment=INIT_HALT=HALT RC_DOWN_HARDDISK=yes
>> +ExecStart=/etc/init.d/shutdown.sh
>> +)m4_dnl
>> +m4_ifdef(`TARGET_ARCH',
>> +Environment=RUNLEVEL=0
>> +ExecStart=/etc/rc.shutdown
>> +)m4_dnl
>> +StandardOutput=tty
>
> Ouch... do we really need such mess of m4_ifdef() for such simple
> tasks? These all provide work around for distribution specific
> sysvinit tools...
I prefer having a mess in a single file than having to maintain 5 slightly
different files.
But I won't push it very hard as this is temporary till systemd gains native
versions of them.
> for instance the TARGET_GENTOO is wrong as we need
> to define INIT_VERSION otherwise the tools do nothing and exit. :-/
This is for another patch. My patch generates exactly the old *.service
files.
Santi
More information about the systemd-devel
mailing list