From a6a3fef0afe9f3d4290e702b1487f3f02285d09a Mon Sep 17 00:00:00 2001 From: linggao Date: Thu, 23 Apr 2009 19:12:33 +0000 Subject: [PATCH] added umount to remove the mount on rootimg/proc in genimage and packimage, made two calls to zypper instead of one call so that os gets installed first before other packages. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3249 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/packimage.pm | 4 +++ xCAT-server/share/xcat/netboot/sles/genimage | 33 ++++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index b47ea1522..a33d9c6d1 100644 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -94,6 +94,10 @@ sub process_request { $callback->({error=>["$installroot/netboot/$osver/$arch/$profile/rootimg does not exist, run genimage -o $osver -p $profile on a server with matching architecture"]}); return; } + + #some rpms like atftp mount the rootimg/proc to /proc, we need to make sure rootimg/proc is free of junk + #before packaging the image + `umount $installroot/netboot/$osver/$arch/$profile/rootimg/proc`; copybootscript($installroot, $osver, $arch, $profile, $callback); my $passtab = xCAT::Table->new('passwd'); if ($passtab) { diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 7431b998a..6d92491f0 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -119,7 +119,7 @@ unless ($onlyinitrd) { #this is for extra packages my $srcdir_otherpkgs = "$installroot/post/otherpkgs/$osver/$arch"; - my $pkgnames=get_extra_package_names(); + my $extrapkgnames=get_extra_package_names(); mkpath "$installroot/netboot/$osver/$arch/$profile/rootimg/etc"; @@ -141,7 +141,7 @@ unless ($onlyinitrd) { } #for extra packages - if ($pkgnames) { + if ($extrapkgnames) { if($osver_host == 11) { #SLES11 if(-e "$installroot/netboot/$osver/$arch/$profile/rootimg/etc/zypp/repos.d/otherpkg.repo") { system("rm -rf $installroot/netboot/$osver/$arch/$profile/rootimg/etc/zypp/repos.d/otherpkg.repo"); @@ -192,26 +192,35 @@ unless ($onlyinitrd) { exit 1; } + my $pkgnames; open($yumconfig,"<","$pkglist"); while (<$yumconfig>) { chomp; s/\s*#.*//; #-- remove comments next if /^\s*$/; #-- skip empty lines - $yumcmd .= $_ . " "; + $pkgnames .= $_ . " "; } close($yumconfig); + - #append extra package names to zypper command - if ($pkgnames) { - $yumcmd .= " $pkgnames "; - } - - $yumcmd =~ s/ $/\n/; - my $rc = system($yumcmd); + #$yumcmd =~ s/ $/\n/; + #print "$yumcmd $pkgnames\n"; + my $rc = system("$yumcmd $pkgnames"); if ($rc) { print "zypper invocation failed\n"; exit 1; } + + #add extra packages in the list + if ($extrapkgnames) { + #print "$yumcmd $extrapkgnames\n"; + $rc = system("$yumcmd $extrapkgnames"); + if ($rc) { + print "zypper invocation failed\n"; + exit 1; + } + } + postscripts(); #run 'postscripts' } unlink "/tmp/genimage.$$.yum.conf"; @@ -230,9 +239,13 @@ if (($postinstall_filename) && (-x $postinstall_filename)) { } } +#some rpms mounts the imageroot/proc on the /proc, need to release it, +#otherwise got kernal panic when installing +`umount $installroot/netboot/$osver/$arch/$profile/rootimg/proc`; mkinitrd(); + sub getlibs { my $file = shift; my $liblist = `chroot $installroot/netboot/$osver/$arch/$profile/rootimg ldd $file`;