From a6d88250461bc1253c01e6a310b39d0d0d7ae5a3 Mon Sep 17 00:00:00 2001 From: mxi1 Date: Wed, 14 Jul 2010 08:14:16 +0000 Subject: [PATCH] move xcatdsklspost from gettyset to xcatpostinit on redhat, will do the samething later git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6740 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/netboot/rh/genimage | 19 +++++------- xCAT/postscripts/xcatpostinit | 34 +++++++++++++++++++--- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 69020b3aa..33cd043de 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1274,7 +1274,7 @@ sub generic_post { #This function is meant to leave the image in a state approxi # gettyset is not found on s390x if ($arch ne "s390x") { - open($cfgfile,">","$rootimg_dir/etc/rc3.d/S60gettyset"); + open($cfgfile,">","$rootimg_dir/etc/init.d/gettyset"); print $cfgfile "#!/bin/bash\n"; print $cfgfile "for i in `cat /proc/cmdline`; do\n"; print $cfgfile ' KEY=`echo $i|cut -d= -f 1`'."\n"; @@ -1293,17 +1293,14 @@ sub generic_post { #This function is meant to leave the image in a state approxi print $cfgfile " fi\n"; print $cfgfile " fi\n"; print $cfgfile "done\n"; - chmod(0755,"$rootimg_dir/etc/rc3.d/S60gettyset"); + close $cfgfile; + + chmod(0755,"$rootimg_dir/etc/init.d/gettyset"); + link "$rootimg_dir/etc/init.d/gettyset", "$rootimg_dir/etc/rc3.d/S60gettyset"; - #link("$rootimg_dir/sbin/init","$rootimg_dir/init"); - #add postscript support for redhat - if($mode eq "statelite") { - print $cfgfile "/opt/xcat/xcatdsklspost 4\n"; - } else { - print $cfgfile "/opt/xcat/xcatdsklspost\n"; - } - - close($cfgfile); + copy("$installroot/postscripts/xcatpostinit", "$rootimg_dir/etc/init.d/xcatpostinit"); + chmod(0755, "$rootimg_dir/etc/init.d/xcatpostinit"); + link "$rootimg_dir/etc/init.d/xcatpostinit", "$rootimg_dir/etc/rc3.d/S61xcatpostinit"; } copy(<$rootimg_dir/boot/vmlinuz*>,"$destdir/kernel"); } diff --git a/xCAT/postscripts/xcatpostinit b/xCAT/postscripts/xcatpostinit index 5da91f1df..417655f8d 100755 --- a/xCAT/postscripts/xcatpostinit +++ b/xCAT/postscripts/xcatpostinit @@ -34,9 +34,35 @@ stop) logger -t xcat "nothing to stop" ;; start) - # run /opt/xcat/xcatdsklspost - if [ -r /opt/xcat/xcatdsklspost ]; then - /opt/xcat/xcatdsklspost - fi + # Node is stateless by default + STATELITE="No" + + # Node is statelite if /proc/cmdline have flag `STATEMNT=' + STATELITE_FLAG="STATEMNT=" + + # Script to direct further actions + SCRIPT="/opt/xcat/xcatdsklspost" + + # Usefull information passed as kernel arguments + if [ -f "/proc/cmdline" ]; then + if grep --quiet --no-messages "$STATELITE_FLAG" "/proc/cmdline"; then + STATELITE="Yes" + fi + fi + + # Test for script existance + if ! [ -x "$SCRIPT" ]; then + msg "can't locate executable $SCRIPT" + exit -1 + fi + + # Run $SCRIPT according to node type + if [ -n "$STATELITE" -a -z "${STATELITE/[yY][eE][sS]/}" ]; then + logger -t xCAT "Call $SCRIPT for statelite mode" + "$SCRIPT" 4 + else + logger -t xCAT "Call $SCRIPT for stateless mode" + "$SCRIPT" + fi ;; esac