From 8c143d78a611f556b5297e3354d97c7d89c5b5aa Mon Sep 17 00:00:00 2001 From: linggao Date: Thu, 11 Sep 2008 22:03:01 +0000 Subject: [PATCH] allow user to add customization of pkg lists under /install/custom dir. more work on installing extra packages in xCAT git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2147 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Postage.pm | 35 ++++---- xCAT-server/sbin/xcatconfig | 2 +- xCAT-server/share/xcat/netboot/rh/genimage | 82 ++++++++++++------ xCAT-server/share/xcat/netboot/sles/genimage | 84 +++++++++++++------ .../share/xcat/netboot/sles/genimage.yum | 80 +++++++++++++----- xCAT/postscripts/otherpkgs | 9 +- xCAT/postscripts/xcataixpost | 2 +- xCAT/xCAT.spec | 2 +- 8 files changed, 205 insertions(+), 91 deletions(-) diff --git a/perl-xCAT/xCAT/Postage.pm b/perl-xCAT/xCAT/Postage.pm index 51ff3d068..470c13ba1 100644 --- a/perl-xCAT/xCAT/Postage.pm +++ b/perl-xCAT/xCAT/Postage.pm @@ -223,17 +223,8 @@ sub makescript { elsif ($os =~ /aix.*/) { $platform = "aix"; } } if (($nodesetstate) && ($nodesetstate eq "netboot")) { $stat="netboot";} - my $pathtofiles="$::XCATROOT/share/xcat/$stat/$platform"; - my $pkglist; - if (-r "$pathtofiles/$profile.$os.$arch.otherpkgs.pkglist") { - $pkglist = "$pathtofiles/$profile.$os.$arch.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.$arch.otherpkgs.pkglist") { - $pkglist = "$pathtofiles/$profile.$arch.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.$os.otherpkgs.pkglist") { - $pkglist = "$pathtofiles/$profile.$os.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.otherpkgs.pkglist") { - $pkglist = "$pathtofiles/$profile.otherpkgs.pkglist"; - } + my $pkglist=get_otherpkg_file_name("/install/custom/$stat/$platform", $profile, $os, $arch); + if (!$pkglist) { $pkglist=get_otherpkg_file_name("$::XCATROOT/share/xcat/$stat/$platform", $profile, $os, $arch); } if ($pkglist) { my @otherpkgs=(); @@ -265,8 +256,6 @@ sub makescript { my $defscripts = $et->{'postscripts'}; if ($defscripts) { foreach my $n (split(/,/, $defscripts)) { - #skip 'otherpkgs' for diskless case because it is handled by genimage - if (($n eq "otherpkgs") && ($stat eq "netboot")) { next; } push @scriptd, $n."\n"; } } @@ -276,8 +265,6 @@ sub makescript { $ps = $et->{'postscripts'}; if ($ps) { foreach my $n (split(/,/, $ps)) { - #skip 'otherpkgs' for diskless case because it is handled by genimage - if (($n eq "otherpkgs") && ($stat eq "netboot")) { next; } push @scriptd, $n."\n"; } } @@ -339,4 +326,22 @@ sub getnodesetstate { return $state; } +sub get_otherpkg_file_name { + my $pathtofiles=shift; + my $profile=shift; + my $os=shift; + my $arch=shift; + if (-r "$pathtofiles/$profile.$os.$arch.otherpkgs.pkglist") { + return "$pathtofiles/$profile.$os.$arch.otherpkgs.pkglist"; + } elsif (-r "$pathtofiles/$profile.$arch.otherpkgs.pkglist") { + return "$pathtofiles/$profile.$arch.otherpkgs.pkglist"; + } elsif (-r "$pathtofiles/$profile.$os.otherpkgs.pkglist") { + return "$pathtofiles/$profile.$os.otherpkgs.pkglist"; + } elsif (-r "$pathtofiles/$profile.otherpkgs.pkglist") { + return "$pathtofiles/$profile.otherpkgs.pkglist"; + } + + return ""; +} + 1; diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 9ed1ec2e2..bba5acd07 100644 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -661,7 +661,7 @@ if ((!-r "/etc/xcat/postscripts.sqlite") || $::FORCE) else { $chtabcmds = - "$::XCATROOT/sbin/chtab node=xcatdefaults postscripts.postscripts='syslog,remoteshell,otherpkgs';"; + "$::XCATROOT/sbin/chtab node=xcatdefaults postscripts.postscripts='syslog,remoteshell';"; } $chtabcmds .= diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index d09620a17..30ad3e7d3 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -4,6 +4,7 @@ use File::Path; use File::Copy; use File::Find; use Getopt::Long; +use Cwd qw(realpath); #use strict; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -22,6 +23,7 @@ my @filestoadd; my $profile; my $osver; my $pathtofiles=dirname($0); +my $fullpath=realpath($pathtofiles); my $name = basename($0); my $onlyinitrd=0; if ($name =~ /geninitrd/) { @@ -32,6 +34,8 @@ my $tmplimit; my $installroot = "/install"; my $kernelver = ""; #`uname -r`; my $basekernelver; # = $kernelver; +my $customdir=$fullpath; +$customdir =~ s/.*share\/xcat/$installroot\/custom/; sub xdie { system("rm -rf /tmp/xcatinitrd.$$"); @@ -113,19 +117,17 @@ unless ($onlyinitrd) { $yumcmd .= "install "; mkpath("$installroot/netboot/$osver/$arch/$profile/rootimg/var/lib/yum"); - my $pkglist; - if (-r "$pathtofiles/$profile.$osver.$arch.pkglist") { - $pkglist = "$pathtofiles/$profile.$osver.$arch.pkglist"; - } elsif (-r "$pathtofiles/$profile.$arch.pkglist") { - $pkglist = "$pathtofiles/$profile.$arch.pkglist"; - } elsif (-r "$pathtofiles/$profile.$osver.pkglist") { - $pkglist = "$pathtofiles/$profile.$osver.pkglist"; - } elsif (-r "$pathtofiles/$profile.pkglist") { - $pkglist = "$pathtofiles/$profile.pkglist"; - } else { + my $pkglist= get_pkglist_file_name($customdir); + if (!$pkglist) { + $pkglist= get_pkglist_file_name($pathtofiles); + } + print "pkglist=$pkglist\n"; + + if (!$pkglist) { print "Unable to find package list for $profile!"; return 1; } + open($yumconfig,"<","$pkglist"); while (<$yumconfig>) { chomp; @@ -375,10 +377,13 @@ EOMS chmod(0755,"/tmp/xcatinitrd.$$/bin/netstart"); @filestoadd=(); foreach (@ndrivers) { - if (-f "$pathtofiles/$_") { + if (-f "$customdir/$_") { push @filestoadd,[$_,"lib/$_"]; - } + } elsif (-f "$pathtofiles/$_") { + push @filestoadd,[$_,"lib/$_"]; + } } + foreach ("bin/cpio","sbin/nash","sbin/busybox.anaconda","sbin/rmmod","sbin/mount.nfs") { getlibs($_); push @filestoadd,$_; @@ -403,18 +408,25 @@ EOMS } } find(\&isnetdriver, <$installroot/netboot/$osver/$arch/$profile/rootimg/lib/modules/$kernelver/*>); + foreach (@filestoadd) { if (ref($_)) { + #print "$_->[0], $_->[1]\n"; my $srcpath = "$installroot/netboot/$osver/$arch/$profile/rootimg/".$_->[0]; - if (-f "$pathtofiles/".$_->[0]) { + if (-f "$customdir/".$_->[0]) { + $srcpath="$customdir/".$_->[0]; + } elsif (-f "$pathtofiles/".$_->[0]) { $srcpath="$pathtofiles/".$_->[0]; } mkpath(dirname("/tmp/xcatinitrd.$$/".$_->[1])); copy($srcpath,"/tmp/xcatinitrd.$$/".$_->[1]); chmod 0755,"/tmp/xcatinitrd.$$/".$_->[1]; } else { + #print "$_\n"; my $srcpath = "$installroot/netboot/$osver/$arch/$profile/rootimg/$_"; - if (-f "$pathtofiles/$_") { + if (-f "$customdir/$_") { + $srcpath = "$customdir/$_"; + } elsif (-f "$pathtofiles/$_") { $srcpath = "$pathtofiles/$_"; } mkpath(dirname("/tmp/xcatinitrd.$$/$_")); @@ -554,17 +566,10 @@ sub generic_post { #This function is meant to leave the image in a state approxi #get th extra package name sub get_extra_package_names { - my $otherpkglist; + my $otherpkglist=get_extra_pkglist_file_name($customdir); + if (!$otherpkglist) { $otherpkglist=get_extra_pkglist_file_name($pathtofiles); } my $pkgnames; - if (-r "$pathtofiles/$profile.$osver.$arch.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.$osver.$arch.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.$arch.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.$arch.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.$osver.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.$osver.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.otherpkgs.pkglist"; - } + if ($otherpkglist) { my $pkgfile; open($pkgfile,"<","$otherpkglist"); @@ -578,4 +583,33 @@ sub get_extra_package_names { return $pkgnames; } +sub get_extra_pkglist_file_name { + my $base=shift; + if (-r "$base/$profile.$osver.$arch.otherpkgs.pkglist") { + return "$base/$profile.$osver.$arch.otherpkgs.pkglist"; + } elsif (-r "$base/$profile.$arch.otherpkgs.pkglist") { + return "$base/$profile.$arch.otherpkgs.pkglist"; + } elsif (-r "$base/$profile.$osver.otherpkgs.pkglist") { + return "$base/$profile.$osver.otherpkgs.pkglist"; + } elsif (-r "$base/$profile.otherpkgs.pkglist") { + return "$base/$profile.otherpkgs.pkglist"; + } + return ""; +} + +sub get_pkglist_file_name { + my $base=shift; + if (-r "$base/$profile.$osver.$arch.pkglist") { + return "$base/$profile.$osver.$arch.pkglist"; + } elsif (-r "$base/$profile.$arch.pkglist") { + return "$base/$profile.$arch.pkglist"; + } elsif (-r "$base/$profile.$osver.pkglist") { + return "$base/$profile.$osver.pkglist"; + } elsif (-r "$base/$profile.pkglist") { + return "$base/$profile.pkglist"; + } + + return ""; +} + diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 7f9023e3d..fbce1566d 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -4,6 +4,7 @@ use File::Path; use File::Copy; use File::Find; use Getopt::Long; +use Cwd qw(realpath); #use strict; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -22,6 +23,7 @@ my @filestoadd; my $profile; my $osver; my $pathtofiles=dirname($0); +my $fullpath=realpath($pathtofiles); my $name = basename($0); my $onlyinitrd=0; if ($name =~ /geninitrd/) { @@ -32,6 +34,8 @@ my $tmplimit; my $installroot = "/install"; my $kernelver = ""; #`uname -r`; my $basekernelver; # = $kernelver; +my $customdir=$fullpath; +$customdir =~ s/.*share\/xcat/$installroot\/custom/; sub xdie { system("rm -rf /tmp/xcatinitrd.$$"); @@ -142,19 +146,18 @@ unless ($onlyinitrd) { #$yumcmd .= "install "; #mkpath("$installroot/netboot/$osver/$arch/$profile/rootimg/var/lib/yum"); my $yumcmd = "zypper -R $installroot/netboot/$osver/$arch/$profile/rootimg/ install -y "; - my $pkglist; - if (-r "$pathtofiles/$profile.$osver.$arch.pkglist") { - $pkglist = "$pathtofiles/$profile.$osver.$arch.pkglist"; - } elsif (-r "$pathtofiles/$profile.$arch.pkglist") { - $pkglist = "$pathtofiles/$profile.$arch.pkglist"; - } elsif (-r "$pathtofiles/$profile.$osver.pkglist") { - $pkglist = "$pathtofiles/$profile.$osver.pkglist"; - } elsif (-r "$pathtofiles/$profile.pkglist") { - $pkglist = "$pathtofiles/$profile.pkglist"; - } else { + + my $pkglist= get_pkglist_file_name($customdir); + if (!$pkglist) { + $pkglist= get_pkglist_file_name($pathtofiles); + } + #print "pkglist=$pkglist\n"; + + if (!$pkglist) { print "Unable to find package list for $profile!"; return 1; } + open($yumconfig,"<","$pkglist"); while (<$yumconfig>) { chomp; @@ -408,9 +411,11 @@ END chmod(0755,"/tmp/xcatinitrd.$$/bin/netstart"); @filestoadd=(); foreach (@ndrivers) { - if (-f "$pathtofiles/$_") { + if (-f "$customdir/$_") { push @filestoadd,[$_,"lib/$_"]; - } + } elsif (-f "$pathtofiles/$_") { + push @filestoadd,[$_,"lib/$_"]; + } } foreach ("usr/bin/grep","bin/cpio","bin/sleep","bin/mount","sbin/dhcpcd","bin/bash","sbin/insmod","bin/mkdir","bin/mknod","sbin/ip","bin/cat","usr/bin/awk","usr/bin/wget","bin/cp","usr/bin/cpio","usr/bin/zcat","lib/mkinitrd/bin/run-init","usr/bin/uniq","usr/bin/sed") { getlibs($_); @@ -437,15 +442,21 @@ END find(\&isnetdriver, <$installroot/netboot/$osver/$arch/$profile/rootimg/lib/modules/$kernelver/*>); foreach (@filestoadd) { if (ref($_)) { + #print "$_->[0], $_->[1]\n"; my $srcpath = "$installroot/netboot/$osver/$arch/$profile/rootimg/".$_->[0]; - if (-f "$pathtofiles/".$_->[0]) { + if (-f "$customdir/".$_->[0]) { + $srcpath="$customdir/".$_->[0]; + } elsif (-f "$pathtofiles/".$_->[0]) { $srcpath="$pathtofiles/".$_->[0]; } copy($srcpath,"/tmp/xcatinitrd.$$/".$_->[1]); chmod 0755,"/tmp/xcatinitrd.$$/".$_->[1]; } else { + #print "$_\n"; my $srcpath = "$installroot/netboot/$osver/$arch/$profile/rootimg/$_"; - if (-f "$pathtofiles/$_") { + if (-f "$customdir/$_") { + $srcpath = "$customdir/$_"; + } elsif (-f "$pathtofiles/$_") { $srcpath = "$pathtofiles/$_"; } copy("$srcpath","/tmp/xcatinitrd.$$/$_"); @@ -588,17 +599,10 @@ sub generic_post { #This function is meant to leave the image in a state approxi #get th extra package name sub get_extra_package_names { - my $otherpkglist; + my $otherpkglist=get_extra_pkglist_file_name($customdir); + if (!$otherpkglist) { $otherpkglist=get_extra_pkglist_file_name($pathtofiles); } my $pkgnames; - if (-r "$pathtofiles/$profile.$osver.$arch.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.$osver.$arch.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.$arch.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.$arch.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.$osver.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.$osver.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.otherpkgs.pkglist"; - } + if ($otherpkglist) { my $pkgfile; open($pkgfile,"<","$otherpkglist"); @@ -611,3 +615,35 @@ sub get_extra_package_names { return $pkgnames; } + +sub get_extra_pkglist_file_name { + my $base=shift; + if (-r "$base/$profile.$osver.$arch.otherpkgs.pkglist") { + return "$base/$profile.$osver.$arch.otherpkgs.pkglist"; + } elsif (-r "$base/$profile.$arch.otherpkgs.pkglist") { + return "$base/$profile.$arch.otherpkgs.pkglist"; + } elsif (-r "$base/$profile.$osver.otherpkgs.pkglist") { + return "$base/$profile.$osver.otherpkgs.pkglist"; + } elsif (-r "$base/$profile.otherpkgs.pkglist") { + return "$base/$profile.otherpkgs.pkglist"; + } + return ""; +} + +sub get_pkglist_file_name { + my $base=shift; + if (-r "$base/$profile.$osver.$arch.pkglist") { + return "$base/$profile.$osver.$arch.pkglist"; + } elsif (-r "$base/$profile.$arch.pkglist") { + return "$base/$profile.$arch.pkglist"; + } elsif (-r "$base/$profile.$osver.pkglist") { + return "$base/$profile.$osver.pkglist"; + } elsif (-r "$base/$profile.pkglist") { + return "$base/$profile.pkglist"; + } + + return ""; +} + + + diff --git a/xCAT-server/share/xcat/netboot/sles/genimage.yum b/xCAT-server/share/xcat/netboot/sles/genimage.yum index 59caa7b05..edd255fca 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage.yum +++ b/xCAT-server/share/xcat/netboot/sles/genimage.yum @@ -5,6 +5,7 @@ use File::Path; use File::Copy; use File::Find; use Getopt::Long; +use Cwd qw(realpath); #use strict; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -23,6 +24,7 @@ my @filestoadd; my $profile; my $osver; my $pathtofiles=dirname($0); +my $fullpath=realpath($pathtofiles); my $name = basename($0); my $onlyinitrd=0; if ($name =~ /geninitrd/) { @@ -33,6 +35,8 @@ my $tmplimit; my $installroot = "/install"; my $kernelver = ""; #`uname -r`; my $basekernelver; # = $kernelver; +my $customdir=$fullpath; +$customdir =~ s/.*share\/xcat/$installroot\/custom/; sub xdie { system("rm -rf /tmp/xcatinitrd.$$"); @@ -101,6 +105,7 @@ unless ($onlyinitrd) { #this is for extra packages my $srcdir_otherpkgs = "$installroot/post/otherpkgs/$osver/$arch/1"; my $pkgnames=get_extra_package_names(); + #print "extra pkgnames=$pkgnames\n"; my $yumconfig; open($yumconfig,">","/tmp/genimage.$$.yum.conf"); @@ -129,19 +134,17 @@ unless ($onlyinitrd) { mkpath("$installroot/netboot/$osver/$arch/$profile/rootimg/var/lib/yum"); #my $yumcmd = "zypper -R $installroot/netboot/$osver/$arch/$profile/rootimg/ install -y "; - my $pkglist; - if (-r "$pathtofiles/$profile.$osver.$arch.pkglist") { - $pkglist = "$pathtofiles/$profile.$osver.$arch.pkglist"; - } elsif (-r "$pathtofiles/$profile.$arch.pkglist") { - $pkglist = "$pathtofiles/$profile.$arch.pkglist"; - } elsif (-r "$pathtofiles/$profile.$osver.pkglist") { - $pkglist = "$pathtofiles/$profile.$osver.pkglist"; - } elsif (-r "$pathtofiles/$profile.pkglist") { - $pkglist = "$pathtofiles/$profile.pkglist"; - } else { + my $pkglist= get_pkglist_file_name($customdir); + if (!$pkglist) { + $pkglist= get_pkglist_file_name($pathtofiles); + } + #print "pkglist=$pkglist\n"; + + if (!$pkglist) { print "Unable to find package list for $profile!"; return 1; } + open($yumconfig,"<","$pkglist"); while (<$yumconfig>) { chomp; @@ -375,7 +378,9 @@ EOMS chmod(0755,"/tmp/xcatinitrd.$$/bin/netstart"); @filestoadd=(); foreach (@ndrivers) { - if (-f "$pathtofiles/$_") { + if (-f "$customdir/$_") { + push @filestoadd,[$_,"lib/$_"]; + } elsif (-f "$pathtofiles/$_") { push @filestoadd,[$_,"lib/$_"]; } } @@ -404,15 +409,21 @@ EOMS find(\&isnetdriver, <$installroot/netboot/$osver/$arch/$profile/rootimg/lib/modules/$kernelver/*>); foreach (@filestoadd) { if (ref($_)) { + #print "$_->[0], $_->[1]\n"; my $srcpath = "$installroot/netboot/$osver/$arch/$profile/rootimg/".$_->[0]; - if (-f "$pathtofiles/".$_->[0]) { + if (-f "$customdir/".$_->[0]) { + $srcpath="$customdir/".$_->[0]; + } elsif (-f "$pathtofiles/".$_->[0]) { $srcpath="$pathtofiles/".$_->[0]; } copy($srcpath,"/tmp/xcatinitrd.$$/".$_->[1]); chmod 0755,"/tmp/xcatinitrd.$$/".$_->[1]; } else { + #print "$_\n"; my $srcpath = "$installroot/netboot/$osver/$arch/$profile/rootimg/$_"; - if (-f "$pathtofiles/$_") { + if (-f "$customdir/$_") { + $srcpath = "$customdir/$_"; + } elsif (-f "$pathtofiles/$_") { $srcpath = "$pathtofiles/$_"; } copy("$srcpath","/tmp/xcatinitrd.$$/$_"); @@ -556,17 +567,10 @@ sub generic_post { #This function is meant to leave the image in a state approxi #get th extra package name sub get_extra_package_names { - my $otherpkglist; + my $otherpkglist=get_extra_pkglist_file_name($customdir); + if (!$otherpkglist) { $otherpkglist=get_extra_pkglist_file_name($pathtofiles); } my $pkgnames; - if (-r "$pathtofiles/$profile.$osver.$arch.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.$osver.$arch.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.$arch.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.$arch.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.$osver.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.$osver.otherpkgs.pkglist"; - } elsif (-r "$pathtofiles/$profile.otherpkgs.pkglist") { - $otherpkglist = "$pathtofiles/$profile.otherpkgs.pkglist"; - } + if ($otherpkglist) { my $pkgfile; open($pkgfile,"<","$otherpkglist"); @@ -579,3 +583,33 @@ sub get_extra_package_names { return $pkgnames; } + +sub get_extra_pkglist_file_name { + my $base=shift; + if (-r "$base/$profile.$osver.$arch.otherpkgs.pkglist") { + return "$base/$profile.$osver.$arch.otherpkgs.pkglist"; + } elsif (-r "$base/$profile.$arch.otherpkgs.pkglist") { + return "$base/$profile.$arch.otherpkgs.pkglist"; + } elsif (-r "$base/$profile.$osver.otherpkgs.pkglist") { + return "$base/$profile.$osver.otherpkgs.pkglist"; + } elsif (-r "$base/$profile.otherpkgs.pkglist") { + return "$base/$profile.otherpkgs.pkglist"; + } + return ""; +} + +sub get_pkglist_file_name { + my $base=shift; + if (-r "$base/$profile.$osver.$arch.pkglist") { + return "$base/$profile.$osver.$arch.pkglist"; + } elsif (-r "$base/$profile.$arch.pkglist") { + return "$base/$profile.$arch.pkglist"; + } elsif (-r "$base/$profile.$osver.pkglist") { + return "$base/$profile.$osver.pkglist"; + } elsif (-r "$base/$profile.pkglist") { + return "$base/$profile.pkglist"; + } + + return ""; +} + diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 7fcbae01c..bd8b44737 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -146,8 +146,13 @@ else #AIX #on AIX use geninstall PKGS=`echo "$OTHERPKGS" | tr "," " "` cd /xcatpost/post/otherpkgs/$OSVER/$ARCH - geninstall -I aX -Y -d /xcatpost/post/otherpkgs/$OSVER/$ARCH $PKGS - exit 1 + result=`geninstall -I aX -Y -d /xcatpost/post/otherpkgs/$OSVER/$ARCH $PKGS 2>&1` + rc=$? + if [ $rc -ne 0 ]; then + echo "$result" + logger "otherpkgs: $result" + fi + exit $rc fi exit 0 diff --git a/xCAT/postscripts/xcataixpost b/xCAT/postscripts/xcataixpost index 21e9e8d84..94a8dbc3c 100644 --- a/xCAT/postscripts/xcataixpost +++ b/xCAT/postscripts/xcataixpost @@ -97,7 +97,7 @@ if (-f $scriptname) `echo "$POSTS" | tr "," "\n" >> $scriptname`; } - if (&runcmd($scriptname) != 0) + if (&runcmd("cd /xcatpost;$scriptname") != 0) { print "$::sdate xcataixpost: Could not run $scriptname.\n"; print $::LOG_FILE "$::sdate xcataixpost: Could not run $scriptname.\n"; diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 788688bb9..0401bfe90 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -154,7 +154,7 @@ if [ "$1" = "1" ]; then #Only if installing for the fist time.. XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=timezone site.value=`grep ^ZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'` fi if [ ! -r /etc/xcat/postscripts.sqlite ]; then - XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab node=xcatdefaults postscripts.postscripts='syslog,remoteshell,otherpkgs' + XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab node=xcatdefaults postscripts.postscripts='syslog,remoteshell' XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab node=service postscripts.postscripts='servicenode' fi if [ ! -r /etc/xcat/policy.sqlite ]; then