aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/splash.sh
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2003-08-12 08:22:43 +0000
committerFlorent Villard <warly@mandriva.com>2003-08-12 08:22:43 +0000
commit5606f67a26f876bc83e3928a41e7919d9aea2ca8 (patch)
treebcbffafd8ab4884e363da50c0f8b32751b886ae0 /scripts/splash.sh
parent0bfd2d68ceaa132a57abc8dec8b67edc8e7e37ed (diff)
downloadbootsplash-5606f67a26f876bc83e3928a41e7919d9aea2ca8.tar
bootsplash-5606f67a26f876bc83e3928a41e7919d9aea2ca8.tar.gz
bootsplash-5606f67a26f876bc83e3928a41e7919d9aea2ca8.tar.bz2
bootsplash-5606f67a26f876bc83e3928a41e7919d9aea2ca8.tar.xz
bootsplash-5606f67a26f876bc83e3928a41e7919d9aea2ca8.zip
add fbmngplay and fbtruetype
Diffstat (limited to 'scripts/splash.sh')
-rw-r--r--scripts/splash.sh116
1 files changed, 116 insertions, 0 deletions
diff --git a/scripts/splash.sh b/scripts/splash.sh
new file mode 100644
index 0000000..a8a6f0f
--- /dev/null
+++ b/scripts/splash.sh
@@ -0,0 +1,116 @@
+#!/bin/bash
+#
+# splash.sh - script to paint progress bar during
+# system startup/shutdown. This script is solely run
+# by the init scripts (shell function rc_splash)
+#
+# (w) 2002-2003 Stefan Reinauer, <stepan@suse.de>
+# 2003 Florent Villard, <warly@mandrakesoft.com>
+# It's licensed under GPL, of course.
+#
+# this script expects the following environment variables:
+# nbservices = number of start/stop scripts to be executed for runlevel change
+# progress = number of currently executed start/stop script
+# runlevel = runlevel to be reached.
+
+_procsplash="`cat /proc/splash 2>/dev/null`"
+TEXTDOMAIN=bootsplash
+TEXTDOMAINDIR=/etc/locale
+LOCPATH=/etc/locale
+
+# execute splash binary utility because we are a wrapper:
+if [ "$1" == "-s" -o "$1" == "-u" -o "$1" == "-n" -o "$1" == "-f" ]; then
+ exec /sbin/splash $*
+else
+ ( exec /sbin/splash "$*" )
+fi
+
+gprintf() {
+ if [ -x /bin/gettext -a -n "$1" ]; then
+ if [ -n "$GP_LANG" ]; then
+ TEXT=`LC_MESSAGES=$GP_LANG gettext -e --domain=$TEXTDOMAIN "$1"`
+ else
+ TEXT=`gettext -e --domain=$TEXTDOMAIN "$1"`
+ fi
+ else
+ TEXT=$1
+ fi
+ [ "${1#*\\n}" ] || TEXT="$TEXT\n"
+}
+
+# assertions
+test -r /proc/splash || exit 0
+test -z "`echo $_procsplash|grep on`" && exit 0
+
+if [[ -z $res ]]; then
+ res=`fbresolution`
+ if [[ -f /etc/sysconfig/bootsplash ]]; then
+ . /etc/sysconfig/bootsplash
+ theme=$THEME
+ if [[ -f /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg ]]; then
+ function box() { true; }
+ . /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg
+ fi
+ fi
+fi
+
+_shutdown="no"
+_silent="no"
+grep -q silent /proc/cmdline && _silent="yes"
+test "$runlevel" == "6" -o "$runlevel" == "0" && _shutdown="yes"
+
+if [ "$1" == "stop" -a $_shutdown == "no" ]; then
+ if [[ $LOGO_CONSOLE == No ]] || [[ $LOGO_CONSOLE == no ]] || [[ $LOGO_CONSOLE == NO ]]; then
+ if [[ -e /proc/splash ]];then
+ echo 0 > /proc/splash
+ exit 0
+ fi
+ else
+ if [[ $LOGO_CONSOLE == vt ]]; then
+ for i in 0 1 2 3 4 5
+ do
+ if [[ -f /etc/bootsplash/themes/$theme/config/vt$i-$res.cfg ]]; then
+ splash -s -u $i /etc/bootsplash/themes/$theme/config/vt$i-$res.cfg
+ fi
+ done
+ fi
+ fi
+fi
+
+test -z "$progress" -a -z "$nbservices" && exit 0
+grep -vq "splash=silent" /proc/cmdline && exit 0
+
+if [ "$previous" == "3" -o "$previous" == "5" ] ; then
+ if [ "$runlevel" = "3" -o "$runlevel" == "5" ] ; then
+ exit 0
+ fi
+fi
+
+# acquire data
+#
+num=$(( $nbservices + 2 ))
+
+# Initialize and print text string..
+if [ "$progress" == 1 -o "$1" == "start" ]; then
+ if test "$_shutdown" == "yes"; then
+ gprintf "Shutting down the system..."
+ [[ -f /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg ]] && /sbin/splash -s -u 0 /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg
+ echo "silent" >/proc/splash
+ chvt 1
+ else
+ gprintf "Booting the system..."
+ fi
+ _boot=$TEXT
+ if [ "$text_x" != "" -a "$text_y" != "" \
+ -a "$text_color" != "" -a "$text_size" != "" -a "$_silent" == "yes" ]; then
+ gprintf "Press F2 for verbose mode."
+ fbtruetype.static -x $text_x -y $text_y -t $text_color -s $text_size \
+ "$_boot $TEXT"
+ fi
+fi
+
+# Paint progressbar..
+test -z "$progress_enable" && exit 0
+echo "show $(( 65534 * ( $progress + 1 ) / $num ))" > /proc/splash
+
+