From 56ed1f53d029797be8c48a91519dedf38dd5b6eb Mon Sep 17 00:00:00 2001 From: xq2005 Date: Thu, 22 Aug 2013 22:58:53 -0700 Subject: [PATCH] postscripts modification for sysclone on sles --- xCAT/postscripts/configefi | 47 ++++++++++++++++++++++++++++++++-- xCAT/postscripts/killsyslog | 4 --- xCAT/postscripts/updatenetwork | 6 ++--- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/xCAT/postscripts/configefi b/xCAT/postscripts/configefi index 6067248ce..4db78507c 100644 --- a/xCAT/postscripts/configefi +++ b/xCAT/postscripts/configefi @@ -1,2 +1,45 @@ -echo "Setting Boot Manager for the next boot." -efibootmgr -c -l \\EFI\\redhat\\grub.efi -L Linux +if [ -d /sys/firmware/efi ]; then + echo "Setting Boot Manager for the next boot." + efibootmgr -c -l \\EFI\\redhat\\grub.efi -L Linux +else + echo "run grub-install to configure the MBR." + if [ -e /etc/mtab ];then + mv /etc/mtab /etc/mtab.bak + fi + grep -v rootfs /proc/mounts > /etc/mtab + boot_device='' + if [ -f "/etc/systemconfig/systemconfig.conf" ];then + boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'` + else + str_temp=`mount | awk '{print $1","$3}'` + for line in $str_temp + do + mp=`echo $line | awk -F, '{print $2}'` + if [ "$mp" = "/" ];then + boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'` + break + fi + done + fi + + if [ -n "$boot_device" ];then + echo "the boot device is $boot_device" + else + echo "Can not find the boot device, return error" + exit 1 + fi + + #for sles10, should run grub-install with parameters + echo "grub-install --no-floppy --recheck $boot_device" + grub-install --no-floppy --recheck $boot_device + if [ $? -ne 0 ];then + #sles11, run grub install directly + grub-install + fi + + if [ -e /etc/mtab.bak ];then + mv -f /etc/mtab.bak /etc/mtab + else + rm -f /etc/mtab + fi +fi diff --git a/xCAT/postscripts/killsyslog b/xCAT/postscripts/killsyslog index 47aa106b5..ba2395caa 100755 --- a/xCAT/postscripts/killsyslog +++ b/xCAT/postscripts/killsyslog @@ -1,7 +1,3 @@ -#!/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 diff --git a/xCAT/postscripts/updatenetwork b/xCAT/postscripts/updatenetwork index 4e7e9355d..fc82ab64d 100644 --- a/xCAT/postscripts/updatenetwork +++ b/xCAT/postscripts/updatenetwork @@ -7,21 +7,21 @@ 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" + sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network elif [ -d "/etc/sysconfig/network/" ];then #suse str_cfg_file="/etc/sysconfig/network/ifcfg-$DEVICE" + echo "$HOSTNAME" > /etc/HOSTNAME else #ubuntu str_cfg_file="/etc/network/interfaces.d/$DEVICE" + echo "$HOSTNAME" > /etc/hostname fi echo "Old ifcfg-$DEVICE is:"