summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-10-29 15:05:37 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-10-29 15:05:37 +0000
commitc9adec1f7b35b8220c59dceec242d6e85e088708 (patch)
tree469d73bc0a3776056cb75d03816df69254091397
parent9eb6aeb19860384b24688481cc76b2a9e8e13789 (diff)
downloaddrakx-c9adec1f7b35b8220c59dceec242d6e85e088708.tar
drakx-c9adec1f7b35b8220c59dceec242d6e85e088708.tar.gz
drakx-c9adec1f7b35b8220c59dceec242d6e85e088708.tar.bz2
drakx-c9adec1f7b35b8220c59dceec242d6e85e088708.tar.xz
drakx-c9adec1f7b35b8220c59dceec242d6e85e088708.zip
add this script to update existing boot images when there is a fix in BOOT kernel
-rwxr-xr-xtools/update_images47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/update_images b/tools/update_images
new file mode 100755
index 000000000..cb75aebe8
--- /dev/null
+++ b/tools/update_images
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+@ARGV == 2 or die "Usage: $0 filename.img imagetype\n ex. $0 cdrom-changedisk.img cdrom\n\nPut the old images (*.img), new vmlinuz, new modules.dep and new *.mar files in a fresh directory, and update each image file one by one.";
+
+$file = $ARGV[0];
+$img = $ARGV[1];
+
+sub __ { print @_, "\n"; system(@_); }
+sub _ { __ @_; $? and die; }
+
+$topdir = '/tmp/updimg';
+
+print "Updating boot image file $file of type $img\n";
+
+_ "rm -rf $topdir";
+_ "mkdir $topdir";
+
+_ "mkdir $topdir/img";
+_ "mount -o loop $file $topdir/img";
+
+$rdz = glob("$topdir/img/*.rdz");
+$rdz or die "Could not glob rdz file in $topdir/img/*.rdz\n";
+
+_ "zcat $rdz > /tmp/meuh";
+_ "mkdir $topdir/initrd";
+_ "mount -o loop /tmp/meuh $topdir/initrd";
+
+print "\n\tOld sizes:\n";
+print `ls -l $topdir/img/vmlinuz`;
+print `ls -l $topdir/initrd/modules/modules.mar`;
+system("df $topdir/img");
+print "\n";
+
+_ "cp -f vmlinuz $topdir/img/vmlinuz";
+_ "cp -f ${img}_modules.mar $topdir/initrd/modules/modules.mar";
+_ "cp -f modules.dep $topdir/initrd/modules/modules.dep";
+
+_ "umount $topdir/initrd";
+_ "gzip -c /tmp/meuh > $rdz";
+
+print "\n\tNew sizes:\n";
+print `ls -l vmlinuz`;
+print `ls -l ${img}_modules.mar`;
+system("df $topdir/img");
+print "\n";
+
+_ "umount $topdir/img";