Harald Hoyer 2d3fda
From f1e9f613d9eea3105e906c114266d283ac898d44 Mon Sep 17 00:00:00 2001
Harald Hoyer 2d3fda
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 2d3fda
Date: Fri, 6 Jul 2012 12:28:17 +0200
Harald Hoyer 2d3fda
Subject: [PATCH] systemd: exit with sane state
Harald Hoyer 2d3fda
Harald Hoyer 2d3fda
---
Harald Hoyer 2d3fda
 modules.d/98systemd/dracut-cmdline.sh     |    6 ++++--
Harald Hoyer 2d3fda
 modules.d/98systemd/dracut-initqueue.sh   |    6 ++++--
Harald Hoyer 2d3fda
 modules.d/98systemd/dracut-pre-pivot.sh   |    6 ++++--
Harald Hoyer 2d3fda
 modules.d/98systemd/dracut-pre-trigger.sh |    6 ++++--
Harald Hoyer 2d3fda
 modules.d/98systemd/dracut-pre-udev.sh    |    6 ++++--
Harald Hoyer 2d3fda
 5 files changed, 20 insertions(+), 10 deletions(-)
Harald Hoyer 2d3fda
Harald Hoyer 2d3fda
diff --git a/modules.d/98systemd/dracut-cmdline.sh b/modules.d/98systemd/dracut-cmdline.sh
Harald Hoyer 2d3fda
index e1a75ea..6a44815 100755
Harald Hoyer 2d3fda
--- a/modules.d/98systemd/dracut-cmdline.sh
Harald Hoyer 2d3fda
+++ b/modules.d/98systemd/dracut-cmdline.sh
Harald Hoyer 2d3fda
@@ -8,9 +8,10 @@ NEWROOT="/sysroot"
Harald Hoyer 2d3fda
 [ -d /run/lock ] || mkdir -p -m 0755 /run/lock
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 if [ -f /dracut-state.sh ]; then
Harald Hoyer 2d3fda
-    . /dracut-state.sh || :
Harald Hoyer 2d3fda
+    . /dracut-state.sh 2>/dev/null
Harald Hoyer 2d3fda
 fi
Harald Hoyer 2d3fda
-. /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+
Harald Hoyer 2d3fda
 source_conf /etc/conf.d
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 # run scriptlets to parse the command line
Harald Hoyer 2d3fda
@@ -23,3 +24,4 @@ source_hook cmdline
Harald Hoyer 2d3fda
 export root rflags fstype netroot NEWROOT
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 export -p > /dracut-state.sh
Harald Hoyer 2d3fda
+exit 0
Harald Hoyer 2d3fda
diff --git a/modules.d/98systemd/dracut-initqueue.sh b/modules.d/98systemd/dracut-initqueue.sh
Harald Hoyer 2d3fda
index 03f1c9b..bc63582 100755
Harald Hoyer 2d3fda
--- a/modules.d/98systemd/dracut-initqueue.sh
Harald Hoyer 2d3fda
+++ b/modules.d/98systemd/dracut-initqueue.sh
Harald Hoyer 2d3fda
@@ -3,9 +3,10 @@
Harald Hoyer 2d3fda
 # ex: ts=8 sw=4 sts=4 et filetype=sh
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 if [ -f /dracut-state.sh ]; then
Harald Hoyer 2d3fda
-    . /dracut-state.sh || :
Harald Hoyer 2d3fda
+    . /dracut-state.sh 2>/dev/null
Harald Hoyer 2d3fda
 fi
Harald Hoyer 2d3fda
-. /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+
Harald Hoyer 2d3fda
 source_conf /etc/conf.d
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 getarg 'rd.break=initqueue' 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
Harald Hoyer 2d3fda
@@ -106,3 +107,4 @@ done
Harald Hoyer 2d3fda
 export -p > /dracut-state.sh
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 systemctl isolate initrd-switch-root.target
Harald Hoyer 2d3fda
+exit 0
Harald Hoyer 2d3fda
diff --git a/modules.d/98systemd/dracut-pre-pivot.sh b/modules.d/98systemd/dracut-pre-pivot.sh
Harald Hoyer 2d3fda
index 89d7e6d..29a8248 100755
Harald Hoyer 2d3fda
--- a/modules.d/98systemd/dracut-pre-pivot.sh
Harald Hoyer 2d3fda
+++ b/modules.d/98systemd/dracut-pre-pivot.sh
Harald Hoyer 2d3fda
@@ -3,9 +3,10 @@
Harald Hoyer 2d3fda
 # ex: ts=8 sw=4 sts=4 et filetype=sh
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 if [ -f /dracut-state.sh ]; then
Harald Hoyer 2d3fda
-    . /dracut-state.sh || :
Harald Hoyer 2d3fda
+    . /dracut-state.sh 2>/dev/null
Harald Hoyer 2d3fda
 fi
Harald Hoyer 2d3fda
-. /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+
Harald Hoyer 2d3fda
 source_conf /etc/conf.d
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 # pre pivot scripts are sourced just before we doing cleanup and switch over
Harald Hoyer 2d3fda
@@ -49,3 +50,4 @@ getarg rd.break rdbreak && emergency_shell -n switch_root "Break before switch_r
Harald Hoyer 2d3fda
 cp -avr /lib/systemd/system/dracut*.service /run/systemd/system/
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 export -p > /dracut-state.sh
Harald Hoyer 2d3fda
+exit 0
Harald Hoyer 2d3fda
diff --git a/modules.d/98systemd/dracut-pre-trigger.sh b/modules.d/98systemd/dracut-pre-trigger.sh
Harald Hoyer 2d3fda
index 9521eaa..52ecfaf 100755
Harald Hoyer 2d3fda
--- a/modules.d/98systemd/dracut-pre-trigger.sh
Harald Hoyer 2d3fda
+++ b/modules.d/98systemd/dracut-pre-trigger.sh
Harald Hoyer 2d3fda
@@ -3,9 +3,10 @@
Harald Hoyer 2d3fda
 # ex: ts=8 sw=4 sts=4 et filetype=sh
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 if [ -f /dracut-state.sh ]; then
Harald Hoyer 2d3fda
-    . /dracut-state.sh || :
Harald Hoyer 2d3fda
+    . /dracut-state.sh 2>/dev/null
Harald Hoyer 2d3fda
 fi
Harald Hoyer 2d3fda
-. /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+
Harald Hoyer 2d3fda
 source_conf /etc/conf.d
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 getargbool 0 rd.udev.info -y rdudevinfo && udevadm control --log-priority=info
Harald Hoyer 2d3fda
@@ -17,3 +18,4 @@ source_hook pre-trigger
Harald Hoyer 2d3fda
 udevadm control --reload >/dev/null 2>&1 || :
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 export -p > /dracut-state.sh
Harald Hoyer 2d3fda
+exit 0
Harald Hoyer 2d3fda
diff --git a/modules.d/98systemd/dracut-pre-udev.sh b/modules.d/98systemd/dracut-pre-udev.sh
Harald Hoyer 2d3fda
index 3b5ac37..2566ab9 100755
Harald Hoyer 2d3fda
--- a/modules.d/98systemd/dracut-pre-udev.sh
Harald Hoyer 2d3fda
+++ b/modules.d/98systemd/dracut-pre-udev.sh
Harald Hoyer 2d3fda
@@ -3,9 +3,10 @@
Harald Hoyer 2d3fda
 # ex: ts=8 sw=4 sts=4 et filetype=sh
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 if [ -f /dracut-state.sh ]; then
Harald Hoyer 2d3fda
-    . /dracut-state.sh || :
Harald Hoyer 2d3fda
+    . /dracut-state.sh 2>/dev/null
Harald Hoyer 2d3fda
 fi
Harald Hoyer 2d3fda
-. /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
Harald Hoyer 2d3fda
+
Harald Hoyer 2d3fda
 source_conf /etc/conf.d
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 # pre pivot scripts are sourced just before we doing cleanup and switch over
Harald Hoyer 2d3fda
@@ -14,3 +15,4 @@ getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Br
Harald Hoyer 2d3fda
 source_hook pre-udev
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 export -p > /dracut-state.sh
Harald Hoyer 2d3fda
+exit 0