]> git.pld-linux.org Git - packages/bootsplash.git/blame - bootsplash.script
- new
[packages/bootsplash.git] / bootsplash.script
CommitLineData
cb5570c3
AM
1#!/bin/bash
2#
3# splash.sh - This shell script triggers bootsplash actions during
4# system boot/shutdown. It can be run by the init scripts repeatedly
5# specifying the currently executed system script.
6#
7# This script is used to play animations/sounds/show text/move the
8# progress bar, etc.
9#
10# We call this function from /etc/rc.status:rc_splash()
11#
12# This program is free software; you may redistribute it under
13# the terms of the GNU General Public License. This program has
14# absolutely no warranty.
15#
16# written 2002-2003 Stefan Reinauer, <stepan@suse.de>
17#
18# this script expects the following environment variables for an operable
19# progress bar:
20#
21# sscripts = number of start scripts to be executed for runlevel change
22# kscripts = number of stop scripts to be executed for runlevel change
23# progress = number of currently executed start/stop script
24# RUNLEVEL = runlevel to be reached.
25#
26# To play animations, it's advised that you have an animations.cfg in your
27# theme's config directory specifying the initscript name for an event and
28# the command to be executed:
29#
30# fsck start:bootanim start bounce.mng
31# master:bootanim stop
32#
33# See http://www.bootsplash.org/ for more information.
34#
35# Modified for PLD (arekm@pld-linux.org)
36
e873dd7c 37[ -f /etc/sysconfig/bootsplash ] && . /etc/sysconfig/bootsplash
cb5570c3
AM
38
39_procsplash=$(cat /proc/splash 2> /dev/null)
40
7fbae5e8
AM
41if [ -f /etc/bootsplash/themes/$THEME/config/animations.cfg ]; then
42 COMMAND="$(cat /etc/bootsplash/themes/$THEME/config/animations.cfg | grep "^$1"| cut -f2 -d\:)"
43 eval $COMMAND
44fi
45
cb5570c3
AM
46# assertions
47[ -e /proc/splash ] || exit 0
48[ -z "$progress" -a -z "$num" ] && exit 0
49[ -z "$(echo $_procsplash | grep on)" ] && exit 0
50
51# We chose verbose in grub
52cat /proc/cmdline | grep -v -q "splash=silent" && exit 0
53
54if [ "$previous" == "3" -o "$previous" == "5" ] ; then
55 if [ "$runlevel" = "3" -o "$runlevel" == "5" ] ; then
56 exit 0
57 fi
58fi
59
60# acquire data
61#
62num=$(( $sscripts + 2 ))
63_shutdown="no"
64_silent="no"
65cat /proc/splash | grep -q silent && _silent="yes"
66[ "$runlevel" == "6" -o "$runlevel" == "0" ] && _shutdown="yes"
67[ "$_shutdown" == "yes" ] && num=$(( $kscripts + 2 ))
68
7fbae5e8 69if [ -f "/etc/bootsplash/themes/$THEME/config/bootsplash-`/bin/fbresolution`.cfg" ]; then
b5a99659 70 . /etc/bootsplash/themes/$THEME/config/bootsplash-`/bin/fbresolution`.cfg 2> /dev/null
7fbae5e8
AM
71fi
72
cb5570c3
AM
73# Print text string. (Booting/Shutting down the system. Press
74# F2 for verbose mode)
75#
76
77if [ "$progress" == 1 -o "$1" == "splash start" ]; then
78 [ "$_shutdown" == "yes" ] && ( echo "silent" > /proc/splash ; chvt 1)
e873dd7c 79 _boot=$BOOT_TXT
80 [ "$_shutdown" == "yes" ] && _boot=$SHUTDOWN_TXT
cb5570c3
AM
81
82 if [ "$text_x" != "" -a "$text_y" != "" \
83 -a "$text_color" != "" -a "$text_size" != "" -a "$_silent" == "yes" ];
84 then
e873dd7c 85 fbtruetype -x $text_x -y $text_y -t $text_color -s $text_size "$_boot"
cb5570c3
AM
86 fi
87fi
88
89# Now paint the progressbar. This is done via the proc
90# interface of the bootsplash.
91
92echo "show $(( 65534 * ( $progress + 1 ) / $num ))" > /proc/splash
93
This page took 0.108419 seconds and 4 git commands to generate.