mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	support patterns for updating sles os packages in updatenode
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6929 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -504,6 +504,10 @@ sub get_pkglist_tex | ||||
| 	   next if ( /^\s*#/ &&  | ||||
| 		     !/^\s*#INCLUDE:[^#^\n]+#/ && | ||||
| 		     !/^\s*#NEW_INSTALL_LIST#/ ); #-- skip comments | ||||
|            if (/^@(.*)/) {  #for groups that has space in name | ||||
| 	       my $save=$1; | ||||
| 	       if ($1 =~ / /) { $_ = "\@\'" . $save . "\'"; } | ||||
| 	   } | ||||
| 	   push(@otherpkgs,$_); | ||||
|        } | ||||
|        close(FILE1); | ||||
|   | ||||
| @@ -72,6 +72,10 @@ sub subvars { | ||||
|       $doneincludes=0; | ||||
|       $inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1, 0, 1)/eg; | ||||
|     } | ||||
|     if ($inc =~ /#INCLUDE_PTRNLIST:[^#^\n]+#/) { | ||||
|       $doneincludes=0; | ||||
|       $inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1, 0, 2)/eg; | ||||
|     } | ||||
|     if ($inc =~ /#INCLUDE:[^#^\n]+#/) { | ||||
|       $doneincludes=0; | ||||
|       $inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg; | ||||
| @@ -87,6 +91,7 @@ sub subvars { | ||||
|   $inc =~ s/#COMMAND:([^#]+)#/command($1)/eg; | ||||
|   $inc =~ s/#INCLUDE_NOP:([^#^\n]+)#/includefile($1,1,0)/eg; | ||||
|   $inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1,0,1)/eg; | ||||
|   $inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1,0,2)/eg; | ||||
|   $inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg; | ||||
|   $inc =~ s/#HOSTNAME#/$node/eg; | ||||
|  | ||||
| @@ -176,7 +181,7 @@ sub includefile | ||||
| { | ||||
|     my $file = shift; | ||||
|     my $special=shift; | ||||
|     my $pkglist=shift; | ||||
|     my $pkglist=shift; #1 means package list, 2 means pattern list, pattern list starts with @ | ||||
|     my $text = ""; | ||||
|     unless ($file =~ /^\//) { | ||||
|       $file = $idir."/".$file; | ||||
| @@ -187,18 +192,32 @@ sub includefile | ||||
|     my $pkgb = ""; | ||||
|     my $pkge = ""; | ||||
|     if ($pkglist) { | ||||
|       $pkgb = "<package>"; | ||||
|       $pkge = "</package>"; | ||||
|     } | ||||
| 	if ($pkglist == 2) { | ||||
| 	    $pkgb = "<pattern>"; | ||||
| 	    $pkge = "</pattern>"; | ||||
| 	} else { | ||||
| 	    $pkgb = "<package>"; | ||||
| 	    $pkge = "</package>"; | ||||
| 	} | ||||
|     }  | ||||
|     while(<INCLUDE>) { | ||||
|         if ($pkglist) { | ||||
|         if ($pkglist == 1) { | ||||
|             s/#INCLUDE:/#INCLUDE_PKGLIST:/; | ||||
|         }  elsif ($pkglist == 2) { | ||||
|             s/#INCLUDE:/#INCLUDE_PTRNLIST:/; | ||||
|         } | ||||
|         if (( $_ =~ /^\s*#/ ) || ( $_ =~ /^\s*$/ )) { | ||||
|  | ||||
|         if (( $_ =~ /^\s*#/ ) || ( $_ =~ /^\s*$/ )) {  | ||||
| 	    $text .= "$_"; | ||||
|         } else { | ||||
|             chomp; | ||||
|             s/\s*$//; | ||||
|             chomp;  #remove tailing spaces | ||||
|             s/\s*$//;  #removes leading spaces | ||||
| 	    next if (($pkglist == 1) && (/^@/));  #for packge list, do not include the lines start with @ | ||||
| 	    if ($pkglist == 2) { #for pattern list, only include the lines start with @ | ||||
| 		if (/^@(.*)/) { | ||||
| 		    $_=$1; | ||||
| 		} else { next; } | ||||
| 	    }  | ||||
| 	    $text .= "$pkgb$_$pkge\n"; | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -542,14 +542,19 @@ sub mkinstall | ||||
|             next; | ||||
|         } | ||||
|  | ||||
|         #substitute the tag #INCLUDE_DEFAULT_PKGS# with package file name | ||||
| 	$new_tmplfile=$tmplfile; | ||||
|         #substitute the tag #INCLUDE_DEFAULT_PKGLIST# with package file name | ||||
|         #substitute the tag #INCLUDE_DEFAULT_PERNLIST# with package file name | ||||
| 	my $new_tmplfile=$tmplfile; | ||||
| 	if ($pkglistfile) { | ||||
| 	    $pkglistfile =~ s/\//\\\//g; | ||||
| 	    #print "pkglistfile=$pkglistfile\n"; | ||||
| 	    system("sed -e \"s/#INCLUDE_DEFAULT_PKGLIST#/#INCLUDE_PKGLIST:$pkglistfile#/\" $tmplfile > /tmp/xcattemp.tmpl"); | ||||
| 	    system("sed -e \"s/#INCLUDE_DEFAULT_PKGLIST#/#INCLUDE_PKGLIST:$pkglistfile#/\" $tmplfile > /tmp/xcattemp1.tmpl"); | ||||
|             if ($? == 0) { | ||||
| 		$new_tmplfile="/tmp/xcattemp.tmpl"; | ||||
| 		$new_tmplfile="/tmp/xcattemp1.tmpl"; | ||||
| 	    } | ||||
| 	    system("sed -e \"s/#INCLUDE_DEFAULT_PTRNLIST#/#INCLUDE_PTRNLIST:$pkglistfile#/\" $new_tmplfile > /tmp/xcattemp2.tmpl"); | ||||
|             if ($? == 0) { | ||||
| 		$new_tmplfile="/tmp/xcattemp2.tmpl"; | ||||
| 	    } | ||||
| 	} | ||||
|  | ||||
| @@ -564,7 +569,8 @@ sub mkinstall | ||||
|                          $node | ||||
|                          ); | ||||
|         } | ||||
| 	system("rm -f /tmp/xcattemp.tmpl"); | ||||
| 	system("rm -f /tmp/xcattemp1.tmpl"); | ||||
| 	system("rm -f /tmp/xcattemp2.tmpl"); | ||||
|  | ||||
|         if ($tmperr) | ||||
|         { | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| @base | ||||
| @x11 | ||||
| openssl | ||||
| xntp | ||||
| rsync | ||||
|   | ||||
| @@ -1,3 +1,6 @@ | ||||
| @base-64bit | ||||
| @base | ||||
| @x11 | ||||
| openssl | ||||
| xntp | ||||
| rsync | ||||
|   | ||||
| @@ -38,9 +38,7 @@ | ||||
|     </partitioning> | ||||
|     <software> | ||||
|       <patterns config:type="list"> | ||||
|         <pattern>base-64bit</pattern> | ||||
|         <pattern>base</pattern> | ||||
| 	    <pattern>x11</pattern> | ||||
|        #INCLUDE_DEFAULT_PTRNLIST# | ||||
|       </patterns> | ||||
|       <packages config:type="list"> | ||||
|         #INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -1 +1,4 @@ | ||||
| @base | ||||
| @x11 | ||||
| @gnome | ||||
|   | ||||
| @@ -539,9 +539,7 @@ | ||||
|   <!-- Software to install on Linux --> | ||||
|   <software> | ||||
|     <patterns config:type="list"> | ||||
|       <pattern>base</pattern> | ||||
|       <pattern>x11</pattern> | ||||
|       <pattern>gnome</pattern> | ||||
|       #INCLUDE_DEFAULT_PTRNLIST# | ||||
|     </patterns> | ||||
|     <packages config:type="list"> | ||||
|       #INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -1,2 +1,4 @@ | ||||
| @base | ||||
| @x11 | ||||
| xntp | ||||
| rsync | ||||
|   | ||||
| @@ -1 +1,4 @@ | ||||
| @base | ||||
| @x11 | ||||
| @gnome | ||||
|   | ||||
| @@ -539,9 +539,7 @@ | ||||
|   <!-- Software to install on Linux --> | ||||
|   <software> | ||||
|     <patterns config:type="list"> | ||||
|       <pattern>base</pattern> | ||||
|       <pattern>x11</pattern> | ||||
|       <pattern>gnome</pattern> | ||||
|         #INCLUDE_DEFAULT_PTRNLIST# | ||||
|     </patterns> | ||||
|     <packages config:type="list"> | ||||
|       #INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -38,8 +38,7 @@ | ||||
|     </partitioning> | ||||
|     <software> | ||||
|       <patterns config:type="list"> | ||||
|         <pattern>base</pattern> | ||||
| 	    <pattern>x11</pattern> | ||||
|         #INCLUDE_DEFAULT_PTRNLIST# | ||||
|       </patterns> | ||||
|       <packages config:type="list"> | ||||
|         #INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -38,8 +38,7 @@ | ||||
|     </partitioning> | ||||
|     <software> | ||||
|       <patterns config:type="list"> | ||||
|         <pattern>base</pattern> | ||||
| 	    <pattern>x11</pattern> | ||||
|         #INCLUDE_DEFAULT_PTRNLIST# | ||||
|       </patterns> | ||||
|       <packages config:type="list"> | ||||
| 	#INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| @base | ||||
| @x11 | ||||
| xntp | ||||
| rsync | ||||
| open-iscsi | ||||
|   | ||||
| @@ -50,8 +50,7 @@ | ||||
|     </partitioning> | ||||
|     <software> | ||||
|       <patterns config:type="list"> | ||||
|         <pattern>base</pattern> | ||||
| 	    <pattern>x11</pattern> | ||||
|         #INCLUDE_DEFAULT_PTRNLIST# | ||||
|       </patterns> | ||||
|       <packages config:type="list"> | ||||
|         #INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| @base | ||||
| @x11 | ||||
| xntp | ||||
| rsync | ||||
| open-iscsi | ||||
|   | ||||
| @@ -49,8 +49,7 @@ | ||||
|     </partitioning> | ||||
|     <software> | ||||
|       <patterns config:type="list"> | ||||
|         <pattern>base</pattern> | ||||
| 	    <pattern>x11</pattern> | ||||
|         #INCLUDE_DEFAULT_PTRNLIST# | ||||
|       </patterns> | ||||
|       <packages config:type="list"> | ||||
|         #INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| @base | ||||
| @x11 | ||||
| xntp | ||||
| rsync | ||||
| nmap | ||||
|   | ||||
| @@ -38,8 +38,7 @@ | ||||
|     </partitioning> | ||||
|     <software> | ||||
|       <patterns config:type="list"> | ||||
|         <pattern>base</pattern> | ||||
| 	    <pattern>x11</pattern> | ||||
|         #INCLUDE_DEFAULT_PTRNLIST# | ||||
|       </patterns> | ||||
|       <packages config:type="list"> | ||||
|         #INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -1,3 +1,8 @@ | ||||
| @base | ||||
| @x11 | ||||
| @xen_server | ||||
| @xen_server-32bit | ||||
| @32bit | ||||
| xntp | ||||
| rsync | ||||
| xen | ||||
|   | ||||
| @@ -82,11 +82,7 @@ | ||||
|   </partitioning> | ||||
|   <software> | ||||
|     <patterns config:type="list"> | ||||
|       <pattern>base</pattern> | ||||
|       <pattern>x11</pattern> | ||||
|       <pattern>xen_server</pattern> | ||||
|       <pattern>xen_server-32bit</pattern> | ||||
|       <pattern>32bit</pattern> | ||||
|       #INCLUDE_DEFAULT_PTRNLIST# | ||||
|     </patterns> | ||||
|     <packages config:type="list"> | ||||
|       #INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -1,2 +1,4 @@ | ||||
| @base | ||||
| @x11 | ||||
| xntp | ||||
| rsync | ||||
|   | ||||
| @@ -38,8 +38,7 @@ | ||||
|     </partitioning> | ||||
|     <software> | ||||
|       <patterns config:type="list"> | ||||
|         <pattern>base</pattern> | ||||
| 	    <pattern>x11</pattern> | ||||
|         #INCLUDE_DEFAULT_PTRNLIST# | ||||
|       </patterns> | ||||
|       <packages config:type="list"> | ||||
|         #INCLUDE_DEFAULT_PKGLIST# | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!/bin/sh | ||||
| #!/bin/sh -x | ||||
| # IBM(c) 2010 EPL license http://www.eclipse.org/legal/epl-v10.html | ||||
|  | ||||
| #------------------------------------------------------------------------------- | ||||
| @@ -77,25 +77,45 @@ if [ $debug -ne 0 ]; then | ||||
|     echo OSPKGS = $OSPKGS  | ||||
| fi | ||||
|  | ||||
| pkgs=`echo $OSPKGS |tr ',' ' '` | ||||
| pkgs=''  #packages | ||||
| groups=''   #groups | ||||
| pkgs_d=''   #packages to remove | ||||
| for x in `echo "$OSPKGS" | tr "," "\n"` | ||||
| do | ||||
|     echo x=$x | ||||
|     pos=`expr index  $x -` | ||||
|     if [ $pos -eq 1 ]; then  | ||||
| 	pkgs_d="$pkgs_d ${x#-}" | ||||
|     else | ||||
| 	pos=`expr index  $x @` | ||||
| 	if [ $pos -eq 1 ]; then  | ||||
| 	    groups="$groups ${x#@}" | ||||
| 	else | ||||
| 	    pkgs="$pkgs $x" | ||||
| 	fi | ||||
|     fi | ||||
| done | ||||
| echo "pkgs=$pkgs" | ||||
| echo "groups=$groups" | ||||
| echo "remove pkgs=$pkgs_d" | ||||
|  | ||||
| if [[ $OSVER = sles10* ]]; then | ||||
|     #check if zypper is installed | ||||
|     result=`rpm -q zypper` | ||||
|     #check if rug is installed | ||||
|     result=`rpm -q rug` | ||||
|     if [ $? -ne 0 ]; then  | ||||
| 	echo "Please install zypper on $NODE." | ||||
| 	echo "Please install rug on $NODE." | ||||
| 	exit 1 | ||||
|     fi | ||||
|  | ||||
|     #remove old repo | ||||
|     old_repo=`zypper sl |grep -e "^[0-9]" | cut -f2 -d '|'` | ||||
|     old_repo=`rug sl |grep -e "^[0-9]" | cut -f2 -d '|'` | ||||
|     for x in $old_repo | ||||
|     do | ||||
|         result=`zypper sd $x` | ||||
|         result=`rug sd $x` | ||||
|     done | ||||
|     result=`zypper --non-interactive refresh 2>&1` | ||||
|     result=`rug  refresh 2>&1` | ||||
|     if [ $debug -ne 0 ]; then | ||||
| 	echo "zypper --non-interactive refresh" | ||||
| 	echo "rug refresh" | ||||
| 	echo $result | ||||
|     fi | ||||
|  | ||||
| @@ -103,44 +123,83 @@ if [[ $OSVER = sles10* ]]; then | ||||
|     if [ $mounted -eq 0 ]; then | ||||
| 	path="ftp://$OSPKGDIR" | ||||
|     else | ||||
|         path="file://$OSPKGDIR" | ||||
|         path="dir://$OSPKGDIR" | ||||
|     fi | ||||
|     result=`zypper sa $path $OSVER` | ||||
|     result=`rug sa $path $OSVER` | ||||
|     if [ $? -ne 0 ]; then  | ||||
| 	logger -t xcat "ospkgs: zypper sa $path $OSVER\n    $result" | ||||
| 	echo "ospkgs: zypper sa $path $OSVER\n    $result" | ||||
| 	logger -t xcat "ospkgs: rug sa $path $OSVER\n    $result" | ||||
| 	echo "ospkgs: rug sa $path $OSVER\n    $result" | ||||
|     fi | ||||
|     result=`zypper --non-interactive refresh 2>&1`  | ||||
|     result=`rug sub $OSVER` | ||||
|     if [ $? -ne 0 ]; then  | ||||
| 	logger -t xcat "ospkgs: rug sub $OSVER\n    $result" | ||||
| 	echo "ospkgs: rug sub $OSVER\n    $result" | ||||
|     fi | ||||
|     result=`rug refresh 2>&1`  | ||||
|     if [ $debug -ne 0 ]; then | ||||
| 	echo "zypper --non-interactive refresh" | ||||
| 	echo "rug refresh" | ||||
| 	echo $result | ||||
|     fi | ||||
|  | ||||
|     #upgrade existing rpms | ||||
|     result=`zypper --non-interactive update --auto-agree-with-licenses` | ||||
|     result=`rug update -y --agree-to-third-party-licences` | ||||
|     if [ $? -ne 0 ]; then  | ||||
| 	logger -t xcat "ospkgs: zypper --non-interactive update --auto-agree-with-licenses\n    $result" | ||||
|         echo "ospkgs: zypper --non-interactive update --auto-agree-with-licenses\n    $result" | ||||
| 	logger -t xcat "rug update -y --agree-to-third-party-licences\n    $result" | ||||
|         echo "ospkgs: rug update -y --agree-to-third-party-licences\n    $result" | ||||
|     else | ||||
| 	if [ $debug -ne 0 ]; then | ||||
| 	    echo "zypper --non-interactive update --auto-agree-with-licenses" | ||||
| 	    echo "rug update -y --agree-to-third-party-licences" | ||||
| 	    echo $result | ||||
| 	fi | ||||
|     fi | ||||
|  | ||||
|  | ||||
|     #install the new patterns if any | ||||
|     if [ -n "$groups" ]; then | ||||
| 	cmd="rug install -y --agree-to-third-party-licences -t pattern $groups" | ||||
| 	result=`$cmd 2>&1` | ||||
| 	if [ $? -ne 0 ]; then  | ||||
| 	    logger -t xcat "ospkgs: $cmd\n    $result" | ||||
| 	    echo "ospkgs: $cmd" | ||||
| 	    echo $result | ||||
| 	else | ||||
| 	    if [ $debug -ne 0 ]; then | ||||
| 		echo "ospkgs: $cmd" | ||||
| 		echo $result | ||||
| 	    fi | ||||
| 	fi | ||||
|     fi | ||||
|  | ||||
|     #install new rpms if any | ||||
|     result=`zypper install -y $pkgs 2>&1` | ||||
|     if [ $? -ne 0 ]; then  | ||||
| 	logger -t xcat "ospkgs: zypper install -y $pkgs\n    $result" | ||||
| 	echo "ospkgs: zypper install -y $pkgs\n    $result" | ||||
|     else | ||||
| 	if [ $debug -ne 0 ]; then | ||||
| 	    echo "zypper install -y $pkgs" | ||||
|     if [ -n "$pkgs" ]; then | ||||
| 	cmd="rug install -y --agree-to-third-party-licences $pkgs" | ||||
| 	result=`$cmd 2>&1` | ||||
| 	if [ $? -ne 0 ]; then  | ||||
| 	    logger -t xcat "ospkgs: $cmd\n    $result" | ||||
| 	    echo "ospkgs: $cmd" | ||||
| 	    echo $result | ||||
| 	else | ||||
| 	    if [ $debug -ne 0 ]; then | ||||
| 		echo "ospkgs: $cmd" | ||||
| 		echo $result | ||||
| 	    fi | ||||
| 	fi | ||||
| 	echo "ospkgs: OS rpms have been installed or upgraded." | ||||
|     fi | ||||
|  | ||||
|     #remove some packages if specified | ||||
|     if [ -n "$pkgs_d" ]; then | ||||
| 	cmd="rug remove -y $pkgs_d" | ||||
| 	result=`$cmd 2>&1` | ||||
| 	if [ $? -ne 0 ]; then  | ||||
| 	    logger -t xcat "ospkgs: $cmd\n    $result" | ||||
| 	    echo "ospkgs: $cmd" | ||||
| 	    echo $result | ||||
| 	else | ||||
| 	    if [ $debug -ne 0 ]; then | ||||
| 		echo "ospkgs: $cmd" | ||||
| 		echo $result | ||||
| 	    fi | ||||
| 	fi | ||||
|     fi | ||||
| elif [[ $OSVER = sles11* ]]; then | ||||
|     #check if zypper is installed | ||||
|     result=`rpm -q zypper` | ||||
| @@ -183,22 +242,57 @@ elif [[ $OSVER = sles11* ]]; then | ||||
| 	echo "ospkgs: zypper --non-interactive update --auto-agree-with-licenses\n    $result" | ||||
|     else | ||||
| 	if [ $debug -ne 0 ]; then | ||||
| 	    echo "zypper --non-interactive update --auto-agree-with-licenses" | ||||
| 	    echo "ospkgs: zypper --non-interactive update --auto-agree-with-licenses" | ||||
| 	    echo $result | ||||
| 	fi | ||||
|     fi | ||||
|  | ||||
|     #install new rpms if any | ||||
|     result=`zypper install -y $pkgs 2>&1` | ||||
|     if [ $? -ne 0 ]; then  | ||||
| 	logger -t xcat "ospkgs: zypper install -y $pkgs\n    $result" | ||||
| 	echo "ospkgs: zypper install -y $pkgs\n    $result" | ||||
|     else | ||||
| 	if [ $debug -ne 0 ]; then | ||||
| 	    echo "zypper install -y $pkgs " | ||||
|     #install the new patterns if any | ||||
|     if [ -n "$groups" ]; then | ||||
| 	cmd="zypper install -y --auto-agree-with-licenses -t pattern $groups" | ||||
| 	result=`$cmd 2>&1` | ||||
| 	if [ $? -ne 0 ]; then  | ||||
| 	    logger -t xcat "ospkgs: $cmd\n    $result" | ||||
| 	    echo "ospkgs: $cmd" | ||||
| 	    echo $result | ||||
| 	else | ||||
| 	    if [ $debug -ne 0 ]; then | ||||
| 		echo "ospkgs: $cmd" | ||||
| 		echo $result | ||||
| 	    fi | ||||
| 	fi | ||||
|     fi | ||||
|  | ||||
|     #install new rpms if any | ||||
|     if [ -n "$pkgs" ]; then | ||||
| 	cmd="zypper install -y --auto-agree-with-licenses $pkgs" | ||||
| 	result=`$cmd 2>&1` | ||||
| 	if [ $? -ne 0 ]; then  | ||||
| 	    logger -t xcat "ospkgs: $cmd    $result" | ||||
| 	    echo "ospkgs: $cmd" | ||||
| 	    echo $result | ||||
| 	else | ||||
| 	    if [ $debug -ne 0 ]; then | ||||
| 		echo "ospkgs: $cmd" | ||||
| 		echo $result | ||||
| 	    fi | ||||
| 	fi | ||||
|     fi | ||||
|  | ||||
|     #remove some packages if specified | ||||
|     if [ -n "$pkgs_d" ]; then | ||||
| 	cmd="zypper remove -y $pkgs_d" | ||||
| 	result=`$cmd 2>&1` | ||||
| 	if [ $? -ne 0 ]; then  | ||||
| 	    logger -t xcat "ospkgs: $cmd    $result" | ||||
| 	    echo "ospkgs: $cmd" | ||||
| 	    echo $result | ||||
| 	else | ||||
| 	    if [ $debug -ne 0 ]; then | ||||
| 		echo "ospkgs: $cmd" | ||||
| 		echo $result | ||||
| 	    fi | ||||
| 	fi | ||||
| 	echo "ospkgs: OS rpms have been installed or upgraded." | ||||
|     fi | ||||
| else  | ||||
|     #check if yum is installed | ||||
| @@ -245,17 +339,52 @@ else | ||||
| 	fi | ||||
|     fi | ||||
|  | ||||
|     #install new rpms if any | ||||
|     result=`yum -y install $pkgs 2>&1` | ||||
|     if [ $? -ne 0 ]; then  | ||||
| 	logger -t xcat "ospkgs: yum -y install $pkgs\n    $result" | ||||
| 	echo "ospkgs: yum -y install $pkgs\n    $result" | ||||
|     else | ||||
| 	if [ $debug -ne 0 ]; then | ||||
| 	    echo "yum -y install $pkgs" | ||||
|     #install new groups if any | ||||
|     if [ -n "$groups" ]; then | ||||
| 	cmd="yum -y groupinstall $groups" | ||||
| 	result=`$cmd 2>&1` | ||||
| 	if [ $? -ne 0 ]; then  | ||||
| 	    logger -t xcat "ospkgs: $cmd\n    $result" | ||||
| 	    echo "ospkgs: $cmd" | ||||
| 	    echo $result | ||||
| 	else | ||||
| 	    if [ $debug -ne 0 ]; then | ||||
| 		echo "ospkgs: $cmd" | ||||
| 		echo $result | ||||
| 	    fi | ||||
| 	fi | ||||
|     fi | ||||
|  | ||||
|     #install new rpms if any | ||||
|     if [ -n "$pkgs" ]; then | ||||
| 	cmd="yum -y install $pkgs" | ||||
| 	result=`$cmd 2>&1` | ||||
| 	if [ $? -ne 0 ]; then  | ||||
| 	    logger -t xcat "ospkgs: $cmd\n    $result" | ||||
| 	    echo "ospkgs: $cmd" | ||||
| 	    echo $result | ||||
| 	else | ||||
| 	    if [ $debug -ne 0 ]; then | ||||
| 		echo "ospkgs: $cmd" | ||||
| 		echo $result | ||||
| 	    fi | ||||
| 	fi | ||||
|     fi | ||||
|  | ||||
|     #remove some rpms if specified | ||||
|     if [ -n "$pkgs_d" ]; then | ||||
| 	cmd="yum -y remove $pkgs_d" | ||||
| 	result=`$cmd 2>&1` | ||||
| 	if [ $? -ne 0 ]; then  | ||||
| 	    logger -t xcat "ospkgs: $cmd\n    $result" | ||||
| 	    echo "ospkgs: $cmd" | ||||
| 	    echo $result | ||||
| 	else | ||||
| 	    if [ $debug -ne 0 ]; then | ||||
| 		echo "ospkgs: $cmd" | ||||
| 		echo $result | ||||
| 	    fi | ||||
| 	fi | ||||
| 	echo "ospkgs: OS rpms have been installed or upgraded." | ||||
|     fi | ||||
| fi | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user