diff --git a/xCAT-server/lib/xcat/plugins/imgcapture.pm b/xCAT-server/lib/xcat/plugins/imgcapture.pm index 088e09ff1..bd4f881de 100644 --- a/xCAT-server/lib/xcat/plugins/imgcapture.pm +++ b/xCAT-server/lib/xcat/plugins/imgcapture.pm @@ -624,6 +624,11 @@ sub sysclone_getimg{ my $masterscript = $sysclone_home . "/scripts" . "/$osimage.master"; my $rc = `sed -i "s/shutdown -r now/reboot -f/g" $masterscript`; + #on redhat5 and centos5, the fs inode size must be 128 + my $node_osver = getOsVersion($node); + if ( $node_osver =~ /rh.*5.*/ || $node_osver =~ /centos5.*/ ) { + `sed -i "s/mke2fs/mke2fs -I 128/g" $masterscript` + } return 0; } @@ -671,6 +676,8 @@ sub sysclone_createosimgdef{ # only update a few attributes which are meanless for sysclone $osimgdef{$osimage}{provmethod} = "sysclone"; $osimgdef{$osimage}{template} = ""; + $osimgdef{$osimage}{otherpkglist} = ""; + $osimgdef{$osimage}{pkglist} = ""; } } else { $createnew = 1; @@ -746,6 +753,19 @@ sub getOsVersion { #elsif (-f "/etc/fedora-release") { $os = 'rhfc' } $os = $os . $version; } + elsif (grep (/CentOS/, @lines)) { + $os = "centos"; + $version = $lines[0]; + $version =~ s/[^0-9]*([0-9.]+).*/$1/; + $os = $os . $version; + } + elsif (grep (/Fedora/, @lines)) { + $os = "fedora"; + $version = $lines[0]; + $version =~ s/[^0-9]*([0-9.]+).*/$1/; + $os = $os . $version; + } + return $os; } diff --git a/xCAT/postscripts/updatenetwork b/xCAT/postscripts/updatenetwork index 4f4e2dfca..a478b7ce7 100644 --- a/xCAT/postscripts/updatenetwork +++ b/xCAT/postscripts/updatenetwork @@ -9,44 +9,45 @@ fi hostname $HOSTNAME +device_name='' +str_mac='' +for str_temp in `cat /proc/cmdline`;do + echo $str_temp | grep -i 'BOOTIF' + if [ $? -eq 0 ];then + str_mac=`echo $str_temp | awk -F= '{print $2}' | sed -r 's/^01-//' | tr '-' ':' | tr 'a-z' 'A-Z'` + device_name=`ifconfig -a | grep -i $str_mac | awk '{print $1}' | head -n 1` + fi + +done + +if [ -z "$device_name" ];then + device_name=$DEVICE + str_mac=`ifconfig $device_name|grep -i HWaddr|awk '{print $5}'` +fi str_cfg_file='' if [ -d "/etc/sysconfig/network-scripts/" ];then #redhat - str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$DEVICE" + rm -f /etc/sysconfig/network-scripts/ifcfg-* + str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$device_name" sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network - if [ -f $str_cfg_file ];then - echo "Old ifcfg-$DEVICE is:" - cat $str_cfg_file - HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'` - sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" $str_cfg_file - sed -i "s/UUID=.*//g" $str_cfg_file - else - echo "DEVICE=\"$DEVICE\"" > $str_cfg_file - echo "BOOTPROTO=\"dhcp\"" >> $str_cfg_file - echo "NM_CONTROLLED=\"yes\"" >> $str_cfg_file - echo "ONBOOT=\"yes\"" >> $str_cfg_file - fi + echo "DEVICE=\"$device_name\"" > $str_cfg_file + echo "BOOTPROTO=\"dhcp\"" >> $str_cfg_file + echo "NM_CONTROLLED=\"yes\"" >> $str_cfg_file + echo "HWADDR=$str_mac" >> $str_cfg_file + echo "ONBOOT=\"yes\"" >> $str_cfg_file elif [ -d "/etc/sysconfig/network/" ];then #suse - str_cfg_file="/etc/sysconfig/network/ifcfg-$DEVICE" + rm -f /etc/sysconfig/network/ifcfg-* + str_cfg_file="/etc/sysconfig/network/ifcfg-$device_name" echo "$HOSTNAME" > /etc/HOSTNAME - if [ -f $str_cfg_file ];then - echo "Old ifcfg-$DEVICE is:" - cat $str_cfg_file - HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'` - sed -i "s/HWADDR=.*/HWADDR=$HWADDR/g" $str_cfg_file - sed -i "s/UUID=.*//g" $str_cfg_file - else - echo "DEVICE=\"$DEVICE\"" > $str_cfg_file - echo "BOOTPROTO=dhcp" >> $str_cfg_file - echo "STARTMODE=onboot" >> $str_cfg_file - echo "DHCLIENT_PRIMARY_DEVICE=yes" >> $str_cfg_file - fi + echo "DEVICE=\"$device_name\"" > $str_cfg_file + echo "HWADDR=$str_mac" >> $str_cfg_file + echo "BOOTPROTO=dhcp" >> $str_cfg_file + echo "STARTMODE=onboot" >> $str_cfg_file + echo "DHCLIENT_PRIMARY_DEVICE=yes" >> $str_cfg_file else #ubuntu echo "Does not support ubuntu." exit 1 fi -echo "New ifcfg-$DEVICE is:" -cat $str_cfg_file