]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
systemd: changes for new initrd services
authorHarald Hoyer <harald@redhat.com>
Wed, 6 Mar 2013 15:19:29 +0000 (16:19 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 6 Mar 2013 16:21:47 +0000 (17:21 +0100)
Requires systemd >= 198

22 files changed:
Makefile
dracut.spec
modules.d/98systemd/dracut-cmdline.service
modules.d/98systemd/dracut-cmdline.sh
modules.d/98systemd/dracut-emergency.service
modules.d/98systemd/dracut-emergency.sh [new file with mode: 0755]
modules.d/98systemd/dracut-initqueue.service
modules.d/98systemd/dracut-initqueue.sh
modules.d/98systemd/dracut-mount.service.8.asc [new file with mode: 0644]
modules.d/98systemd/dracut-pre-mount.service.8.asc [new file with mode: 0644]
modules.d/98systemd/dracut-pre-pivot.service
modules.d/98systemd/dracut-pre-pivot.sh
modules.d/98systemd/dracut-pre-trigger.service
modules.d/98systemd/dracut-pre-trigger.sh
modules.d/98systemd/dracut-pre-udev.service
modules.d/98systemd/dracut-pre-udev.sh
modules.d/98systemd/emergency.service [new file with mode: 0644]
modules.d/98systemd/initrd-switch-root.service [deleted file]
modules.d/98systemd/initrd-switch-root.service.8.asc [deleted file]
modules.d/98systemd/initrd-switch-root.target [deleted file]
modules.d/98systemd/module-setup.sh
modules.d/98systemd/service-to-run.sh [deleted file]

index 2a92d04865ddfd696f0b7e6ebeb0fda88ec73fb8..4a8fa0daba2fb183d90a1b41a4065dbb03d72baa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,6 @@ man8pages = dracut.8 \
             modules.d/98systemd/dracut-pre-pivot.service.8 \
             modules.d/98systemd/dracut-pre-trigger.service.8 \
             modules.d/98systemd/dracut-pre-udev.service.8 \
-            modules.d/98systemd/initrd-switch-root.service.8 \
             modules.d/98systemd/udevadm-cleanup-db.service.8
 
 manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
index 7d1bbbc38451fe892670806549414321cea5512b..a2c1a4ab3d27399b5ba157559b18142084194a82 100644 (file)
@@ -86,7 +86,7 @@ Requires: udev > 166
 Requires: kbd kbd-misc
 %if 0%{?fedora} || 0%{?rhel} > 6
 Requires: util-linux >= 2.21
-Conflicts: systemd < 187
+Conflicts: systemd < 198
 %else
 Requires: util-linux-ng >= 2.21
 %endif
index 4aba918b6cc72a002790f44592ee3ef054d80359..33a37f9f8dff2842ded31d9b41fdc23e7053dcbe 100644 (file)
@@ -16,6 +16,11 @@ Before=systemd-vconsole-setup.service
 After=systemd-journald.socket
 Wants=systemd-journald.socket
 ConditionPathExists=/etc/initrd-release
+ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
+ConditionDirectoryNotEmpty=|/lib/dracut/hooks/cmdline
+ConditionKernelCommandLine=|rd.break=cmdline
+ConditionKernelCommandLine=|resume
+ConditionKernelCommandLine=|noresume
 
 [Service]
 Type=oneshot
@@ -24,6 +29,7 @@ StandardInput=null
 StandardOutput=syslog
 StandardError=syslog+console
 KillMode=process
+RemainAfterExit=yes
 
 # Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
 # terminates cleanly.
index cec1b6449c8f4b22d9bc6fc3799f235f970b8305..fb306b23d372c034981b2d20fea2132b6a832ea6 100755 (executable)
@@ -22,15 +22,57 @@ getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug &&
 
 source_conf /etc/conf.d
 
+root=$(getarg root=)
+
+rflags="$(getarg rootflags=)"
+getargbool 0 ro && rflags="${rflags},ro"
+getargbool 0 rw && rflags="${rflags},rw"
+rflags="${rflags#,}"
+
+fstype="$(getarg rootfstype=)"
+if [ -z "$fstype" ]; then
+    fstype="auto"
+fi
+
+export root
+export rflags
+export fstype
+
 make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
 # run scriptlets to parse the command line
 getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
 source_hook cmdline
 
+[ -f /lib/dracut/parse-resume.sh ] && . /lib/dracut/parse-resume.sh
+
+case "$root" in
+    block:LABEL=*|LABEL=*)
+        root="${root#block:}"
+        root="$(echo $root | sed 's,/,\\x2f,g')"
+        root="block:/dev/disk/by-label/${root#LABEL=}"
+        rootok=1 ;;
+    block:UUID=*|UUID=*)
+        root="${root#block:}"
+        root="block:/dev/disk/by-uuid/${root#UUID=}"
+        rootok=1 ;;
+    block:PARTUUID=*|PARTUUID=*)
+        root="${root#block:}"
+        root="block:/dev/disk/by-partuuid/${root#PARTUUID=}"
+        rootok=1 ;;
+    /dev/*)
+        root="block:${root}"
+        rootok=1 ;;
+esac
+
+[ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}"
+
 [ -z "$root" ] && die "No or empty root= argument"
 [ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
 
 export root rflags fstype netroot NEWROOT
 
 export -p > /dracut-state.sh
+
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
 exit 0
index b273d84aedce017ec44c103096e20fb475c4e1a3..153931b284f6f309266c741894816e79ebc64fe9 100644 (file)
@@ -8,18 +8,16 @@
 # See systemd.special(7) for details
 
 [Unit]
-Description=Emergency Shell
+Description=Dracut Emergency Shell
 DefaultDependencies=no
 After=systemd-vconsole-setup.service
 Wants=systemd-vconsole-setup.service
+Conflicts=emergency.service emergency.target
 
 [Service]
 Environment=HOME=/
 WorkingDirectory=/
-ExecStartPre=-/bin/plymouth quit
-ExecStartPre=-/sbin/sosreport
-ExecStartPre=-/bin/echo -e '\n\nEntering emergency mode. Exit the shell to continue.\nType "journalctl" to view system logs.\nYou might want to save "/run/initramfs/sosreport.txt" to a USB stick or /boot\nafter mounting them and attach it to a bug report.\n\n'
-ExecStart=-/bin/sh -i -l
+ExecStart=/bin/dracut-emergency
 ExecStopPost=-/bin/rm -f /.console_lock
 Type=oneshot
 StandardInput=tty-force
diff --git a/modules.d/98systemd/dracut-emergency.sh b/modules.d/98systemd/dracut-emergency.sh
new file mode 100755 (executable)
index 0000000..a0a4b12
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+export DRACUT_SYSTEMD=1
+if [ -f /dracut-state.sh ]; then
+    . /dracut-state.sh 2>/dev/null
+fi
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+source_conf /etc/conf.d
+
+[ -x /bin/plymouth ] && /bin/plymouth quit
+
+export _rdshell_name="dracut" action="Boot" hook="emergency"
+
+source_hook "$hook"
+
+
+if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
+    echo
+    sosreport
+    echo
+    echo
+    echo 'Entering emergency mode. Exit the shell to continue.'
+    echo 'Type "journalctl" to view system logs.'
+    echo 'You might want to save "/run/initramfs/sosreport.txt" to a USB stick or /boot'
+    echo 'after mounting them and attach it to a bug report.'
+    echo
+    echo
+    [ -f /etc/profile ] && . /etc/profile
+    [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
+    exec sh -i -l
+else
+    warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
+    exit 1
+fi
+
+/bin/rm -f /.console_lock
+
+exit 0
index b852468f073e3066ae30b298a12c7e2cf88570ef..c19cfea5d00cf0c33a46845da0dc0fec64a58d51 100644 (file)
@@ -13,8 +13,10 @@ Documentation=man:dracut-initqueue.service(8)
 DefaultDependencies=no
 After=systemd-udev-trigger.service
 Wants=systemd-udev-trigger.service
-After=cryptsetup.target
 ConditionPathExists=/etc/initrd-release
+ConditionPathExists=|/lib/dracut/need-initqueue
+ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/*.sh
+ConditionKernelCommandLine=|rd.break=pre-mount
 
 [Service]
 Type=oneshot
@@ -23,6 +25,7 @@ StandardInput=null
 StandardOutput=syslog
 StandardError=syslog+console
 KillMode=process
+RemainAfterExit=yes
 
 # Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
 # terminates cleanly.
index ae449fe7b8ceb4579e532437912ffca8e8349d72..326e203086f36fc3a4fb1c08e3f97f86934e0517 100755 (executable)
@@ -14,7 +14,7 @@ make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
 
 RDRETRY=$(getarg rd.retry -d 'rd_retry=')
-RDRETRY=${RDRETRY:-30}
+RDRETRY=${RDRETRY:-180}
 RDRETRY=$(($RDRETRY*2))
 export RDRETRY
 
@@ -57,6 +57,7 @@ while :; do
             [ -e "$job" ] || break
             job=$job . $job
             udevadm settle --timeout=0 >/dev/null 2>&1 || main_loop=0
+            [ -f $hookdir/initqueue/work ] && main_loop=0
         done
     fi
 
@@ -69,42 +70,8 @@ unset queuetriggered
 unset main_loop
 unset RDRETRY
 
-
-# pre-mount happens before we try to mount the root filesystem,
-# and happens once.
-getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
-source_hook pre-mount
-
-
-getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mount"
-# mount scripts actually try to mount the root filesystem, and may
-# be sourced any number of times. As soon as one suceeds, no more are sourced.
-i=0
-while :; do
-    if ismounted "$NEWROOT"; then
-        usable_root "$NEWROOT" && break;
-        umount "$NEWROOT"
-    fi
-    for f in $hookdir/mount/*.sh; do
-        [ -f "$f" ] && . "$f"
-        if ismounted "$NEWROOT"; then
-            usable_root "$NEWROOT" && break;
-            warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
-            umount "$NEWROOT"
-            rm -f "$f"
-        fi
-    done
-
-    i=$(($i+1))
-    [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
-done
-
-{
-    echo -n "Mounted root filesystem "
-    while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
-} | vinfo
-
-
 export -p > /dracut-state.sh
 
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
 exit 0
diff --git a/modules.d/98systemd/dracut-mount.service.8.asc b/modules.d/98systemd/dracut-mount.service.8.asc
new file mode 100644 (file)
index 0000000..23437ab
--- /dev/null
@@ -0,0 +1,25 @@
+DRACUT-MOUNT.SERVICE(8)
+===========================
+:doctype: manpage
+:man source:   dracut
+:man manual:   dracut
+
+NAME
+----
+dracut-mount.service - runs the dracut hooks after /sysroot is mounted
+
+SYNOPSIS
+--------
+dracut-mount.service
+
+DESCRIPTION
+-----------
+This service runs all dracut hooks after the real root is mounted on /sysroot.
+
+AUTHORS
+-------
+Harald Hoyer
+
+SEE ALSO
+--------
+*dracut*(8)
diff --git a/modules.d/98systemd/dracut-pre-mount.service.8.asc b/modules.d/98systemd/dracut-pre-mount.service.8.asc
new file mode 100644 (file)
index 0000000..861da53
--- /dev/null
@@ -0,0 +1,25 @@
+DRACUT-PRE-MOUNT.SERVICE(8)
+===========================
+:doctype: manpage
+:man source:   dracut
+:man manual:   dracut
+
+NAME
+----
+dracut-pre-mount.service - runs the dracut hooks before /sysroot is mounted
+
+SYNOPSIS
+--------
+dracut-pre-mount.service
+
+DESCRIPTION
+-----------
+This service runs all dracut hooks before the real root is mounted on /sysroot.
+
+AUTHORS
+-------
+Harald Hoyer
+
+SEE ALSO
+--------
+*dracut*(8)
index 0221828d80b7d7b9c29e2ec7223ec0fecefa3eb7..40a0fb15a61e624ab87cafdf15c21ff688e39c06 100644 (file)
 Description=dracut pre-pivot and cleanup hook
 Documentation=man:dracut-pre-pivot.service(8)
 DefaultDependencies=no
-After=dracut-initqueue.service
+After=dracut-mount.service dracut-initqueue.service initrd-parse-etc.service local-fs.target
+Wants=local-fs.target
+Before=initrd-cleanup.service
 ConditionPathExists=/etc/initrd-release
+ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot
+ConditionKernelCommandLine=|rd.break=pre-pivot
 
 [Service]
 Type=oneshot
 ExecStart=-/bin/dracut-pre-pivot
-ExecStopPost=-/usr/bin/systemctl --no-block isolate initrd-switch-root.target
 StandardInput=null
 StandardOutput=syslog
 StandardError=syslog+console
index 0c259b1bd2de602c22c4fbadb21147d76aa86817..5d47ce219a296e451e3408c18fb4ffad213b005c 100755 (executable)
@@ -20,25 +20,11 @@ source_hook pre-pivot
 getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
 source_hook cleanup
 
-# By the time we get here, the root filesystem should be mounted.
-# Try to find init.
-
-for i in "$(getarg real_init=)" "$(getarg init=)"; do
-    [ -n "$i" ] || continue
-
-    __p=$(readlink -f "${NEWROOT}/${i}")
-    if [ -x "$__p" ]; then
-        INIT="$i"
-        echo "NEWINIT=\"$INIT\"" > /etc/switch-root.conf
-        break
-    fi
-done
-
-echo "NEWROOT=\"$NEWROOT\"" >> /etc/switch-root.conf
-
 getarg rd.break -d rdbreak && emergency_shell -n switch_root "Break before switch_root"
 
 # remove helper symlink
 [ -h /dev/root ] && rm -f /dev/root
 
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
 exit 0
index 55c9938682a6a25979783cadffa7cca9c2f63704..e49e405a2d160c2728e20f8a72c3a94396802abe 100644 (file)
@@ -25,6 +25,7 @@ StandardInput=null
 StandardOutput=syslog
 StandardError=syslog+console
 KillMode=process
+RemainAfterExit=yes
 
 # Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
 # terminates cleanly.
index 4685c8f910c9d9fb71fae26b40a98b2e996d80b4..4e8e84405a530703e5783ca4b290e4d11f7d5dba 100755 (executable)
@@ -19,4 +19,7 @@ getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-tr
 udevadm control --reload >/dev/null 2>&1 || :
 
 export -p > /dracut-state.sh
+
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
 exit 0
index ee2c2e1b413dfbd543cd545e0a197c02f82bb294..b3723738e63376b651c993fc156bca29f3164c36 100644 (file)
@@ -17,6 +17,9 @@ Wants=dracut-cmdline.service
 ConditionPathExists=/etc/initrd-release
 ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-udev
 ConditionKernelCommandLine=|rd.break=pre-udev
+ConditionKernelCommandLine=|rd.driver.blacklist
+ConditionKernelCommandLine=|rd.driver.pre
+ConditionKernelCommandLine=|rd.driver.post
 
 [Service]
 Type=oneshot
@@ -25,6 +28,7 @@ StandardInput=null
 StandardOutput=syslog
 StandardError=syslog+console
 KillMode=process
+RemainAfterExit=yes
 
 # Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
 # terminates cleanly.
index d20e6137c136090dac65ed424771b22a7ba24089..afbd61f0a6c699bfe2b549823aff1c73d42780f6 100755 (executable)
@@ -15,5 +15,46 @@ make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break pre-udev"
 source_hook pre-udev
 
+_modprobe_d=/etc/modprobe.d
+if [ -d /usr/lib/modprobe.d ] ; then
+    _modprobe_d=/usr/lib/modprobe.d
+elif [ -d /lib/modprobe.d ] ; then
+    _modprobe_d=/lib/modprobe.d
+elif [ ! -d $_modprobe_d ] ; then
+    mkdir -p $_modprobe_d
+fi
+
+for i in $(getargs rd.driver.pre -d rdloaddriver=); do
+    (
+        IFS=,
+        for p in $i; do
+            modprobe $p 2>&1 | vinfo
+        done
+    )
+done
+
+
+[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
+
+for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
+    (
+        IFS=,
+        for p in $i; do
+            echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
+        done
+    )
+done
+
+for p in $(getargs rd.driver.post -d rdinsmodpost=); do
+    echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
+    _do_insmodpost=1
+done
+
+[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
+unset _do_insmodpost _modprobe_d
+unset i
+
 export -p > /dracut-state.sh
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
 exit 0
diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
new file mode 100644 (file)
index 0000000..22115be
--- /dev/null
@@ -0,0 +1,30 @@
+#  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=Emergency Shell
+DefaultDependencies=no
+After=systemd-vconsole-setup.service
+Wants=systemd-vconsole-setup.service
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStart=/bin/dracut-emergency
+ExecStopPost=-/usr/bin/systemctl --no-block isolate dracut.target
+Type=oneshot
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+IgnoreSIGPIPE=no
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/modules.d/98systemd/initrd-switch-root.service b/modules.d/98systemd/initrd-switch-root.service
deleted file mode 100644 (file)
index e263980..0000000
+++ /dev/null
@@ -1,25 +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 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.
-
-[Unit]
-Description=Switch Root
-Documentation=man:initrd-switch-root.service(8)
-DefaultDependencies=no
-ConditionPathExists=/etc/initrd-release
-OnFailure=emergency.service
-After=initrd-switch-root.target
-AllowIsolate=yes
-
-[Service]
-Type=oneshot
-EnvironmentFile=/etc/switch-root.conf
-# we have to use "--force" here, otherwise systemd would umount /run
-ExecStart=-/usr/bin/systemctl --no-block --force switch-root ${NEWROOT} ${NEWINIT}
-StandardInput=null
-StandardOutput=null
-StandardError=null
-KillMode=none
diff --git a/modules.d/98systemd/initrd-switch-root.service.8.asc b/modules.d/98systemd/initrd-switch-root.service.8.asc
deleted file mode 100644 (file)
index 73d5c91..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-INITRD-SWITCH-ROOT.SERVICE(8)
-=============================
-:doctype: manpage
-:man source:   dracut
-:man manual:   dracut
-
-NAME
-----
-initrd-switch-root.service - switches root to the real root
-
-SYNOPSIS
---------
-initrd-switch-root.service
-
-DESCRIPTION
------------
-This service triggers systemd to switch root from the initramfs to the real root.
-
-AUTHORS
--------
-Harald Hoyer
-
-SEE ALSO
---------
-*dracut*(8)
diff --git a/modules.d/98systemd/initrd-switch-root.target b/modules.d/98systemd/initrd-switch-root.target
deleted file mode 100644 (file)
index 05e0117..0000000
+++ /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 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=Switch Root
-DefaultDependencies=no
-Requires=initrd-switch-root.service
-Before=initrd-switch-root.service
-After=cryptsetup.target
-AllowIsolate=yes
-Wants=systemd-journald.service
-ConditionPathExists=/etc/initrd-release
index db1f1b49edef09c35aa896ebe3e5ab54366c4c74..ccd4319fdf4b16132cd3f7cd171174861bd6ec26 100755 (executable)
@@ -31,6 +31,8 @@ install() {
         $systemdutildir/systemd-journald \
         $systemdutildir/systemd-sysctl \
         $systemdutildir/systemd-modules-load \
+        $systemdutildir/system-generators/systemd-fstab-generator \
+        $systemdsystemunitdir/cryptsetup.target \
         $systemdsystemunitdir/emergency.target \
         $systemdsystemunitdir/sysinit.target \
         $systemdsystemunitdir/basic.target \
@@ -59,7 +61,6 @@ install() {
         $systemdsystemunitdir/systemd-journald.socket \
         $systemdsystemunitdir/systemd-ask-password-console.service \
         $systemdsystemunitdir/systemd-modules-load.service \
-        $systemdsystemunitdir/emergency.service \
         $systemdsystemunitdir/halt.service \
         $systemdsystemunitdir/systemd-halt.service \
         $systemdsystemunitdir/poweroff.service \
@@ -89,8 +90,12 @@ install() {
         $systemdsystemunitdir/syslog.target \
         $systemdsystemunitdir/initrd-switch-root.target \
         $systemdsystemunitdir/initrd-switch-root.service \
+        $systemdsystemunitdir/initrd-cleanup.service \
+        $systemdsystemunitdir/initrd-udevadm-cleanup-db.service \
+        $systemdsystemunitdir/initrd-parse-etc.service \
+\
         $systemdsystemunitdir/umount.target \
-        journalctl systemctl echo swapoff
+        journalctl systemctl echo swapoff systemd-cgls
 
     dracut_install -o \
         /usr/lib/modules-load.d/*.conf
@@ -120,46 +125,57 @@ install() {
     ln -fs $systemdutildir/systemd "$initdir/init"
     ln -fs $systemdutildir/systemd "$initdir/sbin/init"
 
+    inst_script "$moddir/dracut-emergency.sh" /bin/dracut-emergency
+    inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/emergency.service
     inst_simple "$moddir/dracut-emergency.service" ${systemdsystemunitdir}/dracut-emergency.service
-    inst_simple "$moddir/rescue.service" ${systemdsystemunitdir}/rescue.service
-    ln -fs "basic.target" "${initdir}${systemdsystemunitdir}/default.target"
+    inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/rescue.service
 
     dracutsystemunitdir="/etc/systemd/system"
 
-    mkdir -p "${initdir}${dracutsystemunitdir}/basic.target.wants"
-    mkdir -p "${initdir}${dracutsystemunitdir}/sysinit.target.wants"
+    mkdir -p "${initdir}${dracutsystemunitdir}/dracut.target.wants"
+
+    mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.d"
+    {
+        echo "[Unit]"
+        echo "After="
+        echo "After=emergency.service emergency.target"
+    } > "${initdir}${systemdsystemunitdir}/sysinit.target.d/nolocalfs.conf"
 
-    inst_simple "$moddir/initrd-switch-root.target" ${dracutsystemunitdir}/initrd-switch-root.target
-    inst_simple "$moddir/initrd-switch-root.service" ${dracutsystemunitdir}/initrd-switch-root.service
+    inst_simple "$moddir/dracut.target" ${dracutsystemunitdir}/dracut.target
+    ln -fs ${dracutsystemunitdir}/dracut.target "${initdir}${systemdsystemunitdir}/default.target"
 
     inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
     inst_simple "$moddir/dracut-cmdline.service" ${dracutsystemunitdir}/dracut-cmdline.service
-    ln -fs ../dracut-cmdline.service "${initdir}${dracutsystemunitdir}/sysinit.target.wants/dracut-cmdline.service"
+    ln -fs ../dracut-cmdline.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-cmdline.service"
 
     inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev
     inst_simple "$moddir/dracut-pre-udev.service" ${dracutsystemunitdir}/dracut-pre-udev.service
-    ln -fs ../dracut-pre-udev.service "${initdir}${dracutsystemunitdir}/sysinit.target.wants/dracut-pre-udev.service"
+    ln -fs ../dracut-pre-udev.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-udev.service"
 
     inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger
     inst_simple "$moddir/dracut-pre-trigger.service" ${dracutsystemunitdir}/dracut-pre-trigger.service
-    ln -fs ../dracut-pre-trigger.service "${initdir}${dracutsystemunitdir}/sysinit.target.wants/dracut-pre-trigger.service"
+    ln -fs ../dracut-pre-trigger.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-trigger.service"
 
     inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue
     inst_simple "$moddir/dracut-initqueue.service" ${dracutsystemunitdir}/dracut-initqueue.service
-    ln -fs ../dracut-initqueue.service "${initdir}${dracutsystemunitdir}/basic.target.wants/dracut-initqueue.service"
+    ln -fs ../dracut-initqueue.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-initqueue.service"
+
+    inst_script "$moddir/dracut-pre-mount.sh" /bin/dracut-pre-mount
+    inst_simple "$moddir/dracut-pre-mount.service" ${dracutsystemunitdir}/dracut-pre-mount.service
+    ln -fs ../dracut-pre-mount.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-mount.service"
+
+    inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount
+    inst_simple "$moddir/dracut-mount.service" ${dracutsystemunitdir}/dracut-mount.service
+    ln -fs ../dracut-mount.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-mount.service"
 
     inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot
     inst_simple "$moddir/dracut-pre-pivot.service" ${dracutsystemunitdir}/dracut-pre-pivot.service
-    ln -fs ../dracut-pre-pivot.service "${initdir}${dracutsystemunitdir}/basic.target.wants/dracut-pre-pivot.service"
+    ln -fs ../dracut-pre-pivot.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-pivot.service"
 
-    inst_simple "$moddir/udevadm-cleanup-db.service" ${dracutsystemunitdir}/udevadm-cleanup-db.service
-    mkdir -p "${initdir}${dracutsystemunitdir}/initrd-switch-root.target.requires"
-    ln -fs ../udevadm-cleanup-db.service "${initdir}${dracutsystemunitdir}/initrd-switch-root.target.requires/udevadm-cleanup-db.service"
+    ln -fs ../initrd-parse-etc.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/initrd-parse-etc.service"
 
-    inst_script "$moddir/service-to-run.sh" "${systemdutildir}/system-generators/service-to-run"
     inst_rules 99-systemd.rules
 
-
     for i in \
         emergency.target \
         dracut-emergency.service \
@@ -167,9 +183,9 @@ install() {
         systemd-ask-password-console.service \
         systemd-ask-password-plymouth.service \
         ; do
-        mkdir -p "${initdir}${dracutsystemunitdir}/${i}.requires"
+        mkdir -p "${initdir}${dracutsystemunitdir}/${i}.wants"
         ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \
-            "${dracutsystemunitdir}/${i}.requires/systemd-vconsole-setup.service"
+            "${dracutsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
     done
 
     # turn off RateLimit for journal
diff --git a/modules.d/98systemd/service-to-run.sh b/modules.d/98systemd/service-to-run.sh
deleted file mode 100755 (executable)
index d4225be..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-mkdir -p /run/systemd/system/
-cp -d -t /run/systemd/system/ /etc/systemd/system/* 2>/dev/null
-exit 0
-