From b43cfc878e9a2bf2ac7ad4259d947b2ff82a6123 Mon Sep 17 00:00:00 2001
From: Marius Orcsik <marius@habarnam.ro>
Date: Tue, 18 May 2010 23:59:19 +0200
Subject: [PATCH] Initial commit of arch specific services - it should result in a bootable configuration

---
 Makefile.am                 |   11 +++++++++++
 units/arch/halt.service     |   28 ++++++++++++++++++++++++++++
 units/arch/killall.service  |   25 +++++++++++++++++++++++++
 units/arch/poweroff.service |   27 +++++++++++++++++++++++++++
 units/arch/prefdm.service   |   26 ++++++++++++++++++++++++++
 units/arch/rc-local.service |   33 +++++++++++++++++++++++++++++++++
 units/arch/reboot.service   |   27 +++++++++++++++++++++++++++
 units/arch/sysinit.service  |   27 +++++++++++++++++++++++++++
 units/getty@.service.m4     |    1 +
 9 files changed, 205 insertions(+), 0 deletions(-)
 create mode 100644 units/arch/halt.service
 create mode 100644 units/arch/killall.service
 create mode 100644 units/arch/poweroff.service
 create mode 100644 units/arch/prefdm.service
 create mode 100644 units/arch/rc-local.service
 create mode 100644 units/arch/reboot.service
 create mode 100644 units/arch/sysinit.service

diff --git a/Makefile.am b/Makefile.am
index 3589b73..4a7b014 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -129,6 +129,17 @@ dist_systemunit_DATA += \
 	units/fedora/sysinit.service
 endif
 
+if TARGET_ARCH
+dist_systemunit_DATA += \
+	units/arch/halt.service \
+	units/arch/killall.service \
+	units/arch/poweroff.service \
+	units/arch/prefdm.service \
+	units/arch/rc-local.service \
+	units/arch/reboot.service \
+	units/arch/sysinit.service
+endif
+
 # This is needed because automake is buggy in how it generates the
 # rules for C programs, but not Vala programs.  We therefore can't
 # list the .h files as dependencies if we want make dist to work.
diff --git a/units/arch/halt.service b/units/arch/halt.service
new file mode 100644
index 0000000..b1390b8
--- /dev/null
+++ b/units/arch/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 <http://www.gnu.org/licenses/>.
+
+[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=/sbin/halt
diff --git a/units/arch/killall.service b/units/arch/killall.service
new file mode 100644
index 0000000..8622923
--- /dev/null
+++ b/units/arch/killall.service
@@ -0,0 +1,25 @@
+#  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 <http://www.gnu.org/licenses/>.
+
+[Unit]
+Description=Kill All Processes
+After=shutdown.target
+
+[Service]
+Type=finish
+ValidNoProcess=yes
+ExecStart=/sbin/killall5 -15
diff --git a/units/arch/poweroff.service b/units/arch/poweroff.service
new file mode 100644
index 0000000..8fc0cff
--- /dev/null
+++ b/units/arch/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 <http://www.gnu.org/licenses/>.
+
+[Unit]
+Description=Power-Off
+Requires=shutdown.target killall.service
+After=shutdown.target killall.service
+
+[Service]
+Type=finish
+ValidNoProcess=yes
+Environment=RUNLEVEL=0
+ExecStart=/sbin/poweroff
diff --git a/units/arch/prefdm.service b/units/arch/prefdm.service
new file mode 100644
index 0000000..227ffba
--- /dev/null
+++ b/units/arch/prefdm.service
@@ -0,0 +1,26 @@
+#  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 <http://www.gnu.org/licenses/>.
+
+[Unit]
+Description=Display Manager
+Before=graphical.target
+After=basic.target syslog.target messagebus.service haldaemon.service
+Conflicts=shutdown.target
+
+[Service]
+ExecStart=/etc/X11/prefdm -nodaemon
+Type=simple
diff --git a/units/arch/rc-local.service b/units/arch/rc-local.service
new file mode 100644
index 0000000..7342ac9
--- /dev/null
+++ b/units/arch/rc-local.service
@@ -0,0 +1,33 @@
+#  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 <http://www.gnu.org/licenses/>.
+
+[Unit]
+Description=/etc/rc.local Compatibility
+Requires=basic.target
+Conflicts=shutdown.target
+
+# The rcN.d symlink uses the name "local" while the script itself is
+# called "rc.local", hence carry both names here.
+Names=rc-local.service local.service
+
+[Service]
+ExecStart=/etc/rc.local
+Type=simple
+TimeoutSec=0
+StandardInput=tty
+ValidNoProcess=yes
+SysVStartPriority=99
diff --git a/units/arch/reboot.service b/units/arch/reboot.service
new file mode 100644
index 0000000..9c7818e
--- /dev/null
+++ b/units/arch/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 <http://www.gnu.org/licenses/>.
+
+[Unit]
+Description=Reboot
+Requires=shutdown.target killall.service
+After=shutdown.target killall.service
+
+[Service]
+Type=finish
+ValidNoProcess=yes
+Environment=RUNLEVEL=6
+ExecStart=/sbin/reboot -d -f -i
diff --git a/units/arch/sysinit.service b/units/arch/sysinit.service
new file mode 100644
index 0000000..f2098fd
--- /dev/null
+++ b/units/arch/sysinit.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 <http://www.gnu.org/licenses/>.
+
+[Unit]
+Description=System Initialization
+Before=local-fs.target remote-fs.target swap.target sockets.target
+
+[Service]
+ExecStart=/etc/rc.d/rc.sysinit
+Type=forking
+TimeoutSec=0
+StandardInput=tty
+ValidNoProcess=yes
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
index 890b489..9b41981 100644
--- a/units/getty@.service.m4
+++ b/units/getty@.service.m4
@@ -18,6 +18,7 @@
 m4_ifdef(`TARGET_FEDORA', `m4_define(`GETTY', `/sbin/mingetty')')m4_dnl
 m4_ifdef(`TARGET_DEBIAN', `m4_define(`GETTY', `/sbin/getty 38400')')m4_dnl
 m4_ifdef(`TARGET_GENTOO', `m4_define(`GETTY', `/sbin/agetty 38400')')m4_dnl
+m4_ifdef(`TARGET_ARCH', `m4_define(`GETTY', `/sbin/agetty 38400')')m4_dnl
 m4_dnl
 [Unit]
 Description=Getty on %I
-- 
1.7.1

