mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 11:22:27 +00:00 
			
		
		
		
	added postscript setuppostbootscripts to support value change for site.runbootscripts.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14208 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -922,7 +922,9 @@ site => { | ||||
|    " runbootscripts:  If set to 'yes' the scripts listed in the postbootscripts\n". | ||||
|    "                  attribute in the osimage and postscripts tables will be run during\n". | ||||
|    "                  each reboot of stateful (diskful) nodes. This attribute has no\n". | ||||
|    "                  effect on stateless and statelite nodes.\n\n". | ||||
|    "                  effect on stateless and statelite nodes. Please run the following\n" . | ||||
|    "                  command after you change the value of this attribute: \n". | ||||
|    "                  'updatenode <nodes> -P setuppostbootscripts'\n\n". | ||||
|    " syspowerinterval:  For system p CECs, this is the number of seconds the rpower\n". | ||||
|    "                 command will wait between performing the action for each CEC.\n". | ||||
|    "                 For system x IPMI servers, this is the number of seconds the\n". | ||||
|   | ||||
| @@ -139,16 +139,16 @@ cat >/etc/init.d/xcatpostinit1 << 'EOF' | ||||
| #INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1# | ||||
| EOF | ||||
| chmod 755 /etc/init.d/xcatpostinit1 | ||||
| ln -s /etc/init.d/xcatpostinit1 /etc/rc3.d/S84xcatpostinit1 | ||||
| ln -s /etc/init.d/xcatpostinit1 /etc/rc4.d/S84xcatpostinit1 | ||||
| ln -s /etc/init.d/xcatpostinit1 /etc/rc5.d/S84xcatpostinit1 | ||||
| ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc3.d/S84xcatpostinit1 | ||||
| ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc4.d/S84xcatpostinit1 | ||||
| ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc5.d/S84xcatpostinit1 | ||||
| mkdir -p /opt/xcat | ||||
| cat >/opt/xcat/xcatinstallpost << 'EOF' | ||||
| #INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost# | ||||
| EOF | ||||
| chmod 755 /opt/xcat/xcatinstallpost | ||||
|  | ||||
| chkconfig --add xcatpostinit1 | ||||
| chkconfig xcatpostinit1 on | ||||
|  | ||||
| #create the dskls post  | ||||
| cat >/opt/xcat/xcatdsklspost << 'EOF' | ||||
|   | ||||
							
								
								
									
										71
									
								
								xCAT/postscripts/setuppostbootscripts
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										71
									
								
								xCAT/postscripts/setuppostbootscripts
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,71 @@ | ||||
| #!/bin/sh | ||||
| # IBM(c) 2012 EPL license http://www.eclipse.org/legal/epl-v10.html | ||||
|  | ||||
| #------------------------------------------------------------------------------- | ||||
| #=head1  setuppostbootscripts  | ||||
| #=head2  This command setup the node so that when the node reboots, | ||||
| #        the postbootscripts will be run or not depending on the    | ||||
| #        site.runbootscripts setting.  | ||||
| #        If site.runbootscripts is 'yes', then the scripts defined by | ||||
| #        postscripts.postbootscripts will be run when the node reboots.  | ||||
| #=cut | ||||
| #------------------------------------------------------------------------------- | ||||
|  | ||||
| #only works for diskful nodes | ||||
| if [ "$NODESETSTATE" = "netboot" -o \ | ||||
|      "$NODESETSTATE" = "statelite" -o \ | ||||
|      "$NODESETSTATE" = "diskless" -o \ | ||||
|      "$NODESETSTATE" = "dataless" ]; then | ||||
|     echo "Nothng to do for stateless and statelite node." | ||||
|     exit 0 | ||||
| fi | ||||
|  | ||||
| #create /opt/xcat directory if not exist | ||||
| if [ ! -d "/opt/xcat" ]; then | ||||
|     mkdir -p /opt/xcat | ||||
| fi | ||||
|  | ||||
| #copy the necessary files | ||||
| rsync /xcatpost/xcatdsklspost /opt/xcat/xcatdsklspost | ||||
| rsync /xcatpost/xcatinstallpost /opt/xcat/xcatinstallpost | ||||
| rsync /xcatpost/xcatpostinit1 /etc/init.d/xcatpostinit1 | ||||
| chmod 755 /etc/init.d/xcatpostinit1 | ||||
|  | ||||
| if [ ! -f "/etc/rc.d/rc3.d/S84xcatpostinit1" ]; then  | ||||
|     ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc3.d/S84xcatpostinit1 | ||||
| fi | ||||
| if [ ! -f "/etc/rc.d/rc4.d/S84xcatpostinit1" ]; then | ||||
|     ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc4.d/S84xcatpostinit1 | ||||
| fi | ||||
| if [ ! -f "/etc/rc.d/rc5.d/S84xcatpostinit1" ]; then | ||||
|     ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc5.d/S84xcatpostinit1 | ||||
| fi | ||||
|  | ||||
| #put correct info in /opt/xcat/xcatinfo | ||||
| infofile="/opt/xcat/xcatinfo" | ||||
| if [ ! -f $infofile ]; then | ||||
|     echo "XCATSERVER=$MASTER" > $infofile | ||||
|     echo "REBOOT=TRUE" >> $infofile | ||||
| else | ||||
|     value=`grep XCATSERVER $infofile` | ||||
|     if [[ -n $value ]]; then | ||||
|         sed -i "s/^XCATSERVER=.*$/XCATSERVER=$MASTER/" $infofile | ||||
|     else  | ||||
|         echo "XCATSERVER=$MASTER" >> $infofile | ||||
|     fi | ||||
|     value=`grep REBOOT $infofile` | ||||
|     if [[ -n $value ]]; then | ||||
|         sed -i "s/^REBOOT=.*$/REBOOT=TRUE/" $infofile | ||||
|     else  | ||||
|         echo REBOOT=TRUE >> $infofile | ||||
|     fi | ||||
| fi | ||||
| #enable/disable the running of postscripts according to site.runbootscripts | ||||
| if [[ "$RUNBOOTSCRIPTS" = "yes" ]]; then | ||||
|     output=`chkconfig xcatpostinit1 on 2>&1  > /dev/null` | ||||
| else | ||||
|     output=`chkconfig xcatpostinit1 off 2>&1  > /dev/null` | ||||
| fi | ||||
|  | ||||
| exit 0 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user