diff options
-rw-r--r-- | images/Makefile | 3 | ||||
-rw-r--r-- | images/NEWS | 3 | ||||
-rwxr-xr-x | images/make_boot_img | 6 | ||||
-rwxr-xr-x | images/update_kernel | 47 |
4 files changed, 23 insertions, 36 deletions
diff --git a/images/Makefile b/images/Makefile index 0bd56c910..668a0c58f 100644 --- a/images/Makefile +++ b/images/Makefile @@ -2,6 +2,7 @@ include ../Makefile.config VERSION=1.13 PRODUCT=drakx-installer-images +KERNELS=$(shell rpm -qf /lib/modules/2.*) IMAGES_DEST = $(ROOTDEST)/install/images @@ -16,7 +17,7 @@ images: all.kernels cd images ; md5sum *.{img,iso}* > MD5SUM all.kernels: update_kernel ../kernel/list_modules.pm - ./update_kernel + ./update_kernel $(KERNELS) tar: rm -rf $(PRODUCT)*.tar* $(PRODUCT)-$(VERSION) diff --git a/images/NEWS b/images/NEWS index 94db91b6b..7a63e22b7 100644 --- a/images/NEWS +++ b/images/NEWS @@ -1,3 +1,6 @@ +- update_kernel: now require install rpms or rpm files as arguments + (this allow specifying precisely which installed kernels are used) + Version 1.13 - 8 August 2007, by Pascal "Pixel" Rigaux - add modules.alias in /modules/<version> as required by stage2 with new libldetect diff --git a/images/make_boot_img b/images/make_boot_img index ed56e0ec3..e08e50ef5 100755 --- a/images/make_boot_img +++ b/images/make_boot_img @@ -32,9 +32,7 @@ sub mke2fs { _ "mkdir -p $tmp_mnt"; mkdir "images"; -my @kernels = all('all.kernels'); -my $main = chomp_(cat_('RPMS/.main')) || $kernels[0]; -@kernels = uniq($main, @kernels); +my @kernels = chomp_(cat_('all.kernels/.list')); my @all_images = ( if_($arch =~ /i.86/, 'isolinux', 'boot.iso', 'all.img', 'hd_grub.img'), @@ -63,7 +61,7 @@ foreach my $img (@images) { } elsif ($extension eq 'img') { print STDERR "calling boot_img_$arch for $img\n"; $::{"boot_img_$arch"}->($type, $I, "$img-$_", "all.kernels/$_/vmlinuz") foreach @kernels; - rename("$img-$main", $img); + rename("$img-$kernels[0]", $img); } else { die "unknown image $img"; } 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/<VER> +# 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] [<kernel rpm>]\n"; +@ARGV or die "usage: ./update_kernel [--move] (<kernel rpm> ... | <installed kernel name> ...)\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"); } |