aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/remove-boot-splash
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-06-29 04:54:42 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-06-29 04:54:42 +0000
commitc535eabfd26a1927fc87adb9250e277e19a66c3c (patch)
tree8ce547511eaa626bcf81cea1fc76a6bcb8d6df7a /scripts/remove-boot-splash
parent74e685503f350d91b3a7f72cc56c2d6b0e73fe52 (diff)
downloadbootsplash-c535eabfd26a1927fc87adb9250e277e19a66c3c.tar
bootsplash-c535eabfd26a1927fc87adb9250e277e19a66c3c.tar.gz
bootsplash-c535eabfd26a1927fc87adb9250e277e19a66c3c.tar.bz2
bootsplash-c535eabfd26a1927fc87adb9250e277e19a66c3c.tar.xz
bootsplash-c535eabfd26a1927fc87adb9250e277e19a66c3c.zip
- add scripts/remove-boot-splash so we can modify a bootsplash
from an initrd without having to rebuild it - make-boot-splash doesn't try to detect the resolution anymore, it now needs to be given one - in switch-themes and remove-theme, use bootloader-config to update the bootloader - remove detect-resolution - requires new mkinitrd (old mkinitrd used detect-resolution) - remove "Patch: glibc-fixed-header.tar.bz2" which is unused (and not in CVS)
Diffstat (limited to 'scripts/remove-boot-splash')
-rw-r--r--scripts/remove-boot-splash34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/remove-boot-splash b/scripts/remove-boot-splash
new file mode 100644
index 0000000..e63c3b5
--- /dev/null
+++ b/scripts/remove-boot-splash
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+@ARGV == 1 or die "usage: remove-splash <initrd>\n";
+
+my $magic = 'BOOTSPL3';
+my $buffer_size = 15;
+
+my ($initrd) = @ARGV;
+open(my $F, "+< $initrd") or die "can't open $initrd: $!\n";
+
+while (1) {
+ my $got = read($F, my $buffer, $buffer_size);
+ $got > length($magic) or last;
+
+ my $index = index($buffer, $magic);
+ if ($index >= 0) {
+ my $offset = $index + tell($F) - $got;
+
+ seek($F, $offset + 12, 0) && read($F, my $tmp, 4) or last;
+ my $splash_size = unpack("V", $tmp) + 38;
+
+ my $initrd_size = seek($F, 0, 2) && tell($F);
+
+ if ($offset + $splash_size == $initrd_size) {
+ truncate($F, $offset);
+ exit 0;
+ } else {
+ warn "bootsplash found at offset $offset, but it is not at the end ($offset + $splash_size != $initrd_size)\n";
+ }
+ }
+ seek($F, -length($magic), 1); # handle the case BOOTSPL3 when overlaps between buffers
+}
+
+warn "bootsplash not found in $initrd\n";