From 644d2f982aeb403fea58f851fadf0c26508aa67d Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Mon, 10 Apr 2006 15:54:05 +0000 Subject: handle initramfs initrd in make-boot-splash and remove-boot-splash --- bootsplash.spec | 10 ++++++++-- scripts/make-boot-splash | 27 +++++++++++++++++++++++---- scripts/remove-boot-splash | 18 ++++++++++++++++++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/bootsplash.spec b/bootsplash.spec index 66483da..a53a680 100644 --- a/bootsplash.spec +++ b/bootsplash.spec @@ -1,5 +1,5 @@ %define name bootsplash -%define version 3.1.10 +%define version 3.1.11 %define release %mkrel 1 %define _bootdir /boot @@ -14,7 +14,9 @@ Group: System/Kernel and hardware BuildRoot: %{_tmppath}/%{name}-buildroot Url: http://cvs.mandriva.com/cgi-bin/cvsweb.cgi/soft/bootsplash/ Requires: /usr/bin/perl -Requires: mkinitrd >= 3.5.18-14mdk +# Do not require mkinitrd anymore to be able to be prerequed by mkinitrd (mkinitrd is in basesystem anyway) +# Requires: mkinitrd >= 3.5.18-14mdk +Conflicts: mkinitrd < 3.5.18-14mdk #there is no way to say a special kernel requires. Requires: kernel initscripts > 7.04-15mdk fbgrab Conflicts: drakxtools-newt < 10-49mdk @@ -87,6 +89,10 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/* %changelog +* Mon Apr 10 2006 Warly 3.1.11-1mdk +- Do not require mkinitrd (mkinird will now prereq bootsplash) +- Handle initramfs in make-boot-splash and remove-boot-splash + * Fri Sep 16 2005 Pixel 3.1.10-1mdk - fix upgrading mandrakelinux-theme to mandriva-theme by patching remove-theme ("remove-theme Mandrakelinux" from the preun of mandrakelinux-theme diff --git a/scripts/make-boot-splash b/scripts/make-boot-splash index 177005c..9bf64a0 100755 --- a/scripts/make-boot-splash +++ b/scripts/make-boot-splash @@ -45,12 +45,31 @@ if [[ -z $config ]];then exit 1; fi -$splash_dir/scripts/remove-boot-splash $initrd_file +# warly: we cannot use file command which is in /usr/bin/ +# initrd_type=`zcat /boot/initrd-2.6.14-2mdk.ramfs.img | file -` -if [[ -x /sbin/splash ]]; then - /sbin/splash -s -f $config >> $initrd_file -fi +if `/bin/zcat $initrd_file 2> /dev/null | /bin/cpio -t &> /dev/null`; then + tmp_dir=`mktemp -d` + pushd $tmp_dir &> /dev/null + /bin/zcat $initrd_file 2>/dev/null | /bin/cpio -id 2>/dev/null + if [[ -x /sbin/splash ]]; then + /sbin/splash -s -f $config > $tmp_dir/bootsplash + else + if [[ -f $tmp_dir/bootsplash ]]; then + rm -f $tmp_dir/bootsplash + fi + fi + /bin/find . -print | /bin/cpio -o 2> /dev/null | gzip -c > $initrd_file + popd &> /dev/null + rm -rf $tmp_dir +else + $splash_dir/scripts/remove-boot-splash $initrd_file + if [[ -x /sbin/splash ]]; then + /sbin/splash -s -f $config >> $initrd_file + fi +fi + if [ -z "$DURING_INSTALL" ]; then $splash_dir/scripts/switch-themes -u fi diff --git a/scripts/remove-boot-splash b/scripts/remove-boot-splash index e63c3b5..3ab7425 100644 --- a/scripts/remove-boot-splash +++ b/scripts/remove-boot-splash @@ -6,6 +6,24 @@ my $magic = 'BOOTSPL3'; my $buffer_size = 15; my ($initrd) = @ARGV; + +# FIXME it must have a clear way to do that in perl +if (!system("/bin/zcat $initrd 2> /dev/null | /bin/cpio -t &> /dev/null")) { + print STDERR "remove-boot-splash: initrd in initramfs format\n"; + chomp(my $tmp_dir = `mktemp -d`); + chdir $tmp_dir; + system("/bin/zcat $initrd 2>/dev/null | /bin/cpio -id 2>/dev/null"); + if (-f "$tmp_dir/bootsplash") { + unlink "$tmp_dir/bootsplash" or die "FATAL: removing of $tmp_dir/bootsplash failed"; + print STDERR "remove-boot-splash: removing bootsplash from initrd\n"; + system("/bin/find . -print | /bin/cpio -o 2> /dev/null | gzip -c > $initrd") + } else { + print STDERR "ERROR remove-boot-splash: bootsplash image not found in $initrd\n" + } + system("rm -rf $tmp_dir"); + exit +} + open(my $F, "+< $initrd") or die "can't open $initrd: $!\n"; while (1) { -- cgit v1.2.1