[PATCH 1/2] units: Merge halt/poweroff/reboot for the different distros
Santi
santi at agolina.net
Wed Sep 8 17:11:29 PDT 2010
---
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 ----------------
20 files changed, 156 insertions(+), 300 deletions(-)
delete mode 100644 units/arch/halt.service
delete mode 100644 units/arch/poweroff.service
delete mode 100644 units/arch/reboot.service
delete mode 100644 units/debian/halt.service
delete mode 100644 units/debian/poweroff.service
delete mode 100644 units/debian/reboot.service
delete mode 100644 units/fedora/halt.service
delete mode 100644 units/fedora/poweroff.service
delete mode 100644 units/fedora/reboot.service
delete mode 100644 units/gentoo/halt.service
delete mode 100644 units/gentoo/poweroff.service
delete mode 100644 units/gentoo/reboot.service
create mode 100644 units/halt.service.m4
create mode 100644 units/poweroff.service.m4
create mode 100644 units/reboot.service.m4
delete mode 100644 units/suse/halt.service
delete mode 100644 units/suse/poweroff.service
delete mode 100644 units/suse/reboot.service
diff --git a/Makefile.am b/Makefile.am
index e1fe9e6..1204ee0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -174,6 +174,9 @@ nodist_systemunit_DATA = \
units/graphical.target \
units/remote-fs.target \
units/multi-user.target \
+ units/halt.service \
+ units/poweroff.service \
+ units/reboot.service \
units/systemd-initctl.service \
units/systemd-logger.service \
units/systemd-shutdownd.service \
@@ -200,6 +203,9 @@ EXTRA_DIST = \
units/graphical.target.m4 \
units/multi-user.target.m4 \
units/remote-fs.target.m4 \
+ units/halt.service.m4 \
+ units/poweroff.service.m4 \
+ units/reboot.service.m4 \
units/systemd-initctl.service.in \
units/systemd-logger.service.in \
units/systemd-shutdownd.service.in \
@@ -216,12 +222,9 @@ EXTRA_DIST = \
if TARGET_FEDORA
dist_systemunit_DATA += \
- units/fedora/halt.service \
units/fedora/killall.service \
- units/fedora/poweroff.service \
units/fedora/prefdm.service \
units/fedora/rc-local.service \
- units/fedora/reboot.service \
units/fedora/sysinit.service \
units/fedora/single.service \
units/fedora/plymouth-quit.service \
@@ -232,10 +235,7 @@ endif
if TARGET_DEBIAN
dist_systemunit_DATA += \
- units/debian/halt.service \
units/debian/killall.service \
- units/debian/poweroff.service \
- units/debian/reboot.service \
units/debian/fsck.target \
units/debian/umountfs.service \
units/debian/umountnfs.service \
@@ -244,28 +244,19 @@ endif
if TARGET_SUSE
dist_systemunit_DATA += \
- units/suse/halt.service \
- units/suse/poweroff.service \
- units/suse/reboot.service \
units/suse/fsck.target
endif
if TARGET_GENTOO
dist_systemunit_DATA += \
- units/gentoo/halt.service \
units/gentoo/killall.service \
- units/gentoo/poweroff.service \
- units/gentoo/reboot.service \
units/gentoo/xdm.service
endif
if TARGET_ARCH
dist_systemunit_DATA += \
units/arch/sysinit.service \
- units/arch/rc-local.service \
- units/arch/halt.service \
- units/arch/poweroff.service \
- units/arch/reboot.service
+ units/arch/rc-local.service
endif
dist_doc_DATA = \
diff --git a/units/.gitignore b/units/.gitignore
index a02b7f1..a682f58 100644
--- a/units/.gitignore
+++ b/units/.gitignore
@@ -17,3 +17,6 @@ remote-fs.target
systemd-update-utmp-runlevel.service
systemd-update-utmp-shutdown.service
test-env-replace
+halt.service
+poweroff.service
+reboot.service
diff --git a/units/arch/halt.service b/units/arch/halt.service
deleted file mode 100644
index 2079bc0..0000000
--- a/units/arch/halt.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
-Requires=shutdown.target umount.target
-After=shutdown.target umount.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=RUNLEVEL=0
-ExecStart=/etc/rc.shutdown
-StandardOutput=tty
diff --git a/units/arch/poweroff.service b/units/arch/poweroff.service
deleted file mode 100644
index df2812f..0000000
--- a/units/arch/poweroff.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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=Power-Off
-DefaultDependencies=no
-Requires=shutdown.target umount.target
-After=shutdown.target umount.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=RUNLEVEL=0
-ExecStart=/etc/rc.shutdown
-StandardOutput=tty
diff --git a/units/arch/reboot.service b/units/arch/reboot.service
deleted file mode 100644
index ae5c979..0000000
--- a/units/arch/reboot.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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=Reboot
-DefaultDependencies=no
-Requires=shutdown.target umount.target
-After=shutdown.target umount.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=RUNLEVEL=6
-ExecStart=/etc/rc.shutdown
-StandardOutput=tty
diff --git a/units/debian/halt.service b/units/debian/halt.service
deleted file mode 100644
index 96061be..0000000
--- a/units/debian/halt.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
-Requires=shutdown.target umount.target killall.service
-After=shutdown.target umount.target killall.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=INIT_HALT=HALT RUNLEVEL=0
-ExecStart=/etc/init.d/halt stop
-StandardOutput=tty
diff --git a/units/debian/poweroff.service b/units/debian/poweroff.service
deleted file mode 100644
index 34a6683..0000000
--- a/units/debian/poweroff.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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=Power-Off
-DefaultDependencies=no
-Requires=shutdown.target umount.target killall.service
-After=shutdown.target umount.target killall.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=RUNLEVEL=0
-ExecStart=/etc/init.d/halt stop
-StandardOutput=tty
diff --git a/units/debian/reboot.service b/units/debian/reboot.service
deleted file mode 100644
index 99f259e..0000000
--- a/units/debian/reboot.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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=Reboot
-DefaultDependencies=no
-Requires=shutdown.target umount.target killall.service
-After=shutdown.target umount.target killall.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=RUNLEVEL=6
-ExecStart=/etc/init.d/reboot stop
-StandardOutput=tty
diff --git a/units/fedora/halt.service b/units/fedora/halt.service
deleted file mode 100644
index c337dce..0000000
--- a/units/fedora/halt.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
-Requires=shutdown.target umount.target killall.service
-After=shutdown.target umount.target killall.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=INIT_HALT=HALT RUNLEVEL=0
-ExecStart=/etc/init.d/halt start
-StandardOutput=tty
diff --git a/units/fedora/poweroff.service b/units/fedora/poweroff.service
deleted file mode 100644
index dbbed75..0000000
--- a/units/fedora/poweroff.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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=Power-Off
-DefaultDependencies=no
-Requires=shutdown.target umount.target killall.service
-After=shutdown.target umount.target killall.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=RUNLEVEL=0
-ExecStart=/etc/init.d/halt start
-StandardOutput=tty
diff --git a/units/fedora/reboot.service b/units/fedora/reboot.service
deleted file mode 100644
index ca8b3b1..0000000
--- a/units/fedora/reboot.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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=Reboot
-DefaultDependencies=no
-Requires=shutdown.target umount.target killall.service
-After=shutdown.target umount.target killall.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=RUNLEVEL=6
-ExecStart=/etc/init.d/reboot start
-StandardOutput=tty
diff --git a/units/gentoo/halt.service b/units/gentoo/halt.service
deleted file mode 100644
index d97b942..0000000
--- a/units/gentoo/halt.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
-Requires=shutdown.target umount.target killall.service
-After=shutdown.target umount.target killall.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=INIT_HALT=HALT RC_DOWN_HARDDISK=yes
-ExecStart=/etc/init.d/shutdown.sh
-StandardOutput=tty
diff --git a/units/gentoo/poweroff.service b/units/gentoo/poweroff.service
deleted file mode 100644
index 2483f94..0000000
--- a/units/gentoo/poweroff.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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=Power-Off
-DefaultDependencies=no
-Requires=shutdown.target umount.target killall.service
-After=shutdown.target umount.target killall.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=RC_DOWN_HARDDISK=yes
-ExecStart=/etc/init.d/shutdown.sh
-StandardOutput=tty
diff --git a/units/gentoo/reboot.service b/units/gentoo/reboot.service
deleted file mode 100644
index 8f8d732..0000000
--- a/units/gentoo/reboot.service
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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=Reboot
-DefaultDependencies=no
-Requires=shutdown.target umount.target killall.service
-After=shutdown.target umount.target killall.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-ExecStart=/etc/init.d/reboot.sh
-StandardOutput=tty
diff --git a/units/halt.service.m4 b/units/halt.service.m4
new file mode 100644
index 0000000..77b274a
--- /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
diff --git a/units/poweroff.service.m4 b/units/poweroff.service.m4
new file mode 100644
index 0000000..ed95f8b
--- /dev/null
+++ b/units/poweroff.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=Power-Off
+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=RUNLEVEL=0
+ExecStart=/etc/init.d/halt start
+)m4_dnl
+m4_ifdef(`TARGET_SUSE',
+Environment=COLD_BOOT=1
+ExecStart=/etc/init.d/halt
+)m4_dnl
+m4_ifdef(`TARGET_DEBIAN',
+Environment=RUNLEVEL=0
+ExecStart=/etc/init.d/halt stop
+)m4_dnl
+m4_ifdef(`TARGET_GENTOO',
+Environment=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
diff --git a/units/reboot.service.m4 b/units/reboot.service.m4
new file mode 100644
index 0000000..4d266a1
--- /dev/null
+++ b/units/reboot.service.m4
@@ -0,0 +1,48 @@
+# 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=Reboot
+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=RUNLEVEL=6
+ExecStart=/etc/init.d/reboot start
+)m4_dnl
+m4_ifdef(`TARGET_SUSE',
+Environment=COLD_BOOT=1
+ExecStart=/etc/init.d/reboot
+)m4_dnl
+m4_ifdef(`TARGET_DEBIAN',
+Environment=RUNLEVEL=6
+ExecStart=/etc/init.d/reboot stop
+)m4_dnl
+m4_ifdef(`TARGET_GENTOO',
+ExecStart=/etc/init.d/reboot.sh
+)m4_dnl
+m4_ifdef(`TARGET_ARCH',
+Environment=RUNLEVEL=6
+ExecStart=/etc/rc.shutdown
+)m4_dnl
+StandardOutput=tty
diff --git a/units/suse/halt.service b/units/suse/halt.service
deleted file mode 100644
index d826ca3..0000000
--- a/units/suse/halt.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
-Requires=shutdown.target umount.target
-After=shutdown.target umount.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=INIT_HALT=HALT RUNLEVEL=0 COLD_BOOT=1
-ExecStart=/etc/init.d/halt
-StandardOutput=tty
diff --git a/units/suse/poweroff.service b/units/suse/poweroff.service
deleted file mode 100644
index fe8c677..0000000
--- a/units/suse/poweroff.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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=Power-Off
-DefaultDependencies=no
-Requires=shutdown.target umount.target
-After=shutdown.target umount.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=COLD_BOOT=1
-ExecStart=/etc/init.d/halt
-StandardOutput=tty
diff --git a/units/suse/reboot.service b/units/suse/reboot.service
deleted file mode 100644
index 001d136..0000000
--- a/units/suse/reboot.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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=Reboot
-DefaultDependencies=no
-Requires=shutdown.target umount.target
-After=shutdown.target umount.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=COLD_BOOT=1
-ExecStart=/etc/init.d/reboot
-StandardOutput=tty
--
1.7.1.765.gb5868
More information about the systemd-devel
mailing list