mkinitrd unification across distributions
 help / color / mirror / Atom feed
* [RFC PATCH 1/5] Add "die" and some minor changes in base
@ 2009-06-12 15:11 Seewer Philippe
       [not found] ` <4A327035.6060100-omB+W0Dpw2o@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Seewer Philippe @ 2009-06-12 15:11 UTC (permalink / raw)
  To: <initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>

---
 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(-)

diff --git a/modules.d/99base/dracut-lib b/modules.d/99base/dracut-lib
index df9cb52..336b235 100644
--- a/modules.d/99base/dracut-lib
+++ b/modules.d/99base/dracut-lib
@@ -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
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 998f5e6..ec9c785 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -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
 
diff --git a/modules.d/99base/parse-root-opts.sh b/modules.d/99base/parse-root-opts.sh
index 7fc4f47..e253110 100755
--- a/modules.d/99base/parse-root-opts.sh
+++ b/modules.d/99base/parse-root-opts.sh
@@ -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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 1/5] Add "die" and some minor changes in base
       [not found] ` <4A327035.6060100-omB+W0Dpw2o@public.gmane.org>
@ 2009-06-12 15:41   ` David Dillow
       [not found]     ` <1244821283.15165.2.camel-FqX9LgGZnHWDB2HL1qBt2PIbXMQ5te18@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: David Dillow @ 2009-06-12 15:41 UTC (permalink / raw)
  To: Seewer Philippe; +Cc: <initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>

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

On Fri, 2009-06-12 at 17:11 +0200, Seewer Philippe wrote:
> ---
>  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(-)
> 
> diff --git a/modules.d/99base/dracut-lib b/modules.d/99base/dracut-lib

> +die() {
> +    printf "FATAL: $1\n"
> +    printf "Refusing to continue\n"
> +    exit 1
> +}
> +

> --- a/modules.d/99base/init
> +++ b/modules.d/99base/init

> +[ -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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 1/5] Add "die" and some minor changes in base
       [not found]     ` <1244821283.15165.2.camel-FqX9LgGZnHWDB2HL1qBt2PIbXMQ5te18@public.gmane.org>
@ 2009-06-12 18:40       ` Warren Togami
       [not found]         ` <4A32A106.1050806-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Warren Togami @ 2009-06-12 18:40 UTC (permalink / raw)
  To: initramfs

On 06/12/2009 11:41 AM, David Dillow wrote:
>
>> +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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 1/5] Add "die" and some minor changes in base
       [not found]         ` <4A32A106.1050806-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-06-12 19:27           ` Warren Togami
  0 siblings, 0 replies; 4+ messages in thread
From: Warren Togami @ 2009-06-12 19:27 UTC (permalink / raw)
  To: initramfs

On 06/12/2009 02:40 PM, Warren Togami wrote:
> On 06/12/2009 11:41 AM, David Dillow wrote:
>>
>>> +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.
>

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-12 19:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-12 15:11 [RFC PATCH 1/5] Add "die" and some minor changes in base Seewer Philippe
     [not found] ` <4A327035.6060100-omB+W0Dpw2o@public.gmane.org>
2009-06-12 15:41   ` David Dillow
     [not found]     ` <1244821283.15165.2.camel-FqX9LgGZnHWDB2HL1qBt2PIbXMQ5te18@public.gmane.org>
2009-06-12 18:40       ` Warren Togami
     [not found]         ` <4A32A106.1050806-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-12 19:27           ` Warren Togami

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox