diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm
index 2f1d4df9d..72752a7a9 100644
--- a/xCAT-server/lib/perl/xCAT/Postage.pm
+++ b/xCAT-server/lib/perl/xCAT/Postage.pm
@@ -12,7 +12,6 @@ use xCAT::Utils;
use xCAT::SvrUtils;
use Data::Dumper;
use File::Basename;
-use Socket;
use strict;
@@ -176,11 +175,19 @@ sub makescript {
}
}
- my $noderesent = $noderestab->getNodeAttribs($node,['nfsserver']);
+ my $noderesent = $noderestab->getNodeAttribs($node,['nfsserver','installnic','primarynic']);
if ($noderesent and defined($noderesent->{'nfsserver'})) {
push @scriptd, "NFSSERVER=".$noderesent->{'nfsserver'}."\n";
push @scriptd, "export NFSSERVER\n";
}
+ if ($noderesent and defined($noderesent->{'installnic'})) {
+ push @scriptd, "INSTALLNIC=".$noderesent->{'installnic'}."\n";
+ push @scriptd, "export INSTALLNIC\n";
+ }
+ if ($noderesent and defined($noderesent->{'primarynic'})) {
+ push @scriptd, "PRIMARYNIC=".$noderesent->{'primarynic'}."\n";
+ push @scriptd, "export PRIMARYNIC\n";
+ }
my $os;
my $profile;
@@ -306,6 +313,9 @@ sub makescript {
chomp($_); #remove newline
s/\s+$//; #remove trailing spaces
next if /^\s*$/; #-- skip empty lines
+ next if ( /^\s*#/ &&
+ !/^\s*#INCLUDE:/ &&
+ !/^\s*#NEW_INSTALL_LIST#/ ); #-- skip comments
push(@otherpkgs,$_);
}
close(FILE1);
@@ -313,7 +323,7 @@ sub makescript {
if ( @otherpkgs > 0) {
my $pkgtext=join(',',@otherpkgs);
- #handle the #INLCUDE# tag recursively
+ #handle the #INCLUDE# tag recursively
my $idir = dirname($pkglist);
my $doneincludes=0;
while (not $doneincludes) {
@@ -323,10 +333,17 @@ sub makescript {
$pkgtext =~ s/#INCLUDE:([^#]+)#/includefile($1,$idir)/eg;
}
}
-
- push @scriptd, "OTHERPKGS=$pkgtext\n";
- push @scriptd, "export OTHERPKGS\n";
-
+ my @sublists = split('#NEW_INSTALL_LIST#',$pkgtext);
+ my $sl_index=0;
+ foreach (@sublists) {
+ $sl_index++;
+ push @scriptd, "OTHERPKGS$sl_index=$_\n";
+ push @scriptd, "export OTHERPKGS$sl_index\n";
+ }
+ if ($sl_index > 0) {
+ push @scriptd, "OTHERPKGS_INDEX=$sl_index\n";
+ push @scriptd, "export OTHERPKGS_INDEX\n";
+ }
}
}
@@ -351,27 +368,6 @@ sub makescript {
push @scriptd, "export NOSYNCFILES\n";
}
- my $setbootfromnet = 0;
- if (($arch eq "ppc64") || ($os =~ /aix.*/i))
- {
- if (($provmethod) && ($provmethod ne "install")) {
- # on Linux, the provmethod can be install,netboot or statelite,
- # on AIX, the provmethod can be null or diskless image name
- (my $ip,my $mask,my $gw) = net_parms($node);
- if (!$ip || !$mask || !$gw)
- {
- xCAT::MsgUtils->message('S',"Unable to determine IP, netmask or gateway for $node, can not set the node to boot from network");
- }
- else
- {
- $setbootfromnet = 1;
- push @scriptd, "NETMASK=$mask\n";
- push @scriptd, "export NETMASK\n";
- push @scriptd, "GATEWAY=$gw\n";
- push @scriptd, "export GATEWAY\n";
- }
- }
- }
###Please do not remove or modify this line of code!!! xcatdsklspost depends on it
push @scriptd, "# postscripts-start-here\n";
@@ -400,10 +396,7 @@ sub makescript {
}
}
- if ($setbootfromnet)
- {
- push @scriptd, "setbootfromnet\n";
- }
+
###Please do not remove or modify this line of code!!! xcatdsklspost depends on it
push @scriptd, "# postscripts-end-here\n";
@@ -488,32 +481,5 @@ sub getnodesetstate {
}
-sub net_parms {
- my $ip = shift;
- if (inet_aton($ip)) {
- $ip = inet_ntoa(inet_aton($ip));
- } else {
- xCAT::MsgUtils->message("S","Unable to resolve $ip");
- return undef;
- }
- my $nettab = xCAT::Table->new('networks');
- unless ($nettab) { return undef };
- my @nets = $nettab->getAllAttribs('net','mask','gateway');
- foreach (@nets) {
- my $net = $_->{'net'};
- my $mask =$_->{'mask'};
- my $gw = $_->{'gateway'};
- $ip =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/;
- my $ipnum = ($1<<24)+($2<<16)+($3<<8)+$4;
- $mask =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/;
- my $masknum = ($1<<24)+($2<<16)+($3<<8)+$4;
- $net =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/;
- my $netnum = ($1<<24)+($2<<16)+($3<<8)+$4;
- if (($ipnum & $masknum)==$netnum) {
- return ($ip,$mask,$gw);
- }
- }
- xCAT::MsgUtils->message("S","xCAT BMC configuration error, no appropriate network for $ip found in networks, unable to determine netmask");
-}
1;
diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm
index 06fa0e976..8262beb55 100644
--- a/xCAT-server/lib/perl/xCAT/Template.pm
+++ b/xCAT-server/lib/perl/xCAT/Template.pm
@@ -68,9 +68,13 @@ sub subvars {
my $doneincludes=0;
while (not $doneincludes) {
$doneincludes=1;
+ if ($inc =~ /#INCLUDE_PKGLIST:[^#]+#/) {
+ $doneincludes=0;
+ $inc =~ s/#INCLUDE_PKGLIST:([^#]+)#/includefile($1, 0, 1)/eg;
+ }
if ($inc =~ /#INCLUDE:[^#]+#/) {
$doneincludes=0;
- $inc =~ s/#INCLUDE:([^#]+)#/includefile($1, 0)/eg;
+ $inc =~ s/#INCLUDE:([^#]+)#/includefile($1, 0, 0)/eg;
}
}
#ok, now do everything else..
@@ -81,8 +85,9 @@ sub subvars {
$inc =~ s/#TABLEBLANKOKAY:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3,'1')/eg;
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
- $inc =~ s/#INCLUDE_NOP:([^#]+)#/includefile($1,1)/eg;
- $inc =~ s/#INCLUDE:([^#]+)#/includefile($1, 0)/eg;
+ $inc =~ s/#INCLUDE_NOP:([^#]+)#/includefile($1,1,0)/eg;
+ $inc =~ s/#INCLUDE_PKGLIST:([^#]+)#/includefile($1,0,1)/eg;
+ $inc =~ s/#INCLUDE:([^#]+)#/includefile($1, 0, 0)/eg;
if ($tmplerr) {
@@ -169,6 +174,7 @@ sub includefile
{
my $file = shift;
my $special=shift;
+ my $pkglist=shift;
my $text = "";
unless ($file =~ /^\//) {
$file = $idir."/".$file;
@@ -176,8 +182,23 @@ sub includefile
open(INCLUDE,$file) || return "#INCLUDEBAD:cannot open $file#";
+ my $pkgb = "";
+ my $pkge = "";
+ if ($pkglist) {
+ $pkgb = "";
+ $pkge = "";
+ }
while() {
- $text .= "$_";
+ if ($pkglist) {
+ s/#INCLUDE:/#INCLUDE_PKGLIST:/;
+ }
+ if (( $_ =~ /^\s*#/ ) || ( $_ =~ /^\s*$/ )) {
+ $text .= "$_";
+ } else {
+ chomp;
+ s/\s*$//;
+ $text .= "$pkgb$_$pkge\n";
+ }
}
close(INCLUDE);
diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs
index 7d18255d5..c1018bd03 100755
--- a/xCAT/postscripts/otherpkgs
+++ b/xCAT/postscripts/otherpkgs
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#-------------------------------------------------------------------------------
@@ -22,20 +22,18 @@
#=cut
#-------------------------------------------------------------------------------
+
# do nothing for diskless deployment case because it is done in the image already
if [[ $UPDATENODE -ne 1 ]]; then
if [ "$NODESETSTATE" = "netboot" -o \
- "$NODESETSTATE" = "statelite" -o \
"$NODESETSTATE" = "diskless" -o \
"$NODESETSTATE" = "dataless" ]
then
- echo " Did not install any extra rpms."
exit 0
fi
fi
-#echo "OTHERPKGS=$OTHERPKGS"
-if [[ -z "$OTHERPKGS" ]]; then
+if [[ -z "$OTHERPKGS_INDEX" ]]; then
echo "$0: no extra rpms to install"
exit 0
fi
@@ -69,20 +67,39 @@ logger -t xcat "NFSSERVER=$NFSSERVER"
echo OTHERPKGDIR=$OTHERPKGDIR
logger -t xcat "OTHERPKGDIR=$OTHERPKGDIR"
+dhcpcd -n $PRIMARYNIC
+
+
#check if the node has yum or zypper installed, it will try yum first, then zypper and last rpm
hasyum=0
-haszypper=0;
+haszypper=0
result=`rpm -q yum`
if [ $? -eq 0 ]; then
hasyum=1
- mkdir -p /etc/yum.repos.d
- result=`rm /etc/yum.repos.d/xCAT-otherpkgs*.repo 2>&1`
- result=`yum clean all`
- repo_base="/etc/yum.repos.d"
else
result=`rpm -q zypper`
if [ "$?" = "0" ]; then
haszypper=1
+ fi
+fi
+
+
+# To support the #NEW_INSTALL_LIST# entry in otherpkgs.pkglist files,
+# multiple lists of packages are provided to this script in the form:
+# OTHERPKGS1, OTHERPKGS2, ... OTHERPKSn where n=OTHERPKGS_INDEX
+# Each sublist will be installed in a separate call (separate pass
+# through this loop)
+op_index=1
+#echo "OTHERPKGS_INDEX = $OTHERPKGS_INDEX"
+while [ $op_index -le $OTHERPKGS_INDEX ]; do
+ eval pkglist=\$OTHERPKGS$op_index
+ #echo "pkglist = $pkglist"
+ if [ $hasyum -eq 1 ]; then
+ mkdir -p /etc/yum.repos.d
+ result=`rm /etc/yum.repos.d/xCAT-otherpkgs*.repo 2>&1`
+ result=`yum clean all`
+ repo_base="/etc/yum.repos.d"
+ elif [ $haszypper -eq 1 ]; then
#remove old repo
old_repo=`zypper sl |grep xcat-otherpkgs | cut -f2 -d '|'`
for x in $old_repo
@@ -92,260 +109,259 @@ else
zypper --non-interactive refresh
repo_base="/tmp"
fi
-fi
-dhcpcd -n eth0
-
-
-repo_path=()
-repo_pkgs=""
-repo_pkgs_preremove=""
-repo_pkgs_postremove=""
-plain_pkgs=""
-plain_pkgs_preremove=""
-plain_pkgs_postremove=""
-handled_path=()
-for x in `echo "$OTHERPKGS" | tr "," "\n"`
-do
- #check if the file name starts with -- or -.
- #If it is start with -, then the rpm must be removed before installing other packages
- #If it is start with --, then the rpm will be removed after installing other packages
- string_type=0; #nornmal rpm
- pos=`expr index $x -`
- if [ $pos -eq 1 ]; then
- x=`echo ${x#-}`
- pos=`expr index $x -`
- if [ $pos -eq 1 ]; then
+ repo_path=()
+ repo_pkgs=""
+ repo_pkgs_preremove=""
+ repo_pkgs_postremove=""
+ plain_pkgs=""
+ plain_pkgs_preremove=""
+ plain_pkgs_postremove=""
+ handled_path=()
+ for x in `echo "$pkglist" | tr "," "\n"`
+ do
+ #check if the file name starts with -- or -.
+ #If it is start with -, then the rpm must be removed before installing other packages
+ #If it is start with --, then the rpm will be removed after installing other packages
+ string_type=0; #nornmal rpm
+ pos=`expr index $x -`
+ if [ $pos -eq 1 ]; then
x=`echo ${x#-}`
- string_type=1 #start with --
- else
- string_type=-1 #start with -
- fi
- fi
-
- if [ $hasyum -eq 0 ] && [ $haszypper -eq 0 ]; then
- if [ $string_type -eq -1 ]; then
- plain_pkgs_preremove="$plain_pkgs_preremove $x"
- elif [ $string_type -eq 1 ]; then
- plain_pkgs_postremove="$plain_pkgs_postremove $x"
- else
- plain_pkgs="$plain_pkgs $x-*"
- fi
- continue
- fi
-
- if [ $string_type -eq -1 ]; then
- repo_pkgs_preremove="$repo_pkgs_preremove $x"
- elif [ $string_type -eq 1 ]; then
- repo_pkgs_postremove="$repo_pkgs_postremove $x"
- else
- fn=`basename $x`
- path=`dirname $x`
- whole_path=$OTHERPKGDIR/$path
-
- #find out if this path has already handled
- try_repo=1
- rc=1
- i=0
- while [ $i -lt ${#handled_path[*]} ]; do
- if [ ${handled_path[$i]} = $path ]; then
- try_repo=0
- j=0
- while [ $j -lt ${#repo_path[*]} ]; do
- if [ ${repo_path[$j]} = $path ]; then
- rc=0
- break
- fi
- let j++
- done
- break
- fi
- let i++
- done
-
-
- #try to add the path to the repo
- if [ $try_repo -eq 1 ]; then
- index=${#repo_path[*]}
- REPOFILE="$repo_base/xCAT-otherpkgs$index.repo"
- echo "[xcat-otherpkgs$index]" > $REPOFILE
- echo "name=xcat-otherpkgs$index" >> $REPOFILE
- if [ $mounted -eq 0 ]; then
- echo "baseurl=ftp://$whole_path" >> $REPOFILE
+ pos=`expr index $x -`
+ if [ $pos -eq 1 ]; then
+ x=`echo ${x#-}`
+ string_type=1 #start with --
else
- echo "baseurl=file://$whole_path" >> $REPOFILE
+ string_type=-1 #start with -
fi
- echo "enabled=1" >> $REPOFILE
- echo "gpgcheck=0" >> $REPOFILE
+ fi
- if [ $hasyum -eq 1 ]; then
- #use yum
- result=`yum list $fn 2>&1`
- if [ $? -eq 0 ]; then
- rc=0
- repo_path[${#repo_path[*]}]=$path
- else
- rm $REPOFILE
- fi
- elif [ $haszypper -eq 1 ]; then
- #use zypper
- if [[ "$OSVER" = sles11* ]]; then
- result=`zypper ar -c $REPOFILE`
- else
- result=`zypper sa -c $REPOFILE`
- fi
-
- result=`zypper --non-interactive refresh xcat-otherpkgs$index 2>&1`
- if [ $? -eq 0 ]; then
- rc=0
- repo_path[${#repo_path[*]}]=$path
- else
- result=`zypper sd xcat-otherpkgs$index`
- fi
+ if [ $hasyum -eq 0 ] && [ $haszypper -eq 0 ]; then
+ if [ $string_type -eq -1 ]; then
+ plain_pkgs_preremove="$plain_pkgs_preremove $x"
+ elif [ $string_type -eq 1 ]; then
+ plain_pkgs_postremove="$plain_pkgs_postremove $x"
+ else
+ plain_pkgs="$plain_pkgs $x-*"
fi
- fi
+ continue
+ fi
+
+ if [ $string_type -eq -1 ]; then
+ repo_pkgs_preremove="$repo_pkgs_preremove $x"
+ elif [ $string_type -eq 1 ]; then
+ repo_pkgs_postremove="$repo_pkgs_postremove $x"
+ else
+ fn=`basename $x`
+ path=`dirname $x`
+ whole_path=$OTHERPKGDIR/$path
- if [ $rc -eq 0 ]; then
- repo_pkgs="$repo_pkgs $fn"
- else
- #now no hope we have to use rpm command
- plain_pkgs="$plain_pkgs $x-*"
- fi
- handled_path[${#handled_path[*]}]=$path
- fi
-done
+ #find out if this path has already handled
+ try_repo=1
+ rc=1
+ i=0
+ while [ $i -lt ${#handled_path[*]} ]; do
+ if [ ${handled_path[$i]} = $path ]; then
+ try_repo=0
+ j=0
+ while [ $j -lt ${#repo_path[*]} ]; do
+ if [ ${repo_path[$j]} = $path ]; then
+ rc=0
+ break
+ fi
+ let j++
+ done
+ break
+ fi
+ let i++
+ done
+
+
+ #try to add the path to the repo
+ if [ $try_repo -eq 1 ]; then
+ index=${#repo_path[*]}
+ REPOFILE="$repo_base/xCAT-otherpkgs$index.repo"
+ echo "[xcat-otherpkgs$index]" > $REPOFILE
+ echo "name=xcat-otherpkgs$index" >> $REPOFILE
+ if [ $mounted -eq 0 ]; then
+ echo "baseurl=ftp://$whole_path" >> $REPOFILE
+ else
+ echo "baseurl=file://$whole_path" >> $REPOFILE
+ fi
+ echo "enabled=1" >> $REPOFILE
+ echo "gpgcheck=0" >> $REPOFILE
+
+ if [ $hasyum -eq 1 ]; then
+ #use yum
+ result=`yum list $fn 2>&1`
+ if [ $? -eq 0 ]; then
+ rc=0
+ repo_path[${#repo_path[*]}]=$path
+ else
+ rm $REPOFILE
+ fi
+ elif [ $haszypper -eq 1 ]; then
+ #use zypper
+ if [[ "$OSVER" = sles11* ]]; then
+ result=`zypper ar -c $REPOFILE`
+ else
+ result=`zypper sa -c $REPOFILE`
+ fi
+
+ result=`zypper --non-interactive refresh xcat-otherpkgs$index 2>&1`
+ if [ $? -eq 0 ]; then
+ rc=0
+ repo_path[${#repo_path[*]}]=$path
+ else
+ result=`zypper sd xcat-otherpkgs$index`
+ fi
+ fi
+ fi
+
+ if [ $rc -eq 0 ]; then
+ repo_pkgs="$repo_pkgs $fn"
+ else
+ #now no hope we have to use rpm command
+ plain_pkgs="$plain_pkgs $x-*"
+ fi
+ handled_path[${#handled_path[*]}]=$path
+ fi
+ done
-#echo "repo_pkgs=$repo_pkgs,\nrepo_pkgs_preremove=$repo_pkgs_preremove,\nrepo_pkgs_postremove=$repo_pkgs_postremove"
-#echo "plain_pkgs=$plain_pkgs,\nplain_pkgs_preremove=$plain_pkgs_preremove,\nplain_pkgs_postremove=$plain_pkgs_postremove"
+ #echo "repo_pkgs=$repo_pkgs,\nrepo_pkgs_preremove=$repo_pkgs_preremove,\nrepo_pkgs_postremove=$repo_pkgs_postremove"
+ #echo "plain_pkgs=$plain_pkgs,\nplain_pkgs_preremove=$plain_pkgs_preremove,\nplain_pkgs_postremove=$plain_pkgs_postremove"
-#Now we have parse the input, let's remove rpms if is specified with -
-if [ "$repo_pkgs_preremove" != "" ]; then
- if [ $hasyum -eq 1 ]; then
- echo "yum -y remove $repo_pkgs_preremove"
- result=`yum -y remove $repo_pkgs_preremove 2>&1`
+ #Now we have parsed the input, let's remove rpms if is specified with -
+ if [ "$repo_pkgs_preremove" != "" ]; then
+ if [ $hasyum -eq 1 ]; then
+ echo "yum -y remove $repo_pkgs_preremove"
+ result=`yum -y remove $repo_pkgs_preremove 2>&1`
+ logger -t xcat "$result"
+ if [ $? -ne 0 ]; then
+ logger -t xcat "otherpkgs: $result"
+ fi
+ echo "$result"
+ elif [ $haszypper -eq 1 ]; then
+ echo "zypper remove -y $repo_pkgs_preremove"
+ result=`zypper remove -y $repo_pkgs_preremove 2>&1`
+ logger -t xcat "$result"
+ if [ $? -ne 0 ]; then
+ logger -t xcat "otherpkgs: $result"
+ fi
+ echo "$result"
+ fi
+ fi
+
+ if [ "$plain_pkgs_preremove" != "" ]; then
+ echo "rpm -ev $plain_pkgs_preremove"
+ result=`rpm -ev $plain_pkgs_preremove 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
- logger -t xcat "otherpkgs: $result"
+ logger -t xcat "otherpkgs $result"
fi
echo "$result"
- elif [ $haszypper -eq 1 ]; then
- echo "zypper remove -y $repo_pkgs_preremove"
- result=`zypper remove -y $repo_pkgs_preremove 2>&1`
- logger -t xcat "$result"
- if [ $? -ne 0 ]; then
- logger -t xcat "otherpkgs: $result"
- fi
- echo "$result"
fi
-fi
-
-if [ "$plain_pkgs_preremove" != "" ]; then
- echo "rpm -ev $plain_pkgs_preremove"
- result=`rpm -ev $plain_pkgs_preremove 2>&1`
- logger -t xcat "$result"
- if [ $? -ne 0 ]; then
- logger -t xcat "otherpkgs $result"
- fi
- echo "$result"
-fi
-#installation using yum or zypper
-if [ "$repo_pkgs" != "" ]; then
- if [ $hasyum -eq 1 ]; then
- echo "yum -y install $repo_pkgs"
- result=`yum -y install $repo_pkgs 2>&1`
- logger -t xcat "$result"
- if [ $? -ne 0 ]; then
- logger -t xcat "otherpkgs: $result"
+ #installation using yum or zypper
+ if [ "$repo_pkgs" != "" ]; then
+ if [ $hasyum -eq 1 ]; then
+ echo "yum -y install $repo_pkgs"
+ result=`yum -y install $repo_pkgs 2>&1`
+ logger -t xcat "$result"
+ if [ $? -ne 0 ]; then
+ logger -t xcat "otherpkgs: $result"
+ fi
+ echo "$result"
+ elif [ $haszypper -eq 1 ]; then
+ echo "zypper install -y $repo_pkgs"
+ result=`zypper install -y $repo_pkgs 2>&1`
+ logger -t xcat "$result"
+ if [ $? -ne 0 ]; then
+ logger -t xcat "otherpkgs: $result"
+ fi
+ echo "$result"
+ #remove the repos
+ #old_repo=`zypper lr -u |grep xcat-otherpkgs | cut -f2 -d '|'`
+ #for x in $old_repo
+ #do
+ # result=`zypper sd $x`
+ #done
fi
- echo "$result"
- elif [ $haszypper -eq 1 ]; then
- echo "zypper install -y $repo_pkgs"
- result=`zypper install -y $repo_pkgs 2>&1`
- logger -t xcat "$result"
- if [ $? -ne 0 ]; then
- logger -t xcat "otherpkgs: $result"
- fi
- echo "$result"
- #remove the repos
- #old_repo=`zypper lr -u |grep xcat-otherpkgs | cut -f2 -d '|'`
- #for x in $old_repo
- #do
- # result=`zypper sd $x`
- #done
- fi
-fi
+ fi
-#Handle the rest with rpm
-if [ "$plain_pkgs" != "" ]; then
- if [ $mounted -eq 0 ]; then
- dir_no_ftproot=${OTHERPKGDIR#$INSTALLDIR/}
- mkdir -p /xcatpost/$dir_no_ftproot
- rm -f -R /xcatpost/$dir_no_ftproot/*
- mkdir -p /tmp/postage/
- rm -f -R /tmp/postage/*
- cd /tmp/postage
+ #Handle the rest with rpm
+ if [ "$plain_pkgs" != "" ]; then
+ if [ $mounted -eq 0 ]; then
+ dir_no_ftproot=${OTHERPKGDIR#$INSTALLDIR/}
+ mkdir -p /xcatpost/$dir_no_ftproot
+ rm -f -R /xcatpost/$dir_no_ftproot/*
+ mkdir -p /tmp/postage/
+ rm -f -R /tmp/postage/*
+ cd /tmp/postage
- for x in `echo "$plain_pkgs" | tr " " "\n"`
- do
- wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$OTHERPKGDIR/$x 2> /tmp/wget.log
- done
+ for x in `echo "$plain_pkgs" | tr " " "\n"`
+ do
+ wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$OTHERPKGDIR/$x 2> /tmp/wget.log
+ done
- mv $dir_no_ftproot/* /xcatpost/$dir_no_ftproot;
- rm -rf $NFSSERVER
- cd /xcatpost/$dir_no_ftproot
- else
- cd $OTHERPKGDIR
- fi
+ mv $dir_no_ftproot/* /xcatpost/$dir_no_ftproot;
+ rm -rf $NFSSERVER
+ cd /xcatpost/$dir_no_ftproot
+ else
+ cd $OTHERPKGDIR
+ fi
- echo "rpm -Uvh --replacepkgs $plain_pkgs"
- result=`rpm -Uvh --replacepkgs $plain_pkgs 2>&1`
- #result=`rpm -Fvh $plain_pkgs 2>&1`
- logger -t xcat "$result"
- if [ $? -ne 0 ]; then
- logger -t xcat "otherpkgs $result"
- fi
- echo "$result"
-
- if [ $mounted -eq 0 ]; then
- cd /xcatpost
- dir_no_ftproot=${OTHERPKGDIR#$INSTALLDIR/}
- rm -f -R $dir_no_ftproot
- fi
-fi
-
-#remove more rpms if specified with --
-if [ "$repo_pkgs_postremove" != "" ]; then
- if [ $hasyum -eq 1 ]; then
- echo "yum -y removel $repo_pkgs_postremove"
- result=`yum -y remove $repo_pkgs_postremove 2>&1`
+ echo "rpm -Uvh --replacepkgs $plain_pkgs"
+ result=`rpm -Uvh --replacepkgs $plain_pkgs 2>&1`
+ #result=`rpm -Fvh $plain_pkgs 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
- logger -t xcat "otherpkgs: $result"
+ logger -t xcat "otherpkgs $result"
fi
echo "$result"
- elif [ $haszypper -eq 1 ]; then
- echo "zypper remove -y $repo_pkgs_postremove"
- result=`zypper remove -y $repo_pkgs_postremove 2>&1`
+
+ if [ $mounted -eq 0 ]; then
+ cd /xcatpost
+ dir_no_ftproot=${OTHERPKGDIR#$INSTALLDIR/}
+ rm -f -R $dir_no_ftproot
+ fi
+ fi
+
+ #remove more rpms if specified with --
+ if [ "$repo_pkgs_postremove" != "" ]; then
+ if [ $hasyum -eq 1 ]; then
+ echo "yum -y removel $repo_pkgs_postremove"
+ result=`yum -y remove $repo_pkgs_postremove 2>&1`
+ logger -t xcat "$result"
+ if [ $? -ne 0 ]; then
+ logger -t xcat "otherpkgs: $result"
+ fi
+ echo "$result"
+ elif [ $haszypper -eq 1 ]; then
+ echo "zypper remove -y $repo_pkgs_postremove"
+ result=`zypper remove -y $repo_pkgs_postremove 2>&1`
+ logger -t xcat "$result"
+ if [ $? -ne 0 ]; then
+ logger -t xcat "otherpkgs: $result"
+ fi
+ echo "$result"
+ fi
+ fi
+
+ if [ "$plain_pkgs_postremove" != "" ]; then
+ echo "rpm -ev $plain_pkgs_postremove"
+ result=`rpm -ev $plain_pkgs_postremove 2>&1`
logger -t xcat "$result"
- if [ $? -ne 0 ]; then
- logger -t xcat "otherpkgs: $result"
- fi
+ if [ $? -ne 0 ]; then
+ logger -t xcat "otherpkgs $result"
+ fi
echo "$result"
fi
-fi
-if [ "$plain_pkgs_postremove" != "" ]; then
- echo "rpm -ev $plain_pkgs_postremove"
- result=`rpm -ev $plain_pkgs_postremove 2>&1`
- logger -t xcat "$result"
- if [ $? -ne 0 ]; then
- logger -t xcat "otherpkgs $result"
- fi
- echo "$result"
-fi
+ let op_index=$op_index+1
+done
exit 0