📄 tifis
字号:
}################################################################################: Ask_Serial_Number################################################################################# This function queries for the client's serial number. The serial number must# start with two alpha characters (ie. AB for ABO). The remainder of this# number must be eight alpha-numeric characters. The answer is started for the# technician by tifis providing the "AB", which will be a constant for ABO # (this starter can be easily adapted to other sites). Default answers are# implemented on the second a consecutive times through this function for the# the current client.Ask_Serial_Number(){ if [ "$DEBUG" = "TRUE" ] then echo "\n" echo "*** Now Entering the Ask_Serial_Number() function" echo "\n" sleep 1 fi ASN_boolean="FALSE" SERIAL_N=0 while [ "$ASN_boolean" = "FALSE" ] do echo "\n Please enter $CLIENT's serial number" echo " [ $SERIAL_N_DEFAULT ]: $SERIAL_N_STARTER\c" read SERIAL_N SERIAL_N=`echo $SERIAL_N | tr '[a-z]' '[A-Z]'` case $SERIAL_N in "") SERIAL_N="$SERIAL_N_DEFAULT" if [ "$ASN_ERROR" -eq 1 ] then echo " Invalid Serial Number. Please reenter." else ASN_boolean="TRUE" fi;; \?) clear more $HOME/HELP/Serial_Number.help echo " Press [Return] to continue... \c" read ASN_continue;; [0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]) SERIAL_N="${SERIAL_N_STARTER}${SERIAL_N}" ASN_boolean="TRUE";; *) echo " Invalid Serial Number. Please reenter.";; esac done }################################################################################: Ask_Hardware_Ethernet_Address################################################################################# This function queries for the ethernet hardware address. The address is# with the constant 08-00-2B-. If the constant should change then the starter# can be modified. On the second and consecutive times through this function# for the current client, a default is employed as a convenience.Ask_Hardware_Ethernet_Address(){ if [ "$DEBUG" = "TRUE" ] then echo "\n" echo "*** Now Entering the Ask_Hardware_Ethernet_Address() function" echo "\n" sleep 1 fi AFI_boolean="FALSE" while [ "$AFI_boolean" = "FALSE" ] do echo "\n Please enter $CLIENT's \"Hardware Ethernet Address\"" echo " [ $ADDRESS_DEFAULT ]: $ADDRESS_STARTER\c" read ADDRESS ADDRESS=`echo $ADDRESS | tr '[a-z]' '[A-Z]'` case $ADDRESS in "") ADDRESS="$ADDRESS_DEFAULT" if [ "$AHEA_ERROR" -eq 1 ] then echo " Hardware Ethernet Address is in the wrong format, please reenter." else AFI_boolean="TRUE" fi;; \?) clear more $HOME/HELP/Hardware_Ethernet_Address.help echo " Press [Return] to continue...\c" read AFI_continue AFI_boolean="FALSE";; [0-9A-F][0-9A-F]-[0-9A-F][0-9A-F]-[0-9A-F][0-9A-F]) echo ADDRESS="${ADDRESS_STARTER}${ADDRESS}" AFI_boolean="TRUE";; *) echo " Hardware Ethernet Address is in the wrong format, please reenter." AFI_boolean="FALSE";; esac done}################################################################################: Ask_FIS_Image################################################################################# This function queries for the FIS image to loaded. As the list of images# grows, this function will need to be modified.Ask_FIS_Image(){ if [ "$DEBUG" = "TRUE" ] then echo "\n" echo "*** Now Entering the Ask_FIS_Image() function" echo "\n" sleep 1 fi AFI_answer=0 clear while [ "$AFI_answer" -le 0 -o "$AFI_answer" -gt 2 ]## the above will limit the correct answers to <= 0 or > 2# this means that either 1 or 2 will be accepted do echo " Image Name Selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RZ23 and RZ24 (DS2100/3100) 1 RZ23 and RZ24 (DS5100) 2 RZ24 only 2 ----- Not Implemented yet RZ55 only 3 ----- Not Implemented yet RZ56 only 4 ----- Not Implemented yet RZ57 only 5 ----- Not Implemented yet Type ? for Help... Please enter the FIS image to be loaded. [ $IMAGE_DEFAULT ] \c" read AFI_answer if [ -z "$AFI_answer" ] then AFI_answer=$IMAGE_DEFAULT fi case $AFI_answer in \?) clear more $HOME/HELP/FIS_Image_Selection.help echo " Press [Return] to continue...\c" read AFI_continue;; 1) IMAGE="DS3100";; 2) IMAGE="DS5100";;# 1) IMAGE="RZ23+24";;# 2) IMAGE="RZ24.only";;# 3) IMAGE="RZ55.only";;# 4) IMAGE="RZ56.only";;# 5) IMAGE="RZ57.only";; [3-5]) echo "\n Not Implemented yet." echo " Changing the value to the default." sleep 5 AFI_answer=1;; esac done }################################################################################: Print_Selections################################################################################# This function displays the selections the technician has made and then# queries for verification of those selections. If "yes" then tifis moves on, # if "no" then this function assigns the defaults and sends the technician back# through the question loop.Print_Selections(){ if [ "$DEBUG" = "TRUE" ] then echo "\n" echo "*** Now Entering the Print_Selections() function" echo "\n" sleep 1 fi clear while : do echo "\n Here are the selections you have made for $CLIENT...\n" echo " Serial Number = $SERIAL_N" echo " Hardware Ethernet Address = $ADDRESS" echo " Client Machine Type = $CLTYPE" echo " FIS Image to be loaded = $IMAGE\n" echo " Are you satisfied with these selections? ( y or n ) \c" read PS_answer case $PS_answer in [yY]*) REDO="FALSE" break;; [nN]*) SERIAL_N_DEFAULT="$SERIAL_N" ASN_ERROR=0 ADDRESS_DEFAULT="$ADDRESS" AHEA_ERROR=0 IMAGE_DEFAULT="$AFI_answer" CLTYPE_DEFAULT="$ACT_answer" break;; *) continue;; esac done }################################################################################: Assign_Selections################################################################################# This function modifies the ethernet hardware address and writes the responses# to the [client].fisinit file which fisld uses. When this funtion is complete# then tifis starts all over again.Assign_Selections(){ if [ "$DEBUG" = "TRUE" ] then echo "\n" echo "*** Now Entering the Assign_Selections() function" echo "\n" sleep 1 fi echo "\n\n\n $CLIENT is being prepared for FIS installation...\n"# Increment the CLIENT_DEFAULT counter. CLIENT_DEFAULT=`expr $PCS_answer + 1` if [ "$CLIENT_DEFAULT" -gt 20 ] then CLIENT_DEFAULT=1 fi# Modify the client's hardware ethernet address addnode $CLIENT -h $ADDRESS || { echo "\n Could not modify the client's hardware ethernet address.\n Please call support. Exitting...\n"; exit 1;} if [ -f $DNET/nodes_p ] then addnode $CLIENT -P -h $ADDRESS else cp $DNET/nodes_v $DNET/nodes_p fi# Create the ".fisinit" file for fisld to use# touch $HOME/FISINIT/$CLIENT.fisinit || # { echo "\n Could not create $HOME/FISINIT/$CLIENT.fisinit.\n Please call support. Exitting...\n"; exit 1;} echo "$SERVER:$CLTYPE:$SERIAL_N:$ADDRESS:$IMAGE" >> $HOME/FISINIT/$CLIENT.fisinit || { echo "\n Cannot create $CLIENT.fisinit. Please call support. Exitting...\n"; exit 1;} echo " $CLIENT is configured. Boot $CLIENT using the following commands:\n" echo " >> setenv bootmode d" echo " >> setenv bootpath mop()" echo " >> auto\n" echo " Press [Return] to continue...\c" read AS_continue}# Main part of program begins herewhile :do if [ "$DEBUG" = "TRUE" ] then echo "\n" echo "*** Now Entering the MAIN portion of the program..." echo "\n" sleep 1 fi Print_Client_Selection Assign_Client REDO="TRUE" while [ "$REDO" = "TRUE" ] do Ask_Serial_Number Ask_Hardware_Ethernet_Address Ask_Client_Type Ask_FIS_Image Print_Selections done Assign_Selectionsdone
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -