From 91ccada5d35a33d944e51df3ad36e12079d513aa Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Mon, 7 Jan 2013 05:57:59 +0000 Subject: [PATCH] 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 --- xCAT-buildkit/bin/buildkit | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index fbe93bf41..c9e17dea4 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -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/<<>>/$kitname/; s/<<>>/$comp->{basename}/;