From 353d3571e34430e9b8ac0ad7d57dcaf7ddda9f73 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 4 May 2010 18:22:41 +0000 Subject: [PATCH] -Continue making primarynic an optional value git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5959 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/install/scripts/post.esx | 11 +++++++++-- .../share/xcat/install/scripts/post.rh | 15 +++++++++++++-- .../share/xcat/install/scripts/post.rh.iscsi | 19 ++++++++++++++++++- .../share/xcat/install/scripts/post.sles | 18 +++++++++++++++--- .../share/xcat/install/scripts/post.sles11 | 18 +++++++++++++++--- 5 files changed, 70 insertions(+), 11 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.esx b/xCAT-server/share/xcat/install/scripts/post.esx index aa61bda0f..70404c6f1 100644 --- a/xCAT-server/share/xcat/install/scripts/post.esx +++ b/xCAT-server/share/xcat/install/scripts/post.esx @@ -2,10 +2,17 @@ # Setup hostname # echo "post scripts" >/root/post.log -export PRINIC=#TABLE:noderes:THISNODE:primarynic# +export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic# if [ -z "$PRINIC" ] then - export PRINIC=eth0 + for karg in $(cat /proc/cmdline |sed -e 's/ /\n/g'); do + if [ "${karg%%=*}" = "BOOTIF" ]; then + export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=}"|awk '{print $1}'` + fi + done + if [ -z "$PRINIC" ]; then + export PRINIC=eth0 + fi fi IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') if [ -z $IP ] diff --git a/xCAT-server/share/xcat/install/scripts/post.rh b/xCAT-server/share/xcat/install/scripts/post.rh index 3c86c4b3a..99ab1c1b4 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh +++ b/xCAT-server/share/xcat/install/scripts/post.rh @@ -2,10 +2,21 @@ # Setup hostname # echo "post scripts" >/root/post.log -export PRINIC=#TABLE:noderes:THISNODE:primarynic# +export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic# if [ "$PRINIC" == "mac"] then - export PRINIC=#TABLE:mac:THISNODE:mac# + export PRINIC="#TABLE:mac:THISNODE:mac#" +fi +if [ -z "$PRINIC" ] +then + for karg in $(cat /proc/cmdline |sed -e 's/ /\n/g'); do + if [ "${karg%%=*}" = "BOOTIF" ]; then + export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=}"|awk '{print $1}'` + fi + done + if [ -z "$PRINIC" ]; then + export PRINIC=eth0 + fi fi if [ -z "$PRINIC" ] then diff --git a/xCAT-server/share/xcat/install/scripts/post.rh.iscsi b/xCAT-server/share/xcat/install/scripts/post.rh.iscsi index e9c978922..30b628912 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh.iscsi +++ b/xCAT-server/share/xcat/install/scripts/post.rh.iscsi @@ -2,10 +2,27 @@ # Setup hostname # echo "post scripts" >/root/post.log -export PRINIC=#TABLE:noderes:THISNODE:primarynic# +export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic# +if [ "$PRINIC" == "mac"] +then + export PRINIC="#TABLE:mac:THISNODE:mac#" +fi +if [ -z "$PRINIC" ] +then + for karg in $(cat /proc/cmdline |sed -e 's/ /\n/g'); do + if [ "${karg%%=*}" = "BOOTIF" ]; then + export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=}"|awk '{print $1}'` + fi + done + if [ -z "$PRINIC" ]; then + export PRINIC=eth0 + fi +fi if [ -z "$PRINIC" ] then export PRINIC=eth0 +elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then + export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'` fi IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') if [ -z $IP ] diff --git a/xCAT-server/share/xcat/install/scripts/post.sles b/xCAT-server/share/xcat/install/scripts/post.sles index f78028822..8ccf6c081 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles +++ b/xCAT-server/share/xcat/install/scripts/post.sles @@ -16,12 +16,24 @@ BOOTPROTO=dhcp STARTMODE=onboot EOF -export PRINIC=#TABLE:noderes:$NODE:primarynic# +export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic# if [ "$PRINIC" == "mac"] then - export PRINIC=#TABLE:mac:$NODE:mac# + export PRINIC="#TABLE:mac:THISNODE:mac#" fi -if [ -z "$PRINIC" ]; then +if [ -z "$PRINIC" ] +then + for karg in $(cat /proc/cmdline |sed -e 's/ /\n/g'); do + if [ "${karg%%=*}" = "BOOTIF" ]; then + export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=}"|awk '{print $1}'` + fi + done + if [ -z "$PRINIC" ]; then + export PRINIC=eth0 + fi +fi +if [ -z "$PRINIC" ] +then export PRINIC=eth0 elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'` diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11 b/xCAT-server/share/xcat/install/scripts/post.sles11 index e20c907a1..558afcf19 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11 +++ b/xCAT-server/share/xcat/install/scripts/post.sles11 @@ -16,12 +16,24 @@ BOOTPROTO=dhcp STARTMODE=onboot EOF -export PRINIC=#TABLE:noderes:$NODE:primarynic# +export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic# if [ "$PRINIC" == "mac"] then - export PRINIC=#TABLE:mac:$NODE:mac# + export PRINIC="#TABLE:mac:THISNODE:mac#" fi -if [ -z "$PRINIC" ]; then +if [ -z "$PRINIC" ] +then + for karg in $(cat /proc/cmdline |sed -e 's/ /\n/g'); do + if [ "${karg%%=*}" = "BOOTIF" ]; then + export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=}"|awk '{print $1}'` + fi + done + if [ -z "$PRINIC" ]; then + export PRINIC=eth0 + fi +fi +if [ -z "$PRINIC" ] +then export PRINIC=eth0 elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'`