dracut-018-52.git20120509

- new upstream version
This commit is contained in:
Harald Hoyer 2012-05-09 15:14:33 +02:00
parent 0c26bf1316
commit 8020528b8d
13 changed files with 1342 additions and 1 deletions

View File

@ -0,0 +1,131 @@
From cce69be6681e288a8354a39380be8a4493edde5d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 7 May 2012 16:27:48 +0200
Subject: [PATCH] removed old udev "vol_id"
---
dracut-functions.sh | 11 -----------
dracut.asc | 3 +--
modules.d/90dmraid/module-setup.sh | 4 +---
modules.d/90mdraid/module-setup.sh | 14 ++++++--------
modules.d/95udev-rules/59-persistent-storage-volid.rules | 7 -------
modules.d/95udev-rules/module-setup.sh | 9 ++-------
6 Dateien geändert, 10 Zeilen hinzugefügt(+), 38 Zeilen entfernt(-)
delete mode 100644 modules.d/95udev-rules/59-persistent-storage-volid.rules
diff --git a/dracut-functions.sh b/dracut-functions.sh
index ff4e16d..8256e02 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -183,17 +183,6 @@ get_fs_env() {
return 1
fi
- # Fallback, for the old vol_id
- if [[ -x /lib/udev/vol_id ]]; then
- if evalstr=$(/lib/udev/vol_id --export $1 \
- | while read line; do
- strstr "$line" "ID_FS_TYPE=" && { echo $line; exit 0;}
- done;) ; then
- eval $evalstr
- [[ $ID_FS_TYPE ]] && return 0
- fi
- fi
-
# Fallback, if we don't have udev information
if find_binary blkid >/dev/null; then
eval $(blkid -o udev $1 \
diff --git a/dracut.asc b/dracut.asc
index a6e050d..6d93379 100644
--- a/dracut.asc
+++ b/dracut.asc
@@ -478,8 +478,7 @@ command
# dmsetup ls --tree
----
+
-* A list of block device attributes including vol_id compatible mode. This can
-be obtained by running the commands:
+* A list of block device attributes. This can be obtained by running the commands:
+
----
# blkid -p
diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh
index 0a8ed7f..5ce7051 100755
--- a/modules.d/90dmraid/module-setup.sh
+++ b/modules.d/90dmraid/module-setup.sh
@@ -58,9 +58,7 @@ install() {
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
- if [ ! -x /lib/udev/vol_id ]; then
- inst_rules 64-md-raid.rules
- fi
+ inst_rules 64-md-raid.rules
inst_libdir_file "libdmraid-events*.so*"
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 90092a7..7c9fcc4 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -57,14 +57,12 @@ install() {
# inst /etc/passwd
# inst /etc/group
- if [ ! -x /lib/udev/vol_id ]; then
- inst_rules 64-md-raid.rules
- # remove incremental assembly from stock rules, so they don't shadow
- # 65-md-inc*.rules and its fine-grained controls, or cause other problems
- # when we explicitly don't want certain components to be incrementally
- # assembled
- sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}/lib/udev/rules.d/64-md-raid.rules"
- fi
+ inst_rules 64-md-raid.rules
+ # remove incremental assembly from stock rules, so they don't shadow
+ # 65-md-inc*.rules and its fine-grained controls, or cause other problems
+ # when we explicitly don't want certain components to be incrementally
+ # assembled
+ sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}/lib/udev/rules.d/64-md-raid.rules"
inst_rules "$moddir/65-md-incremental-imsm.rules"
diff --git a/modules.d/95udev-rules/59-persistent-storage-volid.rules b/modules.d/95udev-rules/59-persistent-storage-volid.rules
deleted file mode 100644
index 0b798e6..0000000
--- a/modules.d/95udev-rules/59-persistent-storage-volid.rules
+++ /dev/null
@@ -1,7 +0,0 @@
-SUBSYSTEM!="block", GOTO="psv_end"
-ACTION!="add|change", GOTO="psv_end"
-ACTION=="change", KERNEL=="dm-[0-9]*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", IMPORT{program}="vol_id --export $tempnode"
-KERNEL=="cciss[0-9]*", IMPORT{program}="vol_id --export $tempnode"
-KERNEL=="nbd[0-9]*", IMPORT{program}="vol_id --export $tempnode"
-KERNEL=="md[0-9]*|md_d[0-9]*|md/*", IMPORT{program}="vol_id --export $tempnode"
-LABEL="psv_end"
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index b4acce3..f7f9f2e 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -37,12 +37,8 @@ install() {
inst_dir /run/udev
inst_dir /run/udev/rules.d
- if [ ! -x /lib/udev/vol_id ]; then
- dracut_install blkid
- inst_rules "$moddir/59-persistent-storage.rules"
- else
- inst_rules "$moddir/59-persistent-storage-volid.rules"
- fi
+ dracut_install blkid
+ inst_rules "$moddir/59-persistent-storage.rules"
inst_rules "$moddir/61-persistent-storage.rules"
for _i in \
@@ -60,7 +56,6 @@ install() {
input_id \
scsi_id \
usb_id \
- vol_id \
pcmcia-socket-startup \
pcmcia-check-broken-cis \
; do

View File

@ -0,0 +1,26 @@
From 65ceb56dd593f319fb15e12efe404e66ed641909 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 7 May 2012 16:28:16 +0200
Subject: [PATCH] plymouth/plymouth-pretrigger.sh: check for tty dev existence
---
modules.d/50plymouth/plymouth-pretrigger.sh | 4 ++--
1 Datei geändert, 2 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)
diff --git a/modules.d/50plymouth/plymouth-pretrigger.sh b/modules.d/50plymouth/plymouth-pretrigger.sh
index 50828af..8fa0aec 100755
--- a/modules.d/50plymouth/plymouth-pretrigger.sh
+++ b/modules.d/50plymouth/plymouth-pretrigger.sh
@@ -21,10 +21,10 @@ if [ -x /bin/plymouthd ]; then
mkdir -m 0755 /run/plymouth
consoledev=$(getarg console= | sed -e 's/,.*//')
consoledev=${consoledev:-tty0}
- [ -x /lib/udev/console_init ] && /lib/udev/console_init "/dev/$consoledev"
+ [ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
/bin/plymouth --show-splash 2>&1 | vinfo
# reset tty after plymouth messed with it
- [ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
+ [ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
fi
fi

View File

@ -0,0 +1,21 @@
From f6a58604a0f47b353f2ac1790fd37b1b312418b2 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 7 May 2012 16:28:44 +0200
Subject: [PATCH] dracut.spec: require "file"
---
dracut.spec | 1 +
1 Datei geändert, 1 Zeile hinzugefügt(+)
diff --git a/dracut.spec b/dracut.spec
index 9f64213..77b197e 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -76,6 +76,7 @@ Requires: hardlink
Requires: gzip xz
Requires: module-init-tools >= 3.7-9
Requires: sed
+Requires: file
Requires: udev > 166
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21

View File

@ -0,0 +1,22 @@
From 4b13b2e2bf6254912d5be82911b637941c700725 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 7 May 2012 16:32:28 +0200
Subject: [PATCH] test/TEST-01-BASIC/test.sh: fix cleanup of overlay dir
---
test/TEST-01-BASIC/test.sh | 2 +-
1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index 6187144..36d2693 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -61,7 +61,7 @@ test_setup() {
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
--nomdadmconf \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
- rm -rf overlay
+ rm -rf $TESTDIR/overlay
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu \

View File

@ -0,0 +1,23 @@
From 3734f4ae4816c372427f99ab5f0dfd7f386c8222 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 9 May 2012 11:05:12 +0200
Subject: [PATCH] plymouth/plymouth-pretrigger.sh: get consoledev from
/sys/class/tty/console/active
---
modules.d/50plymouth/plymouth-pretrigger.sh | 2 +-
1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
diff --git a/modules.d/50plymouth/plymouth-pretrigger.sh b/modules.d/50plymouth/plymouth-pretrigger.sh
index 8fa0aec..483cc70 100755
--- a/modules.d/50plymouth/plymouth-pretrigger.sh
+++ b/modules.d/50plymouth/plymouth-pretrigger.sh
@@ -19,7 +19,7 @@ if [ -x /bin/plymouthd ]; then
info "Starting plymouth daemon"
mkdir -m 0755 /run/plymouth
- consoledev=$(getarg console= | sed -e 's/,.*//')
+ read consoledev rest < /sys/class/tty/console/active
consoledev=${consoledev:-tty0}
[ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid

View File

@ -0,0 +1,41 @@
From cad10a7f8043752bb0c8d411ee7a30c641d6622c Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 9 May 2012 11:42:39 +0200
Subject: [PATCH] base/init.sh: set DRACUT_QUIET only in dracut-lib.sh
---
modules.d/99base/dracut-lib.sh | 3 +++
modules.d/99base/init.sh | 6 ------
2 Dateien geändert, 3 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index ddb6954..e46e456 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -316,6 +316,9 @@ check_quiet() {
getargbool 0 rd.info -y rdinfo && DRACUT_QUIET="no"
getargbool 0 rd.debug -y rdinitdebug && DRACUT_QUIET="no"
getarg quiet || DRACUT_QUIET="yes"
+ a=$(getarg loglevel=)
+ [ -n "$a" ] && [ $a -ge 28 ] && DRACUT_QUIET="yes"
+ export DRACUT_QUIET
fi
}
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index cba2e1a..5807b12 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -39,12 +39,6 @@ fi
setdebug
-if [ "$RD_DEBUG" = "yes" ]; then
- getarg quiet && DRACUT_QUIET="yes"
- a=$(getarg loglevel=)
- [ -n "$a" ] && [ $a -ge 8 ] && unset DRACUT_QUIET
-fi
-
if ! ismounted /dev; then
mount -t devtmpfs -o mode=0755,nosuid,strictatime devtmpfs /dev >/dev/null
fi

View File

@ -0,0 +1,31 @@
From fe98cfee37224420ee133c1b10e7befab24dce05 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 9 May 2012 11:44:23 +0200
Subject: [PATCH] base/dracut-lib.sh: export UDEVVERSION
---
modules.d/99base/dracut-lib.sh | 4 ++--
1 Datei geändert, 2 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index e46e456..2fe8a5e 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -383,7 +383,7 @@ incol2() {
}
udevsettle() {
- [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
+ [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
if [ $UDEVVERSION -ge 143 ]; then
udevadm settle --exit-if-exists=$hookdir/initqueue/work $settle_exit_if_exists
@@ -393,7 +393,7 @@ udevsettle() {
}
udevproperty() {
- [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
+ [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
if [ $UDEVVERSION -ge 143 ]; then
for i in "$@"; do udevadm control --property=$i; done

View File

@ -0,0 +1,22 @@
From f2d887d7d5ccb315d840192af825eba92764d9f9 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 9 May 2012 13:13:19 +0200
Subject: [PATCH] dracut.sh: install var/run and var/lock
---
dracut.sh | 2 +-
1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
diff --git a/dracut.sh b/dracut.sh
index 1048e75..2a7a812 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -655,7 +655,7 @@ if [[ $prefix ]]; then
fi
if [[ $kernel_only != yes ]]; then
- for d in usr/bin usr/sbin bin etc lib "$libdir" sbin tmp usr var var/log; do
+ for d in usr/bin usr/sbin bin etc lib "$libdir" sbin tmp usr var var/log var/run var/lock; do
[[ -e "${initdir}${prefix}/$d" ]] && continue
if [ -L "/$d" ]; then
inst_symlink "/$d" "${prefix}/$d"

View File

@ -0,0 +1,36 @@
From 8aeec251e350be27090ffddf4d2ef063ad428219 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 9 May 2012 11:07:46 +0200
Subject: [PATCH] rootfs-block/block-genrules.sh: install systemd mount unit
---
modules.d/95rootfs-block/block-genrules.sh | 17 +++++++++++++++++
1 Datei geändert, 17 Zeilen hinzugefügt(+)
diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
index 1e6827a..fe6e331 100755
--- a/modules.d/95rootfs-block/block-genrules.sh
+++ b/modules.d/95rootfs-block/block-genrules.sh
@@ -13,5 +13,22 @@ if [ "${root%%:*}" = "block" ]; then
printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
"${root#block:}" "${root#block:}" > $hookdir/initqueue/settled/blocksymlink.sh
+ if [ -d /lib/systemd/system/ ]; then
+ echo "${root#block:} $NEWROOT ${fstype:-auto} ${rflags:-defaults} 1 1" >> /etc/fstab
+ {
+ echo '[Unit]'
+ echo 'Description=New Root File System'
+ echo 'DefaultDependencies=no'
+ echo 'Before=switch-root.service'
+ echo '[Mount]'
+ echo "What=${root#block:}"
+ echo "Where=$NEWROOT"
+
+ } >/lib/systemd/system/${NEWROOT#/}.mount
+
+ mkdir -p /lib/systemd/system/switch-root.target.wants
+ ln -s ../${NEWROOT#/}.mount /lib/systemd/system/switch-root.target.wants/${NEWROOT#/}.mount
+ fi
+
wait_for_dev "${root#block:}"
fi

View File

@ -0,0 +1,923 @@
From 2c431e8ec4c9cb538c633e46888912ad83315ce0 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 9 May 2012 11:47:30 +0200
Subject: [PATCH] add systemd module
---
modules.d/98systemd/dracut-cmdline.sh | 27 +++++
modules.d/98systemd/dracut-initqueue.service | 27 +++++
modules.d/98systemd/dracut-initqueue.sh | 111 ++++++++++++++++++
modules.d/98systemd/dracut-pre-pivot.service | 27 +++++
modules.d/98systemd/dracut-pre-pivot.sh | 54 +++++++++
modules.d/98systemd/dracut-pre-trigger.service | 28 +++++
modules.d/98systemd/dracut-pre-trigger.sh | 20 ++++
modules.d/98systemd/dracut-pre-udev.service | 27 +++++
modules.d/98systemd/dracut-pre-udev.sh | 17 +++
modules.d/98systemd/emergency.service | 30 +++++
modules.d/98systemd/module-setup.sh | 150 ++++++++++++++++++++++++
modules.d/98systemd/rescue.service | 31 +++++
modules.d/98systemd/switch-root.service | 17 +++
modules.d/98systemd/switch-root.target | 16 +++
test/TEST-02-SYSTEMD/99-idesymlinks.rules | 8 ++
test/TEST-02-SYSTEMD/Makefile | 10 ++
test/TEST-02-SYSTEMD/create-root.sh | 23 ++++
test/TEST-02-SYSTEMD/cryptroot-ask.sh | 6 +
test/TEST-02-SYSTEMD/hard-off.sh | 3 +
test/TEST-02-SYSTEMD/test-init.sh | 20 ++++
test/TEST-02-SYSTEMD/test.sh | 95 +++++++++++++++
21 Dateien geändert, 747 Zeilen hinzugefügt(+)
create mode 100755 modules.d/98systemd/dracut-cmdline.sh
create mode 100644 modules.d/98systemd/dracut-initqueue.service
create mode 100755 modules.d/98systemd/dracut-initqueue.sh
create mode 100644 modules.d/98systemd/dracut-pre-pivot.service
create mode 100755 modules.d/98systemd/dracut-pre-pivot.sh
create mode 100644 modules.d/98systemd/dracut-pre-trigger.service
create mode 100755 modules.d/98systemd/dracut-pre-trigger.sh
create mode 100644 modules.d/98systemd/dracut-pre-udev.service
create mode 100755 modules.d/98systemd/dracut-pre-udev.sh
create mode 100644 modules.d/98systemd/emergency.service
create mode 100755 modules.d/98systemd/module-setup.sh
create mode 100644 modules.d/98systemd/rescue.service
create mode 100644 modules.d/98systemd/switch-root.service
create mode 100644 modules.d/98systemd/switch-root.target
create mode 100644 test/TEST-02-SYSTEMD/99-idesymlinks.rules
create mode 100644 test/TEST-02-SYSTEMD/Makefile
create mode 100755 test/TEST-02-SYSTEMD/create-root.sh
create mode 100755 test/TEST-02-SYSTEMD/cryptroot-ask.sh
create mode 100755 test/TEST-02-SYSTEMD/hard-off.sh
create mode 100755 test/TEST-02-SYSTEMD/test-init.sh
create mode 100755 test/TEST-02-SYSTEMD/test.sh
diff --git a/modules.d/98systemd/dracut-cmdline.sh b/modules.d/98systemd/dracut-cmdline.sh
new file mode 100755
index 0000000..26ca9c2
--- /dev/null
+++ b/modules.d/98systemd/dracut-cmdline.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+NEWROOT="/sysroot"
+[ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT
+[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
+[ -d /run/lock ] || mkdir -p -m 0755 /run/lock
+
+exec </dev/console >/dev/console 2>&1
+
+if [ -f /dracut-state.sh ]; then
+ . /dracut-state.sh || :
+fi
+. /lib/dracut-lib.sh
+source_conf /etc/conf.d
+
+# run scriptlets to parse the command line
+getarg 'rd.break=cmdline' 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
+source_hook cmdline
+
+[ -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
diff --git a/modules.d/98systemd/dracut-initqueue.service b/modules.d/98systemd/dracut-initqueue.service
new file mode 100644
index 0000000..b0c8509
--- /dev/null
+++ b/modules.d/98systemd/dracut-initqueue.service
@@ -0,0 +1,27 @@
+# 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 initqueue hook
+DefaultDependencies=no
+After=systemd-udev-trigger.service
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStart=-/bin/dracut-initqueue
+Type=simple
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/modules.d/98systemd/dracut-initqueue.sh b/modules.d/98systemd/dracut-initqueue.sh
new file mode 100755
index 0000000..402f536
--- /dev/null
+++ b/modules.d/98systemd/dracut-initqueue.sh
@@ -0,0 +1,111 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+exec </dev/console >/dev/console 2>&1
+
+if [ -f /dracut-state.sh ]; then
+ . /dracut-state.sh || :
+fi
+. /lib/dracut-lib.sh
+source_conf /etc/conf.d
+source_hook pre-trigger
+
+getarg 'rd.break=initqueue' 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
+
+RDRETRY=$(getarg rd.retry 'rd_retry=')
+RDRETRY=${RDRETRY:-20}
+RDRETRY=$(($RDRETRY*2))
+export RDRETRY
+
+main_loop=0
+export main_loop
+
+while :; do
+
+ check_finished && break
+
+ udevsettle
+
+ check_finished && break
+
+ if [ -f $hookdir/initqueue/work ]; then
+ rm $hookdir/initqueue/work
+ fi
+
+ for job in $hookdir/initqueue/*.sh; do
+ [ -e "$job" ] || break
+ job=$job . $job
+ check_finished && break 2
+ done
+
+ $UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
+
+ for job in $hookdir/initqueue/settled/*.sh; do
+ [ -e "$job" ] || break
+ job=$job . $job
+ check_finished && break 2
+ done
+
+ $UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
+
+ # no more udev jobs and queues empty.
+ sleep 0.5
+
+
+ if [ $main_loop -gt $(($RDRETRY/2)) ]; then
+ for job in $hookdir/initqueue/timeout/*.sh; do
+ [ -e "$job" ] || break
+ job=$job . $job
+ main_loop=0
+ done
+ fi
+
+ main_loop=$(($main_loop+1))
+ [ $main_loop -gt $RDRETRY ] \
+ && { flock -s 9 ; emergency_shell "Unable to process initqueue"; } 9>/.console_lock
+done
+
+unset job
+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' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
+source_hook pre-mount
+
+
+getarg 'rd.break=mount' '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 ] \
+ && { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
+done
+
+{
+ echo -n "Mounted root filesystem "
+ while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
+} | vinfo
+
+systemctl switch-root
+
+export -p > /dracut-state.sh
diff --git a/modules.d/98systemd/dracut-pre-pivot.service b/modules.d/98systemd/dracut-pre-pivot.service
new file mode 100644
index 0000000..112834a
--- /dev/null
+++ b/modules.d/98systemd/dracut-pre-pivot.service
@@ -0,0 +1,27 @@
+# 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 pre-pivot and cleanup hook
+DefaultDependencies=no
+Before=switch-root.service
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStart=-/bin/dracut-pre-pivot
+Type=oneshot
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/modules.d/98systemd/dracut-pre-pivot.sh b/modules.d/98systemd/dracut-pre-pivot.sh
new file mode 100755
index 0000000..5ee1dd0
--- /dev/null
+++ b/modules.d/98systemd/dracut-pre-pivot.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+exec </dev/console >/dev/console 2>&1
+if [ -f /dracut-state.sh ]; then
+ . /dracut-state.sh || :
+fi
+. /lib/dracut-lib.sh
+source_conf /etc/conf.d
+
+# pre pivot scripts are sourced just before we doing cleanup and switch over
+# to the new root.
+getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
+source_hook pre-pivot
+
+# pre pivot cleanup scripts are sourced just before we switch over to the new root.
+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=)" $(getargs rd.distroinit=) /sbin/init; do
+ [ -n "$i" ] || continue
+
+ __p=$(readlink -f "${NEWROOT}/${i}")
+ if [ -x "$__p" ]; then
+ INIT="$i"
+ break
+ fi
+done
+
+if [ -n "$INIT" ]; then
+ {
+ echo "NEWROOT=\"$NEWROOT\""
+ echo "NEWINIT=\"$INIT\""
+ } > /etc/switch-root.conf
+else
+ echo "Cannot find init!"
+ echo "Please check to make sure you passed a valid root filesystem!"
+ emergency_shell
+fi
+
+udevadm control --stop-exec-queue
+systemctl stop udevd.service
+udevadm info --cleanup-db
+
+# remove helper symlink
+[ -h /dev/root ] && rm -f /dev/root
+
+getarg rd.break rdbreak && emergency_shell -n switch_root "Break before switch_root"
+info "Switching root"
+
+export -p > /dracut-state.sh
diff --git a/modules.d/98systemd/dracut-pre-trigger.service b/modules.d/98systemd/dracut-pre-trigger.service
new file mode 100644
index 0000000..080b1f5
--- /dev/null
+++ b/modules.d/98systemd/dracut-pre-trigger.service
@@ -0,0 +1,28 @@
+# 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 pre-trigger hook
+DefaultDependencies=no
+After=systemd-udev.service
+Before=systemd-udev-trigger.service
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStart=-/bin/dracut-pre-trigger
+Type=oneshot
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/modules.d/98systemd/dracut-pre-trigger.sh b/modules.d/98systemd/dracut-pre-trigger.sh
new file mode 100755
index 0000000..a6c66e4
--- /dev/null
+++ b/modules.d/98systemd/dracut-pre-trigger.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+exec </dev/console >/dev/console 2>&1
+
+if [ -f /dracut-state.sh ]; then
+ . /dracut-state.sh || :
+fi
+. /lib/dracut-lib.sh
+source_conf /etc/conf.d
+
+getargbool 0 rd.udev.info -y rdudevinfo && udevadm control "$UDEV_LOG_PRIO_ARG=info"
+getargbool 0 rd.udev.debug -y rdudevdebug && udevadm control "$UDEV_LOG_PRIO_ARG=debug"
+udevproperty "hookdir=$hookdir"
+
+source_hook pre-trigger
+
+udevadm control --reload >/dev/null 2>&1 || :
+
+export -p > /dracut-state.sh
diff --git a/modules.d/98systemd/dracut-pre-udev.service b/modules.d/98systemd/dracut-pre-udev.service
new file mode 100644
index 0000000..09a349d
--- /dev/null
+++ b/modules.d/98systemd/dracut-pre-udev.service
@@ -0,0 +1,27 @@
+# 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 pre-trigger hook
+DefaultDependencies=no
+Before=systemd-udev.service
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStart=-/bin/dracut-pre-udev
+Type=oneshot
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/modules.d/98systemd/dracut-pre-udev.sh b/modules.d/98systemd/dracut-pre-udev.sh
new file mode 100755
index 0000000..5740174
--- /dev/null
+++ b/modules.d/98systemd/dracut-pre-udev.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+exec </dev/console >/dev/console 2>&1
+if [ -f /dracut-state.sh ]; then
+ . /dracut-state.sh || :
+fi
+. /lib/dracut-lib.sh
+source_conf /etc/conf.d
+
+# pre pivot scripts are sourced just before we doing cleanup and switch over
+# to the new root.
+getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break pre-udev"
+source_hook pre-udev
+
+export -p > /dracut-state.sh
diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
new file mode 100644
index 0000000..ecebf96
--- /dev/null
+++ b/modules.d/98systemd/emergency.service
@@ -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
+Conflicts=shutdown.target
+Before=shutdown.target
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStart=-/bin/sh -i -l
+ExecStopPost=-/usr/bin/systemctl --fail --no-block switch-root
+Type=idle
+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/module-setup.sh b/modules.d/98systemd/module-setup.sh
new file mode 100755
index 0000000..22e570f
--- /dev/null
+++ b/modules.d/98systemd/module-setup.sh
@@ -0,0 +1,150 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+ [[ $mount_needs ]] && return 1
+ [ -x /lib/systemd/systemd ] && return 255
+ return 1
+}
+
+depends() {
+ return 0
+}
+
+install() {
+
+ for i in \
+ systemd \
+ systemd-cgroups-agent \
+ systemd-initctl \
+ systemd-shutdownd \
+ systemd-shutdown \
+ systemd-modules-load \
+ systemd-remount-fs \
+ systemd-reply-password \
+ systemd-fsck \
+ systemd-timestamp \
+ systemd-ac-power \
+ systemd-sysctl \
+ systemd-udevd \
+ systemd-journald \
+ systemd-coredump \
+ systemd-vconsole-setup \
+ systemd-cryptsetup \
+ systemd-localed \
+ system/emergency.target \
+ system/sysinit.target \
+ system/basic.target \
+ system/halt.target \
+ system/kexec.target \
+ system/local-fs.target \
+ system/local-fs-pre.target \
+ system/remote-fs.target \
+ system/remote-fs-pre.target \
+ system/network.target \
+ system/nss-lookup.target \
+ system/nss-user-lookup.target \
+ system/poweroff.target \
+ system/reboot.target \
+ system/rescue.target \
+ system/rpcbind.target \
+ system/shutdown.target \
+ system/final.target \
+ system/sigpwr.target \
+ system/sockets.target \
+ system/swap.target \
+ system/systemd-initctl.socket \
+ system/systemd-shutdownd.socket \
+ system/bluetooth.target \
+ system/systemd-ask-password-console.path \
+ system/systemd-udev-control.socket \
+ system/systemd-udev-kernel.socket \
+ system/systemd-ask-password-plymouth.path \
+ system/systemd-journald.socket \
+ system/cryptsetup.target \
+ system/console-shell.service \
+ system/console-getty.service \
+ system/systemd-initctl.service \
+ system/systemd-shutdownd.service \
+ system/systemd-modules-load.service \
+ system/systemd-remount-fs.service \
+ system/systemd-ask-password-console.service \
+ system/halt.service \
+ system/poweroff.service \
+ system/reboot.service \
+ system/kexec.service \
+ system/fsck@.service \
+ system/systemd-udev.service \
+ system/systemd-udev-trigger.service \
+ system/systemd-udev-settle.service \
+ system/systemd-ask-password-plymouth.service \
+ system/systemd-journald.service \
+ system/systemd-vconsole-setup.service \
+ system/systemd-localed.service \
+ system/sysinit.target.wants/systemd-modules-load.service \
+ system/sysinit.target.wants/systemd-ask-password-console.path \
+ system/sysinit.target.wants/systemd-journald.service \
+ system/sysinit.target.wants/systemd-vconsole-setup.service \
+ system/sysinit.target.wants/cryptsetup.target \
+ system/sockets.target.wants/systemd-initctl.socket \
+ system/sockets.target.wants/systemd-shutdownd.socket \
+ system/sockets.target.wants/systemd-udev-control.socket \
+ system/sockets.target.wants/systemd-udev-kernel.socket \
+ system/sockets.target.wants/systemd-journald.socket \
+ system/basic.target.wants/systemd-udev.service \
+ system/basic.target.wants/systemd-udev-trigger.service \
+ system/local-fs.target.wants/systemd-remount-fs.service \
+ system/local-fs.target.wants/fsck-root.service \
+ system/local-fs.target.wants/tmp.mount \
+ system/ctrl-alt-del.target \
+ system/autovt@.service \
+ system/single.service \
+ system/syslog.socket \
+ system/syslog.target \
+ system/switch-root.target \
+ system/switch-root.service \
+ system/umount.target \
+ ;do
+ [ -e "/lib/systemd/$i" ] && dracut_install "/lib/systemd/$i"
+ done
+ for i in /etc/systemd/*.conf; do
+ dracut_install "$i"
+ done
+
+ ln -fs /lib/systemd/systemd "$initdir/init"
+
+ {
+ echo "LogLevel=debug"
+ echo "LogTarget=console"
+ } >> "$initdir/etc/systemd/system.conf"
+
+ rm -f "$initdir/lib/systemd/system/emergency.service"
+ inst "$moddir/emergency.service" /lib/systemd/system/emergency.service
+ rm -f "$initdir/lib/systemd/system/rescue.service"
+ inst "$moddir/rescue.service" /lib/systemd/system/rescue.service
+ inst "$moddir/switch-root.target" /lib/systemd/system/switch-root.target
+ inst "$moddir/switch-root.service" /lib/systemd/system/switch-root.service
+ ln -s basic.target "$initdir/lib/systemd/system/default.target"
+
+ inst "$moddir/dracut-cmdline.sh" /lib/systemd/system-generators/dracut-cmdline.sh
+
+ inst "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev
+ inst "$moddir/dracut-pre-udev.service" /lib/systemd/system/dracut-pre-udev.service
+ ln -s ../dracut-pre-udev.service "$initdir/lib/systemd/system/basic.target.wants/dracut-pre-udev.service"
+
+ inst "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger
+ inst "$moddir/dracut-pre-trigger.service" /lib/systemd/system/dracut-pre-trigger.service
+ ln -s ../dracut-pre-trigger.service "$initdir/lib/systemd/system/basic.target.wants/dracut-pre-trigger.service"
+
+ inst "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue
+ inst "$moddir/dracut-initqueue.service" /lib/systemd/system/dracut-initqueue.service
+ ln -s ../dracut-initqueue.service "$initdir/lib/systemd/system/basic.target.wants/dracut-initqueue.service"
+
+ inst "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot
+ inst "$moddir/dracut-pre-pivot.service" /lib/systemd/system/dracut-pre-pivot.service
+ mkdir -p "$initdir/lib/systemd/system/switch-root.target.wants"
+ ln -s ../dracut-pre-pivot.service "$initdir/lib/systemd/system/switch-root.target.wants/dracut-pre-pivot.service"
+
+}
+
diff --git a/modules.d/98systemd/rescue.service b/modules.d/98systemd/rescue.service
new file mode 100644
index 0000000..057f8b4
--- /dev/null
+++ b/modules.d/98systemd/rescue.service
@@ -0,0 +1,31 @@
+# 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=Rescue Shell
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=basic.target plymouth-start.service
+Before=shutdown.target
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStart=-/bin/sh -i -l
+#ExecStopPost=-/usr/bin/systemctl --fail --no-block switch-root /sysroot /sbin/init
+ExecStopPost=-/usr/bin/systemctl --fail --no-block switch-root
+Type=idle
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/modules.d/98systemd/switch-root.service b/modules.d/98systemd/switch-root.service
new file mode 100644
index 0000000..f72739e
--- /dev/null
+++ b/modules.d/98systemd/switch-root.service
@@ -0,0 +1,17 @@
+# 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
+DefaultDependencies=no
+Requires=shutdown.target final.target
+After=shutdown.target final.target
+
+[Service]
+Type=oneshot
+EnvironmentFile=/etc/switch-root.conf
+ExecStart=/usr/bin/systemctl --force switch-root ${NEWROOT} ${NEWINIT}
diff --git a/modules.d/98systemd/switch-root.target b/modules.d/98systemd/switch-root.target
new file mode 100644
index 0000000..d0d60e1
--- /dev/null
+++ b/modules.d/98systemd/switch-root.target
@@ -0,0 +1,16 @@
+# 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=switch-root.service
+After=switch-root.service
+AllowIsolate=yes
+
diff --git a/test/TEST-02-SYSTEMD/99-idesymlinks.rules b/test/TEST-02-SYSTEMD/99-idesymlinks.rules
new file mode 100644
index 0000000..d557790
--- /dev/null
+++ b/test/TEST-02-SYSTEMD/99-idesymlinks.rules
@@ -0,0 +1,8 @@
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}"
diff --git a/test/TEST-02-SYSTEMD/Makefile b/test/TEST-02-SYSTEMD/Makefile
new file mode 100644
index 0000000..bc0ddb6
--- /dev/null
+++ b/test/TEST-02-SYSTEMD/Makefile
@@ -0,0 +1,10 @@
+all:
+ @make -s --no-print-directory -C ../.. all
+ @basedir=../.. testdir=../ ./test.sh --all
+setup:
+ @make --no-print-directory -C ../.. all
+ @basedir=../.. testdir=../ ./test.sh --setup
+clean:
+ @basedir=../.. testdir=../ ./test.sh --clean
+run:
+ @basedir=../.. testdir=../ ./test.sh --run
diff --git a/test/TEST-02-SYSTEMD/create-root.sh b/test/TEST-02-SYSTEMD/create-root.sh
new file mode 100755
index 0000000..0e91ab5
--- /dev/null
+++ b/test/TEST-02-SYSTEMD/create-root.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# don't let udev and this script step on eachother's toes
+for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
+ > "/etc/udev/rules.d/$x"
+done
+rm /etc/lvm/lvm.conf
+udevadm control --reload-rules
+set -e
+# save a partition at the beginning for future flagging purposes
+sfdisk -C 1280 -H 2 -S 32 -L /dev/sda <<EOF
+,16
+,
+EOF
+
+mkfs.ext3 -L dracut /dev/sda2
+mkdir -p /root
+mount /dev/sda2 /root
+cp -a -t /root /source/*
+mkdir -p /root/run
+umount /root
+echo "dracut-root-block-created" >/dev/sda1
+poweroff -f
+
diff --git a/test/TEST-02-SYSTEMD/cryptroot-ask.sh b/test/TEST-02-SYSTEMD/cryptroot-ask.sh
new file mode 100755
index 0000000..db27c5b
--- /dev/null
+++ b/test/TEST-02-SYSTEMD/cryptroot-ask.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+[ -b /dev/mapper/$2 ] && exit 0
+echo -n test >/keyfile
+/sbin/cryptsetup luksOpen $1 $2 </keyfile
+
diff --git a/test/TEST-02-SYSTEMD/hard-off.sh b/test/TEST-02-SYSTEMD/hard-off.sh
new file mode 100755
index 0000000..12c3d5a
--- /dev/null
+++ b/test/TEST-02-SYSTEMD/hard-off.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+getarg rd.shell || poweroff -f
+getarg failme && poweroff -f
diff --git a/test/TEST-02-SYSTEMD/test-init.sh b/test/TEST-02-SYSTEMD/test-init.sh
new file mode 100755
index 0000000..ff17b6b
--- /dev/null
+++ b/test/TEST-02-SYSTEMD/test-init.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+strstr() { [ "${1#*$2*}" != "$1" ]; }
+CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
+plymouth --quit
+exec </dev/console >/dev/console 2>&1
+echo "dracut-root-block-success" >/dev/sda1
+export TERM=linux
+export PS1='initramfs-test:\w\$ '
+[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
+[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
+stty sane
+echo "made it to the rootfs!"
+if strstr "$CMDLINE" "rd.shell"; then
+ strstr "$(setsid --help)" "control" && CTTY="-c"
+ setsid $CTTY sh -i
+fi
+echo "Powering down."
+mount -n -o remount,ro /
+poweroff -f
diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh
new file mode 100755
index 0000000..fe3bfd1
--- /dev/null
+++ b/test/TEST-02-SYSTEMD/test.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+TEST_DESCRIPTION="root filesystem on a ext3 filesystem"
+
+KVERSION=${KVERSION-$(uname -r)}
+
+# Uncomment this to debug failures
+#DEBUGFAIL="rd.shell"
+test_run() {
+ $testdir/run-qemu \
+ -hda $TESTDIR/root.ext3 \
+ -m 256M -nographic \
+ -net none -kernel /boot/vmlinuz-$KVERSION \
+ -append "root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
+ -initrd $TESTDIR/initramfs.testing
+ grep -m 1 -q dracut-root-block-success $TESTDIR/root.ext3 || return 1
+}
+
+test_setup() {
+ rm -f $TESTDIR/root.ext3
+ # Create the blank file to use as a root filesystem
+ dd if=/dev/null of=$TESTDIR/root.ext3 bs=1M seek=40
+
+ kernel=$KVERSION
+ # Create what will eventually be our root filesystem onto an overlay
+ (
+ initdir=$TESTDIR/overlay/source
+ mkdir -p $initdir
+ . $basedir/dracut-functions.sh
+ dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
+ mount dmesg ifconfig dhclient mkdir cp ping dhclient \
+ umount strace less setsid
+ for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
+ [ -f ${_terminfodir}/l/linux ] && break
+ done
+ dracut_install -o ${_terminfodir}/l/linux
+ inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
+ inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
+ dracut_install grep
+ inst ./test-init.sh /sbin/init
+ find_binary plymouth >/dev/null && dracut_install plymouth
+ (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
+ cp -a /etc/ld.so.conf* $initdir/etc
+ sudo ldconfig -r "$initdir"
+ )
+
+ # second, install the files needed to make the root filesystem
+ (
+ initdir=$TESTDIR/overlay
+ . $basedir/dracut-functions.sh
+ dracut_install sfdisk mkfs.ext3 poweroff cp umount
+ inst_hook initqueue 01 ./create-root.sh
+ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
+ )
+
+ # create an initramfs that will create the target root filesystem.
+ # We do it this way so that we do not risk trashing the host mdraid
+ # devices, volume groups, encrypted partitions, etc.
+ $basedir/dracut.sh -l -i $TESTDIR/overlay / \
+ -m "dash udev-rules base rootfs-block kernel-modules" \
+ -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+ --nomdadmconf \
+ -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+ rm -rf $TESTDIR/overlay
+ # Invoke KVM and/or QEMU to actually create the target filesystem.
+
+ $testdir/run-qemu \
+ -hda $TESTDIR/root.ext3 \
+ -m 256M -nographic -net none \
+ -kernel "/boot/vmlinuz-$kernel" \
+ -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
+ -initrd $TESTDIR/initramfs.makeroot || return 1
+ grep -m 1 -q dracut-root-block-created $TESTDIR/root.ext3 || return 1
+
+
+ (
+ initdir=$TESTDIR/overlay
+ . $basedir/dracut-functions.sh
+ dracut_install poweroff shutdown
+ inst_hook emergency 000 ./hard-off.sh
+ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
+ )
+ sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
+ -a "debug systemd" \
+ -o "network" \
+ -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+ -f $TESTDIR/initramfs.testing $KVERSION || return 1
+
+# -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
+}
+
+test_cleanup() {
+ return 0
+}
+
+. $testdir/test-functions

View File

@ -0,0 +1,27 @@
From 5bfbfbfc22b8b9e1d2c79342656dd4ce56a03b57 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 9 May 2012 14:58:52 +0200
Subject: [PATCH] ifcfg/write-ifcfg.sh: use PREFIX for prefix netmask form
https://bugzilla.redhat.com/show_bug.cgi?id=820185
---
modules.d/45ifcfg/write-ifcfg.sh | 6 +++++-
1 Datei geändert, 5 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index f612762..580fbd4 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -50,7 +50,11 @@ for netif in $IFACES ; do
# If we've booted with static ip= lines, the override file is there
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
echo "IPADDR=$ip"
- echo "NETMASK=$mask"
+ if strstr "$mask" "."; then
+ echo "NETMASK=$mask"
+ else
+ echo "PREFIX=$mask"
+ fi
[ -n "$gw" ] && echo "GATEWAY=$gw"
fi
} > /tmp/ifcfg/ifcfg-$netif

View File

@ -0,0 +1,21 @@
From 6e26f9b447e93d1dc9aa8d77f534970599d3aaf2 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 9 May 2012 15:13:28 +0200
Subject: [PATCH] dracut.spec: add 98systemd module
---
dracut.spec | 1 +
1 Datei geändert, 1 Zeile hinzugefügt(+)
diff --git a/dracut.spec b/dracut.spec
index 77b197e..73c66b5 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -290,6 +290,7 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/98ecryptfs
%{dracutlibdir}/modules.d/98pollcdrom
%{dracutlibdir}/modules.d/98syslog
+%{dracutlibdir}/modules.d/98systemd
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib

View File

@ -10,7 +10,7 @@
Name: dracut
Version: 018
Release: 40.git20120504%{?dist}
Release: 52.git20120509%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
@ -63,6 +63,18 @@ Patch36: 0036-TEST-15-BTRFSRAID-add-one-more-partition-to-the-btrf.patch
Patch37: 0037-fix-_getcmdline-arg-duplicating-bug-with-etc-cmdline.patch
Patch38: 0038-ifcfg-fix-resolv.conf.patch
Patch39: 0039-TODO-update.patch
Patch40: 0040-removed-old-udev-vol_id.patch
Patch41: 0041-plymouth-plymouth-pretrigger.sh-check-for-tty-dev-ex.patch
Patch42: 0042-dracut.spec-require-file.patch
Patch43: 0043-test-TEST-01-BASIC-test.sh-fix-cleanup-of-overlay-di.patch
Patch44: 0044-plymouth-plymouth-pretrigger.sh-get-consoledev-from-.patch
Patch45: 0045-base-init.sh-set-DRACUT_QUIET-only-in-dracut-lib.sh.patch
Patch46: 0046-base-dracut-lib.sh-export-UDEVVERSION.patch
Patch47: 0047-dracut.sh-install-var-run-and-var-lock.patch
Patch48: 0048-rootfs-block-block-genrules.sh-install-systemd-mount.patch
Patch49: 0049-add-systemd-module.patch
Patch50: 0050-ifcfg-write-ifcfg.sh-use-PREFIX-for-prefix-netmask-f.patch
Patch51: 0051-dracut.spec-add-98systemd-module.patch
BuildArch: noarch
@ -116,6 +128,7 @@ Requires: hardlink
Requires: gzip xz
Requires: module-init-tools >= 3.7-9
Requires: sed
Requires: file
Requires: udev > 166
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
@ -329,6 +342,7 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/98ecryptfs
%{dracutlibdir}/modules.d/98pollcdrom
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98systemd
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib
@ -379,6 +393,9 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut/overlay
%changelog
* Wed May 09 2012 Harald Hoyer <harald@redhat.com> 018-52.git20120509
- new upstream version
* Fri May 04 2012 Harald Hoyer <harald@redhat.com> 018-40.git20120504
- new upstream version