summaryrefslogtreecommitdiffstats
path: root/images/update_kernel
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-09 10:45:56 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-09 10:45:56 +0000
commitb4222fa105800fd7ad0c75d92fbe00c558f2cee3 (patch)
treea84c435d2389a8b3e34f6e62d8a5d6d23219e9e1 /images/update_kernel
parent5250450dd9f863938bd6d7bc0643099e796d138b (diff)
downloaddrakx-b4222fa105800fd7ad0c75d92fbe00c558f2cee3.tar
drakx-b4222fa105800fd7ad0c75d92fbe00c558f2cee3.tar.gz
drakx-b4222fa105800fd7ad0c75d92fbe00c558f2cee3.tar.bz2
drakx-b4222fa105800fd7ad0c75d92fbe00c558f2cee3.tar.xz
drakx-b4222fa105800fd7ad0c75d92fbe00c558f2cee3.zip
- 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
Diffstat (limited to 'images/update_kernel')
-rwxr-xr-ximages/update_kernel47
1 files changed, 16 insertions, 31 deletions
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");
}