From cf586269a3a738275d31cf24403f94ca0946ecfb Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Thu, 20 May 2010 20:17:42 +0200 Subject: [PATCH] Add Debian support to unit/ --- Makefile.am | 7 +++++++ units/debian/halt.service | 28 ++++++++++++++++++++++++++++ units/debian/killall.service | 24 ++++++++++++++++++++++++ units/debian/poweroff.service | 27 +++++++++++++++++++++++++++ units/debian/reboot.service | 27 +++++++++++++++++++++++++++ units/multi-user.target.m4 | 5 +++++ 6 files changed, 118 insertions(+) create mode 100644 units/debian/halt.service create mode 100644 units/debian/killall.service create mode 100644 units/debian/poweroff.service create mode 100644 units/debian/reboot.service diff --git a/Makefile.am b/Makefile.am index f67f22d6..2bbec807 100644 --- a/Makefile.am +++ b/Makefile.am @@ -118,6 +118,13 @@ dist_systemunit_DATA += \ units/fedora/rc-local.service \ units/fedora/reboot.service \ units/fedora/sysinit.service +else +if TARGET_DEBIAN +dist_systemunit_DATA += \ + units/debian/halt.service \ + units/debian/killall.service \ + units/debian/poweroff.service \ + units/debian/reboot.service \ endif # This is needed because automake is buggy in how it generates the diff --git a/units/debian/halt.service b/units/debian/halt.service new file mode 100644 index 00000000..e32fae87 --- /dev/null +++ b/units/debian/halt.service @@ -0,0 +1,28 @@ +# This file is part of systemd. +# +# Copyright 2010 Lennart Poettering +# +# 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. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with systemd; If not, see . + +[Unit] +Description=Halt +Requires=shutdown.target killall.service +After=shutdown.target killall.service + +[Service] +Type=finish +ValidNoProcess=yes +Environment=INIT_HALT=HALT +Environment=RUNLEVEL=0 +ExecStart=/etc/init.d/halt stop diff --git a/units/debian/killall.service b/units/debian/killall.service new file mode 100644 index 00000000..12f1cd5d --- /dev/null +++ b/units/debian/killall.service @@ -0,0 +1,24 @@ +# This file is part of systemd. +# +# Copyright 2010 Lennart Poettering +# +# 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. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with systemd; If not, see . + +[Unit] +Description=Kill All Processes + +[Service] +Type=finish +ValidNoProcess=yes +ExecStart=/etc/init.d/sendsigs stop diff --git a/units/debian/poweroff.service b/units/debian/poweroff.service new file mode 100644 index 00000000..f9e29ac0 --- /dev/null +++ b/units/debian/poweroff.service @@ -0,0 +1,27 @@ +# This file is part of systemd. +# +# Copyright 2010 Lennart Poettering +# +# 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. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with systemd; If not, see . + +[Unit] +Description=Power-Off +Requires=shutdown.target killall.service +After=shutdown.target killall.service + +[Service] +Type=finish +ValidNoProcess=yes +Environment=RUNLEVEL=0 +ExecStart=/etc/init.d/halt stop diff --git a/units/debian/reboot.service b/units/debian/reboot.service new file mode 100644 index 00000000..dcdbced2 --- /dev/null +++ b/units/debian/reboot.service @@ -0,0 +1,27 @@ +# This file is part of systemd. +# +# Copyright 2010 Lennart Poettering +# +# 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. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with systemd; If not, see . + +[Unit] +Description=Reboot +Requires=shutdown.target killall.service +After=shutdown.target killall.service + +[Service] +Type=finish +ValidNoProcess=yes +Environment=RUNLEVEL=6 +ExecStart=/etc/init.d/reboot stop diff --git a/units/multi-user.target.m4 b/units/multi-user.target.m4 index a49cfb9f..bbb5224f 100644 --- a/units/multi-user.target.m4 +++ b/units/multi-user.target.m4 @@ -27,3 +27,8 @@ m4_ifdef(`TARGET_FEDORA', m4_dnl On Fedora Runlevel 3 is multi-user Names=runlevel3.target )m4_dnl +m4_dnl +m4_ifdef(`TARGET_DEBIAN', +m4_dnl On Debian Runlevel 2, 3, 4 and 5 are multi-user +Names=runlevel2.target runlevel3.target runlevel4.target runlevel5.target +)m4_dnl -- 2.39.5