From b4222fa105800fd7ad0c75d92fbe00c558f2cee3 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 9 Aug 2007 10:45:56 +0000 Subject: - update_kernel: now require install rpms or rpm files as arguments (this allow specifying precisely which installed kernels are used) nb: - RPMS/ is not used anymore, pkgs given an command line are installed directly in all.kernels/ - RPMS/.main is replaced by all.kernels/.list which keeps the ordering of kernels given to update_kernel --- images/update_kernel | 47 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) (limited to 'images/update_kernel') diff --git a/images/update_kernel b/images/update_kernel index b39342c33..9429a209a 100755 --- a/images/update_kernel +++ b/images/update_kernel @@ -1,6 +1,6 @@ #!/usr/bin/perl -# this script takes kernels rpms from RPMS/ or /lib/modules/ +# this script takes command kernel rpms (either installed rpms or rpm files) # and create various files in all_kernels/: # all.kernels/VER/all_modules.tar (used for all.rdz) # all.kernels/VER/modules.dep @@ -17,50 +17,37 @@ my $rpm = 'rpm --nosignature'; my $MOVE = $ARGV[0] eq '--move' && shift; -@ARGV <= 1 or die "usage: ./update_kernel [--move] []\n"; +@ARGV or die "usage: ./update_kernel [--move] ( ... | ...)\n"; eval { rm_rf('all.kernels') }; #- remove old things mkdir 'all.kernels'; -my $main = chomp_(cat_('RPMS/.main')); +my @kernels = map { + my $kern_ver = rpm2version($_); + if (/\.rpm$/) { + extract_kernel($_, $kern_ver); + } else { + extract_installed_rpm('', $kern_ver); + } + $kern_ver; +} @ARGV; -if (@ARGV) { - install_kernel($ARGV[0]); -} +sys('cp', '-f', "all.kernels/$kernels[0]/modules.description", '.'); -if (glob("RPMS/*.rpm")) { - extract_kernel($_) foreach glob("RPMS/*.rpm"); -} else { - my @l = all('/lib/modules'); - @l = grep { /legacy/ } @l if arch() =~ /i.86/; - extract_installed_rpm('/', $_) foreach @l; -} +output('all.kernels/.list', map { "$_\n" } @kernels); sub system_verbose { print join(' ', @_), "\n"; system(@_) } sub sys { &system_verbose; $? and die } sub rpm2version { my ($kernel_rpm) = @_; - `$rpm -qpl $kernel_rpm` =~ m!/boot/vmlinuz-(.*)! && $1 or die "can't find vmlinuz in $kernel_rpm\n"; -} - -sub install_kernel { - my ($kernel_rpm) = @_; - my $basename = basename($kernel_rpm); - warn "Installing rpm $basename in RPMS\n"; - mkdir 'RPMS'; - cp_af($kernel_rpm, "RPMS/$basename"); - - if (!$main) { - $main = rpm2version($kernel_rpm); - output('RPMS/.main', "$main\n"); - } + my $opt = -e $kernel_rpm ? '-qpl' : '-ql'; + `$rpm $opt $kernel_rpm` =~ m!/boot/vmlinuz-(.*)! && $1 or die "can't find vmlinuz in $kernel_rpm (is it installed?)\n"; } sub extract_kernel { - my ($kernel_rpm) = @_; + my ($kernel_rpm, $kern_ver) = @_; - my $kern_ver = rpm2version($kernel_rpm); my $dir = "all.kernels/$kern_ver"; warn "Extracting kernel $kern_ver\n"; @@ -90,9 +77,7 @@ sub extract_installed_rpm { } sys('perl', '../kernel/modules.pl', 'remove_unneeded_modules', $kern_ver); - sys('perl', '../kernel/modules.pl', 'make_modules_per_image', $kern_ver); - sys('cp', '-f', "$local_dir/modules.description", '.') if $kern_ver eq $main || !$main; rm_rf("$local_dir/modules"); } -- cgit v1.2.1