diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-05-23 06:42:49 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-05-23 06:42:49 +0000 |
commit | 21ce6a9b6268d76406d033470f4f6fa06e9012f1 (patch) | |
tree | 37ff6f04457a010eaade7766c97fad206c3cbe6c /kernel | |
parent | 74abd5d458c87d244ccd965aaa8acf5627a10591 (diff) | |
download | drakx-21ce6a9b6268d76406d033470f4f6fa06e9012f1.tar drakx-21ce6a9b6268d76406d033470f4f6fa06e9012f1.tar.gz drakx-21ce6a9b6268d76406d033470f4f6fa06e9012f1.tar.bz2 drakx-21ce6a9b6268d76406d033470f4f6fa06e9012f1.tar.xz drakx-21ce6a9b6268d76406d033470f4f6fa06e9012f1.zip |
- create kernel/RPMS/ to copy rpms before expanding them in kernel/all.kernels
- remove old compatability code
- add some doc in update_kernel
Diffstat (limited to 'kernel')
-rwxr-xr-x | kernel/update_kernel | 70 |
1 files changed, 42 insertions, 28 deletions
diff --git a/kernel/update_kernel b/kernel/update_kernel index adef926d9..a32878339 100755 --- a/kernel/update_kernel +++ b/kernel/update_kernel @@ -1,9 +1,20 @@ #!/usr/bin/perl +# this script takes kernels rpms from RPMS/ and create various files in all_kernels/ +# for each rpms in RPMS, it does: +# RPMS/kernel-VER-*.rpm -> +# all.kernels/VER/all_modules.tar (used for all.rdz) +# all.kernels/VER/*.mar (used for other rdz) +# all.kernels/VER/modules.cz (used for stage2) +# all.kernels/VER/modules.dep +# all.kernels/VER/vmlinuz +# +# if RPMS is empty, this script tries to find kernels in $main_repository + use MDK::Common; use list_modules; -my $RPMS = '/export/media/main'; +my $main_repository = '/export/media/main'; my $rpm = 'rpm --nosignature'; @@ -11,22 +22,21 @@ my $MOVE = $ARGV[0] eq '--move' && shift; @ARGV <= 1 or die "usage: ./update_kernel [--move] [<kernel rpm>]\n"; +eval { rm_rf('all.kernels') }; #- remove old things +mkdir 'all.kernels'; -mkdir 'all.kernels'; # make sure "all.kernels" directory exists -eval { rm_rf('all.modules') }; #- not used anymore - -my $main = chomp_(cat_('all.kernels/.main')); -my $main_BOOT = chomp_(cat_('all.kernels/.main-BOOT')); +my $main = chomp_(cat_('RPMS/.main')); +my $main_BOOT = chomp_(cat_('RPMS/.main-BOOT')); if (@ARGV) { install_kernel($ARGV[0]); -} else { - update_kernel_from_repository($RPMS, '2.6', 0); - update_kernel_from_repository($RPMS, '2.6', 1); -# update_kernel_from_repository($RPMS, '2.4', 1); - install_kernel(glob("$RPMS/kernel-xbox*"), 1) if arch() =~ /i.86/; +} elsif (! -d 'RPMS') { + update_kernel_from_repository($main_repository, '2.6', 0); + update_kernel_from_repository($main_repository, '2.6', 1); + install_kernel(glob("$main_repository/kernel-xbox*"), 1) if arch() =~ /i.86/; } +extract_kernel($_) foreach glob("RPMS/*.rpm"); sub system_verbose { print join(' ', @_), "\n"; system(@_) } sub sys { &system_verbose; $? and die } @@ -37,33 +47,37 @@ sub rpm2version { } sub update_kernel_from_repository { - my ($RPMS, $main_ver, $is_BOOT) = @_; + my ($repository, $main_ver, $is_BOOT) = @_; my $rpm_wildcard = 'kernel-' . ($is_BOOT ? 'BOOT-' : (arch() =~ /i.86/ ? 'i586-up-1GB-' : '')) . $main_ver . '*.rpm'; - my @kernels = glob("$RPMS/$rpm_wildcard"); + my @kernels = glob("$repository/$rpm_wildcard"); install_kernel($_, 1) foreach @kernels; } sub install_kernel { - my ($kernel_rpm, $o_update) = @_; + 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"); + } + if (!$main_BOOT && $kernel_rpm =~ /BOOT/) { + $main_BOOT = rpm2version($kernel_rpm); + output('RPMS/.main-BOOT', "$main_BOOT\n"); + } +} + +sub extract_kernel { + my ($kernel_rpm) = @_; my $kern_ver = rpm2version($kernel_rpm); my $dir = "all.kernels/$kern_ver"; - -d $dir and return if $o_update; - - my $is_BOOT = $kern_ver =~ /BOOT/; - - if (!$main || !-d "all.kernels/$main") { - $main = $kern_ver; - output('all.kernels/.main', "$main\n"); - } - if ($is_BOOT && (!$main_BOOT || !-d "all.kernels/$main_BOOT")) { - $main_BOOT = $kern_ver; - output('all.kernels/.main-BOOT', "$main_BOOT\n"); - } - - warn "Installing kernel $kern_ver\n"; + warn "Extracting kernel $kern_ver\n"; eval { rm_rf($dir) }; mkdir_p("$dir/modules"); |