From 3188ab14cc796e85a494e6c6bf8747e9ce7ef1bb Mon Sep 17 00:00:00 2001 From: xq2005 Date: Tue, 20 Aug 2013 02:09:46 -0700 Subject: [PATCH] postscripts modifiction about sysclone supporting for sles on master --- xCAT/postscripts/killsyslog | 11 +++++++++++ xCAT/postscripts/runxcatpost | 10 +++++++++- xCAT/postscripts/updatenetwork | 26 ++++++++++++++++++++++---- 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100755 xCAT/postscripts/killsyslog diff --git a/xCAT/postscripts/killsyslog b/xCAT/postscripts/killsyslog new file mode 100755 index 000000000..47aa106b5 --- /dev/null +++ b/xCAT/postscripts/killsyslog @@ -0,0 +1,11 @@ +#!/bin/bash + +#only used in sysclone when the image os is sles + +if [ -f "/etc/SuSE-release" ];then + str_out=`ps -ef | grep -v grep | grep syslog-ng` + if [ $? -eq 0 ];then + str_id=`echo $str_out | awk '{print $2}'` + kill -9 $str_id + fi +fi diff --git a/xCAT/postscripts/runxcatpost b/xCAT/postscripts/runxcatpost index 0dbf33f5e..9d4647342 100644 --- a/xCAT/postscripts/runxcatpost +++ b/xCAT/postscripts/runxcatpost @@ -1 +1,9 @@ -/opt/xcat/xcatdsklspost \ No newline at end of file +#!/bin/bash +/opt/xcat/xcatdsklspost + +. /tmp/post-install/variables.txt + +if [ -x "/xcatpost/updateflag.awk" ];then + /xcatpost/updateflag.awk $IMAGESERVER 3002 +fi + diff --git a/xCAT/postscripts/updatenetwork b/xCAT/postscripts/updatenetwork index d40cfdbd2..4e7e9355d 100644 --- a/xCAT/postscripts/updatenetwork +++ b/xCAT/postscripts/updatenetwork @@ -1,17 +1,35 @@ #!/bin/bash . /tmp/post-install/variables.txt +#delete the udev rule in the image +rule_file=`ls /etc/udev/rules.d/*net_persistent_names.rules` +if [ -n "$rule_file" ];then + rm -f $rule_file +fi + echo "Updating hostname to $HOSTNAME" sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network hostname $HOSTNAME +str_cfg_file='' +if [ -d "/etc/sysconfig/network-scripts/" ];then + #redhat + str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$DEVICE" +elif [ -d "/etc/sysconfig/network/" ];then + #suse + str_cfg_file="/etc/sysconfig/network/ifcfg-$DEVICE" +else + #ubuntu + str_cfg_file="/etc/network/interfaces.d/$DEVICE" +fi + echo "Old ifcfg-$DEVICE is:" -cat /etc/sysconfig/network-scripts/ifcfg-$DEVICE +cat $str_cfg_file HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'` -sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" /etc/sysconfig/network-scripts/ifcfg-$DEVICE -sed -i "s/UUID=.*//g" /etc/sysconfig/network-scripts/ifcfg-$DEVICE +sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" $str_cfg_file +sed -i "s/UUID=.*//g" $str_cfg_file echo "New ifcfg-$DEVICE is:" -cat /etc/sysconfig/network-scripts/ifcfg-$DEVICE +cat $str_cfg_file