Skip to contentSkip to conversation

Add "die" and some minor changes in base

RFC PATCH In review Seewer Philippe 3 participants 4 messages Jun 12, 2009 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/5 Add "die" and some minor changes in base

---

modules.d/99base/dracut-lib         |    6 ++++++
modules.d/99base/init               |   14 +++-----------
modules.d/99base/parse-root-opts.sh |    1 -
3 files changed, 9 insertions(+), 12 deletions(-)
modules.d/99base/dracut-lib +0 -0
index df9cb52..336b235 100644
@@ -21,6 +21,12 @@ source_all() {
    for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done

}

+die() {

+    printf "FATAL: $1\n"
+    printf "Refusing to continue\n"
+    exit 1

+}
+
check_occurances() {
# Count the number of times the character $ch occurs in $str # Return 0 if the count matches the expected number, 1 otherwise

modules.d/99base/init +0 -0
index 998f5e6..ec9c785 100755
@@ -41,17 +41,8 @@ mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1

getarg 'rdbreak=cmdline' && emergency_shell
source_all cmdline

-if [ -z "$rootok" -a -n "${root%%error:*}" ]; then
- root="error: No handler for root=${root}"
-fi
-
-if [ -n "$root" -a -z "${root%%error:*}" ]; then
- case "${root%%:*}" in
- '') echo "FATAL: no root= option specified, and no network support" ;;
- error) echo "FATAL: ${root#error:}" ;;
- esac
- emergency_shell
-fi
+[ -z "$root" ] && die "No or empty root= argument"
+[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"

# Network root scripts may need updated root= options,

# so deposit them where they can see them (udev purges the env)
@@ -59,6 +50,7 @@ fi
    echo "root='$root'"
    echo "rflags='$rflags'"
    echo "fstype='$fstype'"
+    echo "netroot='$netroot'"
    echo "NEWROOT='$NEWROOT'"
} > /tmp/root.info
modules.d/99base/parse-root-opts.sh +0 -0
index 7fc4f47..e253110 100755
@@ -11,4 +11,3 @@ if [ -z "$fstype" ]; then
    fstype="auto"

fi

-export fstype rflags root

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to a message not in the archive

Don't have time for a full review at the moment, but this jumped out at me:

Quoted 17 lines · Seewer Philippe
---
 modules.d/99base/dracut-lib         |    6 ++++++
 modules.d/99base/init               |   14 +++-----------
 modules.d/99base/parse-root-opts.sh |    1 -
 3 files changed, 9 insertions(+), 12 deletions(-)
modules.d/99base/dracut-lib +6 -0
 
+die() {
+    printf "FATAL: $1\n"
+    printf "Refusing to continue\n"
+    exit 1
+}
+

modules.d/99base/init

Quoted 3 lines
modules.d/99base/init +2 -0
 
+[ -z "$root" ] && die "No or empty root= argument"
+[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"

If you call die, you don't get an emergency shell. Not very friendly... --
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to a message not in the archive
Quoted 7 lines · David Dillow

Review

Quoted 7 lines
(quoted diff) +6 -0
+die() {
+    printf "FATAL: $1\n"
+    printf "Refusing to continue\n"
+    exit 1
+}
+

Furthermore, is printf available in the image currently?

It seems other parts of the code already use printf in the image, but the printf binary isn't copied in.

Warren
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to a message not in the archive
Quoted 11 lines · Warren Togami
Quoted 7 lines · David Dillow

Review

Quoted 7 lines
(quoted diff) +6 -0
+die() {
+ printf "FATAL: $1\n"
+ printf "Refusing to continue\n"
+ exit 1
+}
+

Furthermore, is printf available in the image currently?

Quoted 3 lines

It seems other parts of the code already use printf in the image, but the printf binary isn't copied in.

I see that printf is both a built-in of bash/dash, and also an independent binary...

Warren
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html