From ce0d0e18f7d43bc70a328930fb840d1fa3ce00d7 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Tue, 17 Sep 2013 00:49:04 -0700 Subject: [PATCH] bug 3763:write install nics's configuration file --- xCAT/postscripts/configeth | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index b17a92779..f3e03aefe 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -408,6 +408,11 @@ elif [ "$1" = "-s" ];then str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` fi fi + if [ -n "$MACADDRESS" ];then + str_inst_mac=$MACADDRESS + else + str_inst_mac=`ifconfig $str_inst_nic | grep HWaddr | awk -F'HWaddr' '{print $2}' | sed 's/\s*//'` + fi if [ -z "$str_inst_ip" -o -z "$str_inst_mask" ];then logger -t xcat -p local4.err "configeth: config install nic, can not find the information from lease file, return." @@ -421,6 +426,7 @@ elif [ "$1" = "-s" ];then echo "iface ${str_inst_nic} inet static" >> $str_conf_file echo " address ${str_inst_ip}" >> $str_conf_file echo " netmask ${str_inst_mask}" >> $str_conf_file + echo " hwaddress ether ${str_inst_mac}" >> $str_conf_file if [ -n "$str_inst_gateway" ];then echo " gateway $str_inst_gateway" >> $str_conf_file fi @@ -432,6 +438,7 @@ elif [ "$1" = "-s" ];then echo "BOOTPROTO=static" >> $str_conf_file echo "IPADDR=${str_inst_ip}" >> $str_conf_file echo "NETMASK=${str_inst_mask}" >> $str_conf_file + echo "HWADDR=${str_inst_mac}" >> $str_conf_file echo "STARTMODE=onboot" >> $str_conf_file if [ -n "$str_inst_gateway" ];then grep -i "default" /etc/sysconfig/network/routes @@ -451,6 +458,7 @@ elif [ "$1" = "-s" ];then echo "NETMASK=${str_inst_mask}" >> $str_conf_file echo "BOOTPROTO=static" >> $str_conf_file echo "ONBOOT=yes" >> $str_conf_file + echo "HWADDR=${str_inst_mac}" >> $str_conf_file if [ -n "$str_inst_gateway" ];then grep -i "GATEWAY" /etc/sysconfig/network if [ $? -eq 0 ];then