From 600fa8fa00a40c93f4d3dea747c92efd12d7823b Mon Sep 17 00:00:00 2001 From: huweihua Date: Sun, 18 Oct 2015 05:29:15 -0400 Subject: [PATCH] reduce the number of options --- .../scripts/Mellanox/mlnxofed_ib_install.v2 | 51 ++++++++----------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 index 178760473..99f7f7ff6 100644 --- a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 +++ b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 @@ -19,13 +19,13 @@ # #usage: # -# Copy the xCAT mlnxofed_ib_install.v2 script file to postscripts directory: +# Copy the xCAT mlnxofed_ib_install.v2 script file to postscripts directory and rename to mlnxofed_ib_install: # cp /opt/xcat/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 /install/postscripts/mlnxofed_ib_install # -# Prepare Mellanox OFED ISO file and save it into any subdirectory under /install. but for easy to use and comply with xcat regular rule, recommend using a meaningful directory, such as /install/post/otherpkgs///ofed/ +# Prepare Mellanox OFED ISO file and save it into any subdirectory under /install. # # 1. install the ofed driver for diskfull node -# [NOTE] step 1.1-1.2 only needed by redhat and sles +# [NOTE] step 1.1-1.2 are only needed by redhat and sles # 1.1 copy the pkglist to the custom directory: # cp /opt/xcat/share/xcat/install//compute...pkglist /install/custom/install//compute...pkglist # Edit your /install/custom/install//compute...pkglist and add: @@ -33,23 +33,23 @@ # 1.2 Make the related osimage use the customized pkglist. # chdef -t osimage -o --install-compute pkglist=/install/custom/install//compute...pkglist # 1.3 set mlnxofed_ib_install as postbootscripts for the target node. assign necessary attribute for mlnxofed_ib_install at same time. -# chdef -p postbootscripts="mlnxofed_ib_install -ofeddir -ofedname " +# chdef -p postbootscripts="mlnxofed_ib_install -p /install//" # [NOTE] The default options input into Mellanox are '--without-32bit --without-fw-update --force' -# you can appoint the options by yourslef with '-passmlnxofedoptions' option of mlnxofed_ib_install -# In order to distinguish which options are tranfered to Mellanox and which options are belong to mlnxofed_ib_install, any options wanted to transfered to Mellanox must follow behind -passmlnxofedoptions and end with "-end-", for example: -# chdef -p postbootscripts="mlnxofed_ib_install -ofeddir -passmlnxofedoptions --without-32bit --add-kernel-support --force -end- -ofedname < OFED ISO file name>" +# you can appoint the options by yourslef with '-m' option of mlnxofed_ib_install +# In order to distinguish which options are tranfered to Mellanox and which options are belong to mlnxofed_ib_install, any options wanted to transfered to Mellanox must follow behind -m and end with "-end-", for example: +# chdef -p postbootscripts="mlnxofed_ib_install -p /install// -m --without-32bit --add-kernel-support --force -end-" # 1.4 do the diskfull installation # nodeset osimage= ...... # # 2. install the ofed driver for diskless images: -# [NOTE] step 2.1 only needed by redhat and sles +# [NOTE] step 2.1 is only needed by redhat and sles # 2.1 copy the pkglist to the custom directory: # cp /opt/xcat/share/xcat/netboot//compute...pkglist /install/custom/netboot//compute...pkglist # Edit your /install/custom/netboot//.pkglist and add: # #INCLUDE:/opt/xcat/share/xcat/ib/netboot//ib...pkglist# # 2.2 Add to postinstall scripts # Edit your /install/custom/netboot//.postinstall and add: -# /install/postscripts/mlnxofed_ib_install -ofeddir -ofedname -nodesetstate genimage -installroot $1 +# /install/postscripts/mlnxofed_ib_install -p /install// -n genimage -i $1 # 2.3 Make sure the related osimage use the customized pkglist and customized compute.postinsall # lsdef -t osimage -o --netboot-compute # if not, change it: @@ -73,21 +73,20 @@ function usage() { echo "Usage: mlnxofed_ib_install [-attribute]" echo " attribute include:" echo " -h: print this help message" - echo " -ofeddir: the directory where OFED file is saved. this is necessary attribute" - echo " -ofedname: the name of OFED file. this is necessary attribute" - echo " -passmlnxofedoptions: the options inputted into mlnxofedinstall script, defualt value are --without-32bit --without-fw-update --force" - echo " -installroot: the image root path. this is necessary attribute in diskless scenario" - echo " -nodesetstate: nodeset status, the value are install, boot or genimage" + echo " -p: the path where OFED file is saved. this is necessary attribute" + echo " -m: the options inputted into mlnxofedinstall script, defualt value are --without-32bit --without-fw-update --force" + echo " -i: the image root path. this is necessary attribute in diskless scenario" + echo " -n: nodeset status, the value are one of install, boot or genimage" } while [ "$#" -gt "0" ] do case "$1" in - "-ofeddir") + "-p") shift - OFED_DIR="$1" + OFED_PATH="$1" ;; - "-passmlnxofedoptions") + "-m") shift while [ "-end-" != "$1" ] do @@ -95,15 +94,11 @@ do shift done ;; - "-ofedname") - shift - OFED_NAME="$1" - ;; - "-installroot") + "-i") shift IMGROOTPATH="$1" ;; - "-nodesetstate") + "-n") shift NODESETSTATE="$1" ;; @@ -119,16 +114,11 @@ do shift done -if [ -z "$OFED_DIR" ]; then +if [ -z "$OFED_PATH" ]; then echo "[Error] Without Mellanox OFED file path, please assign correct path" exit 1 fi -if [ -z "$OFED_NAME" ]; then - echo "[Error] Without Mellanox OFED file name, please assign correct name" - exit 1 -fi - if [ "$NODESETSTATE" = "genimage" -a -z "$IMGROOTPATH" ]; then echo "[Error] this is for diskless installation, please assign correct diskless image root path" exit 1 @@ -136,6 +126,9 @@ fi [ "${#MLNXOFED_OPTS}" = 0 ] && MLNXOFED_OPTS=(--without-32bit --without-fw-update --force) +OFED_DIR=${OFED_PATH%/*} +OFED_NAME=${OFED_PATH##*/} + echo "Mellanox OFED file path is $OFED_DIR" echo "Mellanox OFED file is $OFED_NAME" echo "Mellanox OFED options are ${MLNXOFED_OPTS[@]}"