From 88e8551b2edd61408e12fdc7cf961dc23fbef8bc Mon Sep 17 00:00:00 2001 From: Frederic Crozat Date: Wed, 7 Oct 2009 14:43:17 +0000 Subject: - Port to plymouth --- Makefile | 2 +- scripts/make-boot-splash | 28 ++-------------------------- scripts/make-boot-splash-raw | 40 +++++++++++----------------------------- scripts/remove-boot-splash | 8 ++++---- scripts/rewritejpeg | 41 ----------------------------------------- scripts/switch-themes | 42 +++++++++--------------------------------- 6 files changed, 27 insertions(+), 134 deletions(-) delete mode 100755 scripts/rewritejpeg diff --git a/Makefile b/Makefile index 62ca410..6a34db6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ NAME=bootsplash -VERSION := 3.2.25 +VERSION := 3.3.0 SUBDIRS=scripts FILES=$(SUBDIRS) Makefile ChangeLog README diff --git a/scripts/make-boot-splash b/scripts/make-boot-splash index 5f8ec81..61d0fb6 100755 --- a/scripts/make-boot-splash +++ b/scripts/make-boot-splash @@ -5,40 +5,16 @@ # Public License (GPL) # $Id$ -: ${splash_dir=/usr/share/bootsplash} - [[ -f /etc/sysconfig/bootsplash ]] && source /etc/sysconfig/bootsplash [[ -z $THEME ]] && THEME=Mandriva [ $# = 2 ] || { echo "usage: $0 "; exit 1; } initrd_file=$1 -vgamode=$2 - -if [[ $vgamode == 640* ]];then - resolution=640x480 -elif [[ $vgamode == 800* ]];then - resolution=800x600 -elif [[ $vgamode == 1024* ]];then - resolution=1024x768 -elif [[ $vgamode == 1280* ]];then - resolution=1280x1024 -elif [[ $vgamode == 1600* ]];then - resolution=1600x1200 -else - echo "unknown resolution \"$vgamode\"" - [ "$vgamode" = "auto" ] && echo 'resolution "auto" is not handled anymore' - exit 1 -fi -rm -f $splash_dir/themes/current -ln -s $THEME $splash_dir/themes/current +plymouth-set-default-theme $THEME -if [ -x /sbin/splashy_config ]; then - DURING_MAKE_BOOTSPLASH=1 /sbin/splashy_config -s $THEME-$resolution -fi - -$splash_dir/scripts/make-boot-splash-raw $initrd_file $resolution $THEME || exit 1 +$splash_dir/scripts/make-boot-splash-raw $initrd_file $THEME || exit 1 if [ -z "$DURING_INSTALL" ]; then $splash_dir/scripts/switch-themes -u diff --git a/scripts/make-boot-splash-raw b/scripts/make-boot-splash-raw index 5b03e2d..6ebeaa8 100755 --- a/scripts/make-boot-splash-raw +++ b/scripts/make-boot-splash-raw @@ -8,55 +8,37 @@ : ${splash_dir=/usr/share/bootsplash} : ${splash_cfg=/etc/bootsplash} -[ $# = 3 ] || { echo "usage: $0 "; exit 1; } +[ $# = 2 ] || { echo "usage: $0 "; exit 1; } initrd_file=$1 -resolution=$2 -THEME=$3 - -if [[ -f $splash_cfg/themes/$THEME/config/bootsplash-$resolution.cfg ]];then - config=$splash_cfg/themes/$THEME/config/bootsplash-$resolution.cfg -fi - -if [[ -z $config ]];then - echo "Can't find a config file for resolution $resolution"; - exit 1; -fi +THEME=$2 # warly: we cannot use file command which is in /usr/bin/ # initrd_type=`zcat /boot/initrd-2.6.14-2mdk.ramfs.img | file -` if `/bin/zcat $initrd_file 2> /dev/null | /bin/cpio -t &> /dev/null`; then tmp_dir=`mktemp -d` - /bin/zcat $initrd_file | cpio-filter --exclude 'bootsplash|etc/splashy|usr/share/splashy/themes' > $tmp_dir/initrd - if [ -x /sbin/splashy ]; then - (echo /etc/splashy/themes ; echo /usr/share/splashy/themes ; /usr/sbin/splashy_find_files ) \ - | perl -MFile::Basename -ne 'm,^/(etc/splashy/.*|usr/share/splashy/.*), and print $1 . "\n" . dirname($1) . "\n"' \ + /bin/zcat $initrd_file | cpio-filter --exclude 'usr/share/plymouth|usr/lib/plymouth|usr/lib64/plymouth' > $tmp_dir/initrd + if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then + /usr/libexec/plymouth/plymouth-populate-initrd -t $tmp_dir/initrd + + (echo /; echo /usr/share/plymouth ; echo /usr/lib/plymouth ; echo /usr/lib64/plymouth ) \ + | perl -MFile::Basename -ne 'm,^/(usr/share/plymouth/.*|usr/lib/plymouth/.*|usr/lib64/plymouth/.*), and print $1 . "\n" . dirname($1) . "\n"' \ | sort -u | (cd / ; cpio -o -c -L --quiet -O $tmp_dir/initrd --append) - elif [[ -x /sbin/splash ]]; then - /sbin/splash -s -f $config > $tmp_dir/bootsplash - echo bootsplash | (cd $tmp_dir ; cpio -o -c --quiet -O $tmp_dir/initrd --append) fi gzip -c $tmp_dir/initrd > $initrd_file rm -rf $tmp_dir else $splash_dir/scripts/remove-boot-splash $initrd_file - if [ -x /sbin/splashy ]; then + if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then tmp_initrd=`mktemp` tmp_dir=`mktemp -d` gzip -dc $initrd_file > $tmp_initrd mount -o loop $tmp_initrd $tmp_dir - rm -rf $tmp_dir/etc/splashy - for f in `/usr/sbin/splashy_find_files | egrep ^/etc/splashy\|/usr/share/splashy/themes`; do - d=`dirname $f` - mkdir -p $tmp_dir$d - cp -aL $f $tmp_dir$d - done + rm -rf $tmp_dir/usr/share/plymouth $tmp_dir/usr/lib*/plymouth + /usr/libexec/plymouth/plymouth-populate-initrd -t $tmp_dir umount $tmp_dir gzip -c $tmp_initrd > $initrd_file rm -f $tmp_initrd - elif [[ -x /sbin/splash ]]; then - /sbin/splash -s -f $config >> $initrd_file - fi fi diff --git a/scripts/remove-boot-splash b/scripts/remove-boot-splash index f7e7b63..c7317e5 100644 --- a/scripts/remove-boot-splash +++ b/scripts/remove-boot-splash @@ -13,12 +13,12 @@ if (!system("/bin/zcat $initrd 2> /dev/null | /bin/cpio -t &> /dev/null")) { 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"; + if (-d "$tmp_dir/usr/share/plymouth") { + system("rm -fr $tmp_dir/usr/share/plymouth $tmp_dir/usr/lib/plymouth $tmp_dir/usr/lib/libply* $tmp_dir/lib/libply* $tmp_dir/bin/plymouthd $tmp_dir/bin/plymouth"); + print STDERR "remove-boot-splash: removing plymouth from initrd\n"; system("/bin/find . -print | /bin/cpio --quiet -c -o 2> /dev/null | gzip -c > $initrd") } else { - print STDERR "ERROR remove-boot-splash: bootsplash image not found in $initrd\n" + print STDERR "ERROR remove-boot-splash: plymouth not found in $initrd\n" } system("rm -rf $tmp_dir"); exit diff --git a/scripts/rewritejpeg b/scripts/rewritejpeg deleted file mode 100755 index 21822c7..0000000 --- a/scripts/rewritejpeg +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -*- Mode: shell-script -*- -# Copyright (C) 2002 by Chmouel Boudjnah -# Redistribution of this file is permitted under the terms of the GNU -# Public License (GPL) -# -# Take a Jpeg and reconvert it via ppm-tools to make sure is -# compatible for boot logo -# -# Modified by Olivier Blin on October 30, 2003. -# grayscale jpeg support. -# it's perhaps better to use "convert -type TrueColor" -# -# $Id$ - -files="$@" - -[[ -z $files ]] && { - echo "I need jpeg files argument" - exit 1 -} - -for file in $files;do - [[ $file != *.jpg ]] && { - echo "$file is not a jpeg" - continue; - } - tmp_ppm=${file/.jpg/.ppm} - output=`jpegtopnm $file 2>&1 > $tmp_ppm` - echo $output - if [[ $output == *PGM* ]]; then - tmp_pgm=${file/.jpg/.pgm} - mv $tmp_ppm $tmp_pgm - echo "(converting PGM file into PPM file)" - pgmtoppm grey $tmp_pgm > $tmp_ppm - rm -f $tmp_pgm - fi - ppmtojpeg $tmp_ppm > $file - rm -f $tmp_ppm -done - diff --git a/scripts/switch-themes b/scripts/switch-themes index 083ea95..8c0e644 100755 --- a/scripts/switch-themes +++ b/scripts/switch-themes @@ -5,13 +5,13 @@ # Public License (GPL) # $Id$ -bootsplashdir=/usr/share/bootsplash +plymouthdir=/usr/share/plymouth sysconfig=/etc/sysconfig/bootsplash bootdir=/boot function list_available_themes () { local basename= - for i in $bootsplashdir/themes/*;do + for i in $plymouthdir/themes/*;do basename=${i##*/} echo $basename done @@ -31,30 +31,6 @@ function read_link () { perl -e '{print readlink shift, "\n"}' $1 } -function lilo_switch_themes () { - local theme=$1 - local message_from_theme=$bootsplashdir/themes/$theme/lilo/message - local message_from_current=$bootdir/lilo/message - - #checking - if [[ ! -f $message_from_theme ]];then - return; - fi - - #Make sure to point on lilo-graphic - if [[ -L $bootdir/message ]];then - point_to=$(read_link $bootdir/message) - if [[ $point_to != message-graphic ]];then - rm -f $bootdir/message - ln -s message-graphic $bootdir/message - fi - fi - - if ! cmp -s $message_from_theme $message_from_current;then - cp -f $message_from_theme $bootdir/message-graphic - fi -} - function grub_switch_themes () { if [ -x /usr/sbin/grub-gfxmenu ]; then /usr/sbin/grub-gfxmenu --update-theme @@ -81,8 +57,13 @@ function update () { rm -f /usr/share/gfxboot/themes/current ln -s $theme /usr/share/gfxboot/themes/current - rm -f $bootsplashdir/current - ln -s $theme $bootsplashdir/current + if [[ -z $update ]]; then + /usr/sbin/plymouth-set-default-theme $theme + fi + + [ -f /usr/lib/libDrakX/Xconfig/resolution_and_depth.pm ] && perl -I/usr/lib/libDrakX -MXconfig::xfree -MXconfig::resolution_and_depth -e 'Xconfig::resolution_and_depth::set_default_background(Xconfig::xfree->read->get_resolution)' + + } function switch_theme () { @@ -111,13 +92,8 @@ function switch_theme () { echo "THEME=$toswitch" >> $sysconfig fi rm -f $tmpfile - if [[ -d /etc/bootsplash/themes/$toswitch ]]; then - rm -f /etc/bootsplash/themes/current - ln -s $toswitch /etc/bootsplash/themes/current - fi update $toswitch fi - #lilo_switch_themes $toswitch grub_switch_themes $toswitch } -- cgit v1.2.1