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

Gustavo Sverzut Barbieri barbieri at profusion.mobi
Wed Sep 8 17:30:32 PDT 2010


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... for instance the TARGET_GENTOO is wrong as we need
to define INIT_VERSION otherwise the tools do nothing and exit. :-/

what do you think of implementing systemd native versions of halt,
shutdown, ...? A quick check of sysvinit show they are simple, and if
we avoid their communication hacks we could be even more.

-- 
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