Fixed a problem that if preinstall/preupgrade/postinstall/postupgrade script is empty, the product rpm will fail during insalling.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14769 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2013-01-07 05:57:59 +00:00
parent 2d5991f5ee
commit 91ccada5d3

View File

@ -1691,18 +1691,22 @@ sub gen_kitcomp_spec
my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename};
my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript) = ' ';
if (defined($comp->{preinstall})) {
$prescript = &load_script("$scriptdir$comp->{preinstall}"); }
$prescript = &load_script("$scriptdir$comp->{preinstall}");
$prescript = "if [ \"\$1\" = \"1\" ] ; then\n" . $prescript . "\nfi";}
if (defined($comp->{postinstall})) {
$postscript = &load_script("$scriptdir$comp->{postinstall}"); }
$postscript = &load_script("$scriptdir$comp->{postinstall}");
$postscript = "if [ \"\$1\" = \"1\" ] ; then\n" . $postscript . "\nfi"; }
if (defined($comp->{preupgrade})) {
$preupscript = &load_script("$scriptdir$comp->{preupgrade}"); }
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
$preupscript = "if [ \"\$1\" = \"2\" ] ; then\n" . $preupscript . "\nfi";}
if (defined($comp->{postupgrade})) {
$postupscript = &load_script("$scriptdir$comp->{postupgrade}"); }
$postupscript = &load_script("$scriptdir$comp->{postupgrade}");
$postupscript = "if [ \"\$1\" = \"2\" ] ; then\n" . $postupscript . "\nfi";}
if (defined($comp->{preuninstall})) {
$preunscript = &load_script("$scriptdir$comp->{preuninstall}"); }
if (defined($comp->{postuninstall})) {
$postunscript = &load_script("$scriptdir$comp->{postuninstall}"); }
for (@lines) {
s/<<<INSERT_kitbasename_HERE>>>/$kitname/;
s/<<<INSERT_kitcomponent_basename_HERE>>>/$comp->{basename}/;