aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmou@mandriva.com>2002-02-12 14:13:06 +0000
committerChmouel Boudjnah <chmou@mandriva.com>2002-02-12 14:13:06 +0000
commit9405c435837a9fe5861b1f1a59bd2885f2eb09ff (patch)
tree791e894186a68d33f276ae53f7b2450c1ef1fa18
parent6201e31d08db60ff343b05038ae62008e7ed2f81 (diff)
downloadbootsplash-9405c435837a9fe5861b1f1a59bd2885f2eb09ff.tar
bootsplash-9405c435837a9fe5861b1f1a59bd2885f2eb09ff.tar.gz
bootsplash-9405c435837a9fe5861b1f1a59bd2885f2eb09ff.tar.bz2
bootsplash-9405c435837a9fe5861b1f1a59bd2885f2eb09ff.tar.xz
bootsplash-9405c435837a9fe5861b1f1a59bd2885f2eb09ff.zip
Add switch themes script, add support for lilo themes
-rwxr-xr-xscripts/make-boot-splash4
-rwxr-xr-xscripts/switch-themes152
-rw-r--r--themes/Ayo/lilo/messagebin0 -> 139684 bytes
-rw-r--r--themes/Mandrake/lilo/messagebin0 -> 46856 bytes
4 files changed, 155 insertions, 1 deletions
diff --git a/scripts/make-boot-splash b/scripts/make-boot-splash
index e524606..bdbeca7 100755
--- a/scripts/make-boot-splash
+++ b/scripts/make-boot-splash
@@ -92,4 +92,6 @@ function write_header()
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
+cat $image >> $initrd_file
+
+$splash_dir/scripts/switch-themes -u
diff --git a/scripts/switch-themes b/scripts/switch-themes
new file mode 100755
index 0000000..dea6997
--- /dev/null
+++ b/scripts/switch-themes
@@ -0,0 +1,152 @@
+#!/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$
+
+bootsplashdir=/usr/share/bootsplash
+sysconfig=/etc/sysconfig/bootsplash
+bootdir=/boot
+
+function list_available_themes () {
+ local basename=
+ for i in $bootsplashdir/themes/*;do
+ basename=${i##*/}
+ echo $basename
+ done
+}
+
+function get_current_theme () {
+ local opt= theme=
+ while read opt ;do
+ [[ $opt != THEME=* ]] && continue
+ theme=${opt##*=}
+ done < $sysconfig
+ [[ -z $theme ]] && theme="Mandrake"
+ echo $theme
+}
+
+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
+ if [[ ! -e $bootdir/lilo ]];then
+ return;
+ fi
+
+ #Make sure to point on lilo-graphic
+ if [[ -L $bootdir/lilo ]];then
+ point_to=$(read_link $bootdir/lilo)
+ if [[ $point_to != lilo-graphic ]];then
+ rm -f $bootdir/lilo
+ ln -s lilo-graphic $bootdir/lilo
+ fi
+ fi
+
+ if ! cmp -s $message_from_theme $message_from_current;then
+ cp -f $message_from_theme $message_from_current
+ fi
+
+}
+
+function check_it () {
+ local theme=$1
+ local ok= c=
+
+ for c in $(list_available_themes);do
+ [[ $c == $theme ]] && ok=yes
+ done
+ if [[ -z $ok ]];then
+ echo -e "Themes $theme doen't exist\n";
+ bash $0 -l
+ exit;
+ fi
+}
+
+function update () {
+ local theme=$1;
+ lilo_switch_themes $theme
+}
+
+function switch_theme () {
+ local toswitch=$1
+ local current_theme=$(get_current_theme)
+ local ok= c=
+
+ #Seeding
+ if [[ $current_theme != $toswitch ]];then
+ ok=
+ tmpfile=$(mktemp /tmp/.bootsplash.XXXXXXX)
+ cp -f $sysconfig $tmpfile && rm -f $sysconfig
+ while read line;do
+ if [[ $line == THEME=* ]];then
+ echo "THEME=$toswitch" >> $sysconfig
+ ok=yes
+ continue;
+ fi
+ echo $line >> $sysconfig
+ done < $tmpfile
+ if [[ -z $ok ]];then
+ echo "THEME=$toswitch" >> $sysconfig
+ fi
+ rm -f $tmpfile
+ fi
+}
+
+function usage () {
+ basename=`basename $0`
+ cat <<EOF
+ $basename OPTIONS THEMES
+
+OPTIONS:
+ -c: Tell you the current themes
+ -l: List themes available.
+ -u: Update current theme.
+EOF
+ exit 1
+}
+
+update=
+while getopts uhlc opt;do
+ case "$opt" in
+ u)
+ update=yes ;;
+ c)
+ echo -n "The current theme is: ";get_current_theme; exit;;
+ l)
+ echo "Available themes are :"
+ for i in $(list_available_themes);do echo -e "\t\t\t$i";done;
+ exit;
+ ;;
+ h) usage;;
+ *) usage;;
+ esac
+done
+shift $((OPTIND - 1))
+
+theme=$1
+
+if [[ -n $update ]];then
+ if [[ -n $theme ]];then
+ echo "No argument when updating";
+ echo
+ usage
+ fi
+ update $(get_current_theme)
+ exit;
+fi
+
+[[ -z $theme ]] && usage;
+
+check_it $theme
+switch_theme $theme
diff --git a/themes/Ayo/lilo/message b/themes/Ayo/lilo/message
new file mode 100644
index 0000000..9be93bc
--- /dev/null
+++ b/themes/Ayo/lilo/message
Binary files differ
diff --git a/themes/Mandrake/lilo/message b/themes/Mandrake/lilo/message
new file mode 100644
index 0000000..d41bf9a
--- /dev/null
+++ b/themes/Mandrake/lilo/message
Binary files differ