From 692a7853288c0e5de3574f8f1b4089211310cb80 Mon Sep 17 00:00:00 2001 From: linggao Date: Thu, 23 Apr 2009 14:13:56 +0000 Subject: [PATCH] postinstall template can now be put under /install/custom/netboot/.. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3247 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/netboot/sles/genimage | 39 ++++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index d9d1231d9..7431b998a 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -217,27 +217,19 @@ unless ($onlyinitrd) { unlink "/tmp/genimage.$$.yum.conf"; #-- run postinstall script -if (-x "$pathtofiles/$profile.$osver.$arch.postinstall") { - my $rc = system("$pathtofiles/$profile.$osver.$arch.postinstall", "$installroot/netboot/$osver/$arch/$profile/rootimg",$osver,$arch,$profile); +my $postinstall_filename= get_postinstall_file_name($customdir); +if (!$postinstall_filename) { + $postinstall_filename= get_postinstall_file_name($pathtofiles); +} + +if (($postinstall_filename) && (-x $postinstall_filename)) { + my $rc = system($postinstall_filename, "$installroot/netboot/$osver/$arch/$profile/rootimg",$osver,$arch,$profile); if($rc) { print "postinstall script failed\n"; exit 1; } } -elsif (-x "$pathtofiles/$profile.$osver.postinstall") { - my $rc = system("$pathtofiles/$profile.$osver.postinstall","$installroot/netboot/$osver/$arch/$profile/rootimg",$osver,$arch,$profile); - if ($rc) { - print "posinstall script failed\n"; - exit 1; - } -} -elsif (-x "$pathtofiles/$profile.postinstall") { - my $rc = system("$pathtofiles/$profile.postinstall","$installroot/netboot/$osver/$arch/$profile/rootimg",$osver,$arch,$profile); - if ($rc) { - print "postinstall script failed\n"; - exit 1; - } -} + mkinitrd(); @@ -713,4 +705,19 @@ sub get_pkglist_file_name { } +sub get_postinstall_file_name { + my $base=shift; + if (-x "$base/$profile.$osver.$arch.postinstall") { + return "$base/$profile.$osver.$arch.postinstall"; + } elsif (-x "$base/$profile.$arch.postinstall") { + return "$base/$profile.$arch.postinstall"; + } elsif (-x "$base/$profile.$osver.postinstall") { + return "$base/$profile.$osver.postinstall"; + } elsif (-x "$base/$profile.postinstall") { + return "$base/$profile.postinstall"; + } + + return ""; +} +