commit:     5e2553af6a81e724fd9415b87a77004bdcaac31d
Author:     Martin Dummer <martin.dummer <AT> gmx <DOT> net>
AuthorDate: Mon Mar 10 22:36:05 2014 +0000
Commit:     Richard Yao <ryao <AT> gentoo <DOT> org>
CommitDate: Sun Mar 16 00:25:20 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=5e2553af

fix broken function prompt_user()

There is a mistake in the parameter check of function prompt_user()
which causes to exit the initramfs unconditionally when the function is
called with *correct* number of parameters (which then causes a kernel
panic)
This patch puts the parameter check into a readable if..then..fi block.

Signed-off-by: Martin Dummer <martin.dummer <AT> gmx.net>
Signed-off-by: Richard Yao <ryao <AT> gentoo.org>

---
 defaults/initrd.scripts | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 4b7c5ba..97997b3 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -446,9 +446,11 @@ prompt_user(){
 
        eval local oldvalue='$'${1}
 
-       [ $# != 2 -a $# != 3 ] && \
+       if [ $# != 2 -a $# != 3 ]; then
                bad_msg "Bad invocation of function prompt_user."
-               bad_msg "Please file a bug report with this message" && exit 1
+               bad_msg "Please file a bug report with this message"
+               exit 1
+       fi
        [ -n "${3}" ] && local explnt=" or : ${3}" || local explnt="."
 
        bad_msg "Could not find the ${2} in ${oldvalue}${explnt}"

Reply via email to