diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-04-25 12:26:16 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-04-25 12:26:16 +0000 |
commit | 126777bc019a54afb4ec51299f2cf9d2841698aa (patch) | |
tree | 97f76e571902ead55ba138f1156a4b4f00b9b779 /kernel/update_kernel | |
parent | f1f67448efc714873378dfeb8279fae68054a90a (diff) | |
download | drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.gz drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.bz2 drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.xz drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.zip |
re-sync after the big svn loss
Diffstat (limited to 'kernel/update_kernel')
-rwxr-xr-x | kernel/update_kernel | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/kernel/update_kernel b/kernel/update_kernel deleted file mode 100755 index a32878339..000000000 --- a/kernel/update_kernel +++ /dev/null @@ -1,118 +0,0 @@ -#!/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 $main_repository = '/export/media/main'; -my $rpm = 'rpm --nosignature'; - - -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'; - -my $main = chomp_(cat_('RPMS/.main')); -my $main_BOOT = chomp_(cat_('RPMS/.main-BOOT')); - -if (@ARGV) { - install_kernel($ARGV[0]); -} 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 } - -sub rpm2version { - my ($kernel_rpm) = @_; - `$rpm -qpl $kernel_rpm` =~ m!/boot/vmlinuz-(.*)! && $1 or die "can't find vmlinuz in $kernel_rpm\n"; -} - -sub update_kernel_from_repository { - 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("$repository/$rpm_wildcard"); - - install_kernel($_, 1) foreach @kernels; -} - -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"); - } - 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"; - - warn "Extracting kernel $kern_ver\n"; - - eval { rm_rf($dir) }; - mkdir_p("$dir/modules"); - sys("rpm2cpio $kernel_rpm | (cd $dir ; cpio -id)"); - - rename "$dir/boot/vmlinuz-$kern_ver", "$dir/vmlinuz" or die "can't find vmlinuz\n"; - - sys("find $dir -name '*.gz' | xargs gunzip"); - - my $ext = module_extension($kern_ver); - - open(my $F, "find $dir -name '*.$ext' |"); - my $file; while ($file = <$F>) { - chomp($file); - rename $file, "$dir/modules/" . basename($file) or warn "conflict for $file\n"; - } - - if (kernel_is_26($kern_ver)) { - warn "no stripping on 2.6 since it breaks modules\n"; - } else { - print STDERR "stripping $kern_ver: "; - sys("./strip_modules $dir/modules/*.$ext"); - print STDERR "done\n"; - } - - sys('perl', 'modules.pl', 'remove_unneeded_modules', $kern_ver) if $kern_ver !~ /BOOT/; - - sys('perl', 'modules.pl', 'make_modules_per_image', $kern_ver); - sys('perl', 'modules.pl', 'make_modules_description', $kern_ver) if $kern_ver eq $main; - - if (!$MOVE) { - print STDERR "packdrake $kern_ver: "; - sys("cd $dir/modules ; ls *.$ext | packdrake -b9s ../modules.cz 400000"); - print STDERR "done\n"; - } - - eval { rm_rf("$dir$_") } foreach qw(/boot /lib /usr /modules); -} |