commit:     493af2b716fe55a37139858c9f1e8ddb44df4e71
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon May 16 06:49:40 2016 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon May 16 06:49:40 2016 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=493af2b7

gen_cmdline: bug #544172: sanity check on mdadm/dmraid.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 gen_cmdline.sh | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index e9e7401..24cb607 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -297,6 +297,12 @@ parse_cmdline() {
                --mdadm|--no-mdadm)
                        CMD_MDADM=`parse_optbool "$*"`
                        print_info 2 "CMD_MDADM: $CMD_MDADM"
+                       if [ "$CMD_MDADM" = "1" -a ! -e /sbin/mdadm ]
+                       then
+                               echo 'Error: --multipath requires sys-fs/mdadm'
+                               echo '           to be installed on the host 
system.'
+                               exit 1
+                       fi
                        ;;
                --mdadm-config=*)
                        CMD_MDADM_CONFIG=`parse_opt "$*"`
@@ -320,10 +326,16 @@ parse_cmdline() {
                        ;;
                --dmraid|--no-dmraid)
                        CMD_DMRAID=`parse_optbool "$*"`
+                       if [ "$CMD_DMRAID" = "1" -a ! -e /usr/sbin/dmraid ]
+                       then
+                               echo 'Error: --dmraid requires sys-fs/dmraid'
+                               echo '           to be installed on the host 
system.'
+                               exit 1
+                       fi
                        if [ "$CMD_DMRAID" = "1" -a ! -e 
/usr/include/libdevmapper.h ]
                        then
-                               echo 'Error: --dmraid requires LVM2 to be 
installed'
-                               echo '           on the host system; try 
"emerge lvm2".'
+                               echo 'Error: --dmraid requires sys-fs/lvm2'
+                               echo '           to be installed on the host 
system.'
                                exit 1
                        fi
                        print_info 2 "CMD_DMRAID: ${CMD_DMRAID}"
@@ -346,10 +358,16 @@ parse_cmdline() {
                        ;;
                --multipath|--no-multipath)
                        CMD_MULTIPATH=`parse_optbool "$*"`
+                       if [ "$CMD_MULTIPATH" = "1" -a ! -e /sbin/multipath ]
+                       then
+                               echo 'Error: --multipath requires 
sys-fs/multipath-tools'
+                               echo '           to be installed on the host 
system.'
+                               exit 1
+                       fi
                        if [ "$CMD_MULTIPATH" = "1" -a ! -e 
/usr/include/libdevmapper.h ]
                        then
-                               echo 'Error: --multipath requires LVM2 to be 
installed'
-                               echo '           on the host;system; try 
"emerge lvm2".'
+                               echo 'Error: --multipath requires sys-fs/lvm2'
+                               echo '           to be installed on the host 
system.'
                                exit 1
                        fi
                        print_info 2 "CMD_MULTIPATH: ${CMD_MULTIPATH}"

Reply via email to