From 25507960cdf31469e8f6e2ba631d07513926a5d5 Mon Sep 17 00:00:00 2001 From: linggao Date: Fri, 30 Jul 2010 20:20:51 +0000 Subject: [PATCH] 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 --- xCAT-server/lib/perl/xCAT/Postage.pm | 4 + xCAT-server/lib/perl/xCAT/Template.pm | 35 ++- xCAT-server/lib/xcat/plugins/sles.pm | 16 +- .../share/xcat/install/sles/compute.pkglist | 2 + .../install/sles/compute.sles10.ppc64.pkglist | 3 + .../install/sles/compute.sles10.ppc64.tmpl | 4 +- .../install/sles/compute.sles10.s390x.pkglist | 3 + .../install/sles/compute.sles10.s390x.tmpl | 4 +- .../xcat/install/sles/compute.sles11.pkglist | 2 + .../install/sles/compute.sles11.s390x.pkglist | 3 + .../install/sles/compute.sles11.s390x.tmpl | 4 +- .../xcat/install/sles/compute.sles11.tmpl | 3 +- .../share/xcat/install/sles/compute.tmpl | 3 +- .../share/xcat/install/sles/iscsi.pkglist | 2 + .../share/xcat/install/sles/iscsi.tmpl | 3 +- .../install/sles/iscsiibft.sles11.pkglist | 2 + .../xcat/install/sles/iscsiibft.sles11.tmpl | 3 +- .../xcat/install/sles/service.sles11.pkglist | 2 + .../xcat/install/sles/service.sles11.tmpl | 3 +- .../share/xcat/install/sles/xen.pkglist | 5 + xCAT-server/share/xcat/install/sles/xen.tmpl | 6 +- .../share/xcat/install/suse/compute.pkglist | 2 + .../share/xcat/install/suse/compute.tmpl | 3 +- xCAT/postscripts/ospkgs | 223 ++++++++++++++---- 24 files changed, 254 insertions(+), 86 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 51ef04b2f..cfc7859b8 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -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); diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 8bb16ddd7..4c4ec612f 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -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 = ""; - $pkge = ""; - } + if ($pkglist == 2) { + $pkgb = ""; + $pkge = ""; + } else { + $pkgb = ""; + $pkge = ""; + } + } while() { - 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"; } } diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 8f83781d3..58fc64786 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -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) { diff --git a/xCAT-server/share/xcat/install/sles/compute.pkglist b/xCAT-server/share/xcat/install/sles/compute.pkglist index 6b81b3634..f8e11a7ba 100644 --- a/xCAT-server/share/xcat/install/sles/compute.pkglist +++ b/xCAT-server/share/xcat/install/sles/compute.pkglist @@ -1,3 +1,5 @@ +@base +@x11 openssl xntp rsync diff --git a/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.pkglist b/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.pkglist index 6b81b3634..c6fe5183f 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.pkglist +++ b/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.pkglist @@ -1,3 +1,6 @@ +@base-64bit +@base +@x11 openssl xntp rsync diff --git a/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.tmpl b/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.tmpl index d586a3455..942a0dea7 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.tmpl @@ -38,9 +38,7 @@ - base-64bit - base - x11 + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.pkglist b/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.pkglist index 0519ecba6..021fa3147 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.pkglist +++ b/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.pkglist @@ -1 +1,4 @@ +@base +@x11 +@gnome \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.tmpl b/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.tmpl index 480bc0677..ff6aff8f2 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.tmpl @@ -539,9 +539,7 @@ - base - x11 - gnome + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT-server/share/xcat/install/sles/compute.sles11.pkglist b/xCAT-server/share/xcat/install/sles/compute.sles11.pkglist index 6d4574072..ecfc5adc8 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles11.pkglist +++ b/xCAT-server/share/xcat/install/sles/compute.sles11.pkglist @@ -1,2 +1,4 @@ +@base +@x11 xntp rsync diff --git a/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.pkglist b/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.pkglist index 0519ecba6..021fa3147 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.pkglist +++ b/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.pkglist @@ -1 +1,4 @@ +@base +@x11 +@gnome \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.tmpl b/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.tmpl index 1b0ba571e..920bb36a2 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.tmpl @@ -539,9 +539,7 @@ - base - x11 - gnome + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT-server/share/xcat/install/sles/compute.sles11.tmpl b/xCAT-server/share/xcat/install/sles/compute.sles11.tmpl index 58fb816c8..61fe8d406 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles11.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.sles11.tmpl @@ -38,8 +38,7 @@ - base - x11 + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT-server/share/xcat/install/sles/compute.tmpl b/xCAT-server/share/xcat/install/sles/compute.tmpl index 297e44c2c..7b69efa8f 100644 --- a/xCAT-server/share/xcat/install/sles/compute.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.tmpl @@ -38,8 +38,7 @@ - base - x11 + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT-server/share/xcat/install/sles/iscsi.pkglist b/xCAT-server/share/xcat/install/sles/iscsi.pkglist index ba2d0e134..f4df03e04 100644 --- a/xCAT-server/share/xcat/install/sles/iscsi.pkglist +++ b/xCAT-server/share/xcat/install/sles/iscsi.pkglist @@ -1,3 +1,5 @@ +@base +@x11 xntp rsync open-iscsi diff --git a/xCAT-server/share/xcat/install/sles/iscsi.tmpl b/xCAT-server/share/xcat/install/sles/iscsi.tmpl index e7e84a8d9..a7adfab77 100644 --- a/xCAT-server/share/xcat/install/sles/iscsi.tmpl +++ b/xCAT-server/share/xcat/install/sles/iscsi.tmpl @@ -50,8 +50,7 @@ - base - x11 + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.pkglist b/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.pkglist index ba2d0e134..f4df03e04 100644 --- a/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.pkglist +++ b/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.pkglist @@ -1,3 +1,5 @@ +@base +@x11 xntp rsync open-iscsi diff --git a/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.tmpl b/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.tmpl index 1acda3fd6..a16b3813d 100644 --- a/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.tmpl +++ b/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.tmpl @@ -49,8 +49,7 @@ - base - x11 + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT-server/share/xcat/install/sles/service.sles11.pkglist b/xCAT-server/share/xcat/install/sles/service.sles11.pkglist index 7c87e04b8..bfcef697c 100644 --- a/xCAT-server/share/xcat/install/sles/service.sles11.pkglist +++ b/xCAT-server/share/xcat/install/sles/service.sles11.pkglist @@ -1,3 +1,5 @@ +@base +@x11 xntp rsync nmap diff --git a/xCAT-server/share/xcat/install/sles/service.sles11.tmpl b/xCAT-server/share/xcat/install/sles/service.sles11.tmpl index 58fb816c8..61fe8d406 100644 --- a/xCAT-server/share/xcat/install/sles/service.sles11.tmpl +++ b/xCAT-server/share/xcat/install/sles/service.sles11.tmpl @@ -38,8 +38,7 @@ - base - x11 + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT-server/share/xcat/install/sles/xen.pkglist b/xCAT-server/share/xcat/install/sles/xen.pkglist index f5ea5c985..969cf9912 100644 --- a/xCAT-server/share/xcat/install/sles/xen.pkglist +++ b/xCAT-server/share/xcat/install/sles/xen.pkglist @@ -1,3 +1,8 @@ +@base +@x11 +@xen_server +@xen_server-32bit +@32bit xntp rsync xen diff --git a/xCAT-server/share/xcat/install/sles/xen.tmpl b/xCAT-server/share/xcat/install/sles/xen.tmpl index 4f6b32179..44588d051 100644 --- a/xCAT-server/share/xcat/install/sles/xen.tmpl +++ b/xCAT-server/share/xcat/install/sles/xen.tmpl @@ -82,11 +82,7 @@ - base - x11 - xen_server - xen_server-32bit - 32bit + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT-server/share/xcat/install/suse/compute.pkglist b/xCAT-server/share/xcat/install/suse/compute.pkglist index 6d4574072..ecfc5adc8 100644 --- a/xCAT-server/share/xcat/install/suse/compute.pkglist +++ b/xCAT-server/share/xcat/install/suse/compute.pkglist @@ -1,2 +1,4 @@ +@base +@x11 xntp rsync diff --git a/xCAT-server/share/xcat/install/suse/compute.tmpl b/xCAT-server/share/xcat/install/suse/compute.tmpl index 58fb816c8..61fe8d406 100644 --- a/xCAT-server/share/xcat/install/suse/compute.tmpl +++ b/xCAT-server/share/xcat/install/suse/compute.tmpl @@ -38,8 +38,7 @@ - base - x11 + #INCLUDE_DEFAULT_PTRNLIST# #INCLUDE_DEFAULT_PKGLIST# diff --git a/xCAT/postscripts/ospkgs b/xCAT/postscripts/ospkgs index 50fce16db..185df91f0 100755 --- a/xCAT/postscripts/ospkgs +++ b/xCAT/postscripts/ospkgs @@ -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