From 9e2ca8863851cf05c4a2dd64dd8d5acf5fc0e8ae Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 10 Mar 2015 03:47:48 -0400 Subject: [PATCH] defect:4592 ubuntu:genimage, move the running of postinstall script before determining the linux kernel version since postinstall script might add new kernel pakcage --- .../share/xcat/netboot/ubuntu/genimage | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index a2cdc9cd6..3f906064a 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -584,6 +584,31 @@ unless ($onlyinitrd) { postscripts(); #run 'postscripts' } +#-- run postinstall script +unless ($imagename) { + $postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $customdir, "postinstall"); + unless ($postinstall_filename) { + $postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $pathtofiles, "postinstall"); + } +} + +if ( $postinstall_filename ) { + + $updates{'postinstall'} = $postinstall_filename if ($tempfile); + + foreach my $postinstall ( split /,/, $postinstall_filename ) { + if ( !-x $postinstall ) { + print "postinstall script $postinstall is not executable\n"; + exit 1; + } + my $rc = system($postinstall, $rootimg_dir,$osver,$arch,$profile); + if($rc) { + print "postinstall script $postinstall failed\n"; + exit 1; + } + } +} + # Default to the first kernel found in the install image if nothing specified explicitly. # A more accurate guess than whatever the image build server happens to be running # If specified, that takes precedence. @@ -668,31 +693,6 @@ if (-d "$rootimg_dir/usr/share/dracut") { print "Enter the dracut mode. Dracut version: $dracutver. Dracut directory: $dracutdir.\n"; } -#-- run postinstall script -unless ($imagename) { - $postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $customdir, "postinstall"); - unless ($postinstall_filename) { - $postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $pathtofiles, "postinstall"); - } -} - -if ( $postinstall_filename ) { - - $updates{'postinstall'} = $postinstall_filename if ($tempfile); - - foreach my $postinstall ( split /,/, $postinstall_filename ) { - if ( !-x $postinstall ) { - print "postinstall script $postinstall is not executable\n"; - exit 1; - } - my $rc = system($postinstall, $rootimg_dir,$osver,$arch,$profile); - if($rc) { - print "postinstall script $postinstall failed\n"; - exit 1; - } - } -} - # all the attributes have been gathered # now, update the linuximage and osimage tables # TODO: do statelite and stateless share the same attributes?