From 02a8160c568b018f6a7322420bc4a438841e9d8c Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 30 Mar 2010 15:49:46 +0000 Subject: [PATCH] -Have genimage pull in driver deps automatically rather than require user to know what is going on git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5612 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/netboot/rh/genimage | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 550bde5c8..4a2788ca6 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -194,6 +194,7 @@ if($mode eq "statelite"){ } + unless ($onlyinitrd) { @yumdirs=(); find(\&isyumdir, <$installroot/$osver/$arch/>); @@ -367,6 +368,29 @@ unless ($kernelver) { $kernelver=$basekernelver; } chomp($kernelver); +open($moddeps,"<","$rootimg_dir/lib/modules/$kernelver/modules.dep"); +my @moddeps = <$moddeps>; +my @checkdeps = @ndrivers; +while (scalar @checkdeps) { + my $driver = pop @checkdeps; + my @lines = grep /\/$driver:/,@moddeps; + foreach (@lines) { + chomp; + s/.*://; + s/^\s*//; + my @deps = split /\s+/,$_; + my $dep; + foreach $dep (@deps) { + $dep =~ s/.*\///; + unless (grep { $_ eq $dep } @ndrivers) { #only add if not added + unshift (@checkdeps,$dep); #recursively check dependencies + unshift (@ndrivers,$dep); + print "Added $dep as an autodetected depedency\n"; + } + } + } +} +close($moddeps); unlink "/tmp/genimage.$$.yum.conf"; #-- run postinstall script