Blob Blame History Raw
From f653c8622995fc39d0715a6bed60618c61ed0b5e Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 21 Jun 2012 01:05:15 +0200
Subject: [PATCH] systemd/dracut-cmdline: make dracut-cmdline a service

convert dracut-cmdline from hook to service after the journal
---
 modules.d/98systemd/dracut-cmdline.service |   29 ++++++++++++++++++++++++++++
 modules.d/98systemd/module-setup.sh        |    7 +++++--
 2 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 modules.d/98systemd/dracut-cmdline.service

diff --git a/modules.d/98systemd/dracut-cmdline.service b/modules.d/98systemd/dracut-cmdline.service
new file mode 100644
index 0000000..938ccbe
--- /dev/null
+++ b/modules.d/98systemd/dracut-cmdline.service
@@ -0,0 +1,29 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=Dracut cmdline hook
+DefaultDependencies=no
+Before=dracut-pre-udev.service
+After=systemd-journald.socket
+Wants=systemd-journald.socket
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStart=-/bin/dracut-cmdline
+Type=oneshot
+StandardInput=null
+StandardOutput=syslog
+StandardError=syslog+console
+KillMode=process
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
index 91f50af..adef939 100755
--- a/modules.d/98systemd/module-setup.sh
+++ b/modules.d/98systemd/module-setup.sh
@@ -130,9 +130,12 @@ install() {
     inst "$moddir/initrd-switch-root.service" ${systemdsystemunitdir}/initrd-switch-root.service
     ln -s basic.target "${initdir}${systemdsystemunitdir}/default.target"
 
-    inst "$moddir/dracut-cmdline.sh" ${systemdsystemunitdir}-generators/dracut-cmdline.sh
-
     mkdir -p "${initdir}${systemdsystemunitdir}/basic.target.wants"
+
+    inst "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
+    inst "$moddir/dracut-cmdline.service" ${systemdsystemunitdir}/dracut-cmdline.service
+    ln -s ../dracut-cmdline.service "${initdir}${systemdsystemunitdir}/basic.target.wants/dracut-cmdline.service"
+
     inst "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev
     inst "$moddir/dracut-pre-udev.service" ${systemdsystemunitdir}/dracut-pre-udev.service
     ln -s ../dracut-pre-udev.service "${initdir}${systemdsystemunitdir}/basic.target.wants/dracut-pre-udev.service"