From a665a4ebc3637397a81783e26ef2441e021c8c21 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Wed, 16 Jan 2013 16:27:44 +0000 Subject: [PATCH] handle multiple postinstall script in linuximage table git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14898 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/netboot/debian/genimage | 17 ++++++++++++----- .../share/xcat/netboot/fedora12/genimage | 16 +++++++++++----- xCAT-server/share/xcat/netboot/rh/genimage | 16 +++++++++++----- xCAT-server/share/xcat/netboot/sles/genimage | 18 +++++++++++++----- xCAT-server/share/xcat/netboot/suse/genimage | 18 +++++++++++++----- xCAT-server/share/xcat/netboot/ubuntu/genimage | 16 +++++++++++----- 6 files changed, 71 insertions(+), 30 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/debian/genimage b/xCAT-server/share/xcat/netboot/debian/genimage index 6ff2337c7..d1913a0ea 100755 --- a/xCAT-server/share/xcat/netboot/debian/genimage +++ b/xCAT-server/share/xcat/netboot/debian/genimage @@ -386,15 +386,22 @@ if (!$imagename) { } } -if (($postinstall_filename) && (-x $postinstall_filename)) { +if ( $postinstall_filename ) { $updates{'postinstall'} = $postinstall_filename if ($tempfile); - my $rc = system($postinstall_filename, $rootimg_dir,$osver,$arch,$profile); - if($rc) { - print "postinstall script failed\n"; - exit 1; + 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; + } } + } diff --git a/xCAT-server/share/xcat/netboot/fedora12/genimage b/xCAT-server/share/xcat/netboot/fedora12/genimage index 335e4137a..a24fb0c13 100755 --- a/xCAT-server/share/xcat/netboot/fedora12/genimage +++ b/xCAT-server/share/xcat/netboot/fedora12/genimage @@ -377,14 +377,20 @@ if (!$imagename) { } } -if (($postinstall_filename) && (-x $postinstall_filename)) { +if ( $postinstall_filename ) { $updates{'postinstall'} = $postinstall_filename if ($tempfile); - my $rc = system($postinstall_filename, $rootimg_dir,$osver,$arch,$profile); - if($rc) { - print "postinstall script failed\n"; - exit 1; + 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; + } } } diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 699f189c1..853c9c123 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -537,7 +537,7 @@ unless ($imagename) { } } -if (($postinstall_filename) && (-x $postinstall_filename)) { +if ( $postinstall_filename ) { #For Mellonax IB script. In diskless image, the uname -r not returning the rootimg level, #because the "uname -r" only returns the version of the kernel in use @@ -567,10 +567,16 @@ EOS_UNAME $updates{'postinstall'} = $postinstall_filename if ($tempfile); - my $rc = system($postinstall_filename, $rootimg_dir,$osver,$arch,$profile); - if($rc) { - print "postinstall script failed\n"; - exit 1; + 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; + } } # restore the orig uname system("mv $rootimg_dir/bin/orig_uname $rootimg_dir/bin/uname"); diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 4670db4a7..aae6f2193 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -591,7 +591,7 @@ unless ($imagename) { } } -if (($postinstall_filename) && (-x $postinstall_filename)) { +if ( $postinstall_filename ) { #print "postinstall_filename=$postinstall_filename\n"; #For Mellonax IB script. In diskless image, the uname -r not returning the rootimg level, @@ -621,11 +621,19 @@ EOS_UNAME $updates{'postinstall'} = $postinstall_filename if ($tempfile); - my $rc = system($postinstall_filename, $rootimg_dir,$osver,$arch,$profile); - if($rc) { - print "postinstall script failed\n"; - exit 1; + 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; + } } + + # restore the orig uname system("mv $rootimg_dir/bin/orig_uname $rootimg_dir/bin/uname"); diff --git a/xCAT-server/share/xcat/netboot/suse/genimage b/xCAT-server/share/xcat/netboot/suse/genimage index 04f5fa9ae..01c55a785 100755 --- a/xCAT-server/share/xcat/netboot/suse/genimage +++ b/xCAT-server/share/xcat/netboot/suse/genimage @@ -383,11 +383,19 @@ if (!$imagename) { } } -if (($postinstall_filename) && (-x $postinstall_filename)) { - my $rc = system($postinstall_filename, $rootimg_dir,$osver,$arch,$profile); - if($rc) { - print "postinstall script failed\n"; - exit 1; +if ( $postinstall_filename ) { + + my @postinstalls = split /,/, $postinstall_filename; + 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; + } } } diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index a47e483ac..b392d4fb7 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -501,14 +501,20 @@ unless ($imagename) { } } -if (($postinstall_filename) && (-x $postinstall_filename)) { +if ( $postinstall_filename ) { $updates{'postinstall'} = $postinstall_filename if ($tempfile); - my $rc = system($postinstall_filename, $rootimg_dir,$osver,$arch,$profile); - if($rc) { - print "postinstall script failed\n"; - exit 1; + 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; + } } }