diff options
Diffstat (limited to 'scripts/make-boot-splash')
-rwxr-xr-x | scripts/make-boot-splash | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/scripts/make-boot-splash b/scripts/make-boot-splash new file mode 100755 index 0000000..45b8c56 --- /dev/null +++ b/scripts/make-boot-splash @@ -0,0 +1,87 @@ +#!/bin/sh +# -*- Mode: shell-script -*- +# Copyright (C) 2002 by Chmouel Boudjnah <chmouel@mandrakesoft.com> +# Redistribution of this file is permitted under the terms of the GNU +# Public License (GPL) +# $Id$ + +: ${splash_dir=/usr/share/bootsplash} + +initrd_file=$1 + +[[ -z $initrd_file ]] && { + echo "You need to specify a initrd file as argument" + exit 1; +} + +vgamode=$( $splash_dir/scripts/detect-resolution ) +if [[ $vgamode == 800* ]];then + resolution=800x600 +elif [[ $vgamode == 1024* ]];then + resolution=1024x768 +elif [[ $vgamode == 1280* ]];then + resolution=1280x1024 +fi + +if [[ -f $splash_dir/images/bootsplash-$resolution.jpg && -f $splash_dir/cfg/bootsplash-$resolution.cfg ]];then + image=$splash_dir/images/bootsplash-$resolution.jpg + config=$splash_dir/cfg/bootsplash-$resolution.cfg +fi + +if [[ -n $image ]];then + if [[ -z $config ]];then + echo "Can't find a config files for $resolution"; + exit 1; + fi +else #no image + echo "Can't find images for $resolution"; +fi + +# From SuSe mk_initrd script +function out_byte() +{ + let x=$1 + echo -en "`printf \\\\%o $x`" +} +function write_int() +{ + let tmp1=($1 & 255) + let tmp2=($1>>8) + let tmp2=($tmp2&255) + let tmp3=($1>>16) + let tmp3=($tmp3&255) + let tmp4=($1>>24) + let tmp4=($tmp4&255) + out_byte $tmp1 + out_byte $tmp2 + out_byte $tmp3 + out_byte $tmp4 +} +function write_short() +{ + let tmp1=($1>>8) + let tmp2=($1&0xff) + out_byte $tmp2 + out_byte $tmp1 +} + +function write_header() +{ + # write signature + echo -n "BOOTSPL1" + # write text x coordinate + write_short $1 + # write text y coordinate + write_short $2 + # write text width + write_short $3 + # write text height + write_short $4 + # write file length + write_int $5 +} + +source $config +size=`wc -c<$image` +write_header $tx $ty $tw $th $size >> $initrd_file +cat $image >> $initrd_file
\ No newline at end of file |