]> git.pld-linux.org Git - packages/bootsplash.git/blob - bootsplash.script
- added init script for activating bootsplash on other consoles
[packages/bootsplash.git] / bootsplash.script
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
37 [ -f /etc/sysconfig/bootsplash ] && . /etc/sysconfig/bootsplash
38
39 _procsplash=$(cat /proc/splash 2> /dev/null)
40
41 if [ -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
44 fi
45     
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
52 cat /proc/cmdline | grep -v -q "splash=silent" && exit 0 
53
54 if [ "$previous" == "3" -o "$previous" == "5" ] ; then
55   if [ "$runlevel"  = "3" -o "$runlevel" == "5" ] ; then
56     exit 0
57   fi
58 fi
59
60 # acquire data
61
62 num=$(( $sscripts + 2 ))
63 _shutdown="no"
64 _silent="no"
65 cat /proc/splash | grep -q silent && _silent="yes"
66 [ "$runlevel" == "6" -o "$runlevel" == "0" ] && _shutdown="yes"
67 [ "$_shutdown" == "yes" ] && num=$(( $kscripts + 2 ))
68
69 function box() { true; } # ignore box descriptions in the config file
70
71 if [ -f "/etc/bootsplash/themes/$THEME/config/bootsplash-`/bin/fbresolution`.cfg" ]; then
72   . /etc/bootsplash/themes/$THEME/config/bootsplash-`/bin/fbresolution`.cfg
73 fi
74   
75 # Print text string. (Booting/Shutting down the system. Press
76 # F2 for verbose mode)
77 #
78
79 if [ "$progress" == 1 -o "$1" == "splash start" ]; then
80   [ "$_shutdown" == "yes" ] && ( echo "silent" > /proc/splash ; chvt 1)
81   _boot=$BOOT_TXT
82   [ "$_shutdown" == "yes" ] && _boot=$SHUTDOWN_TXT
83
84   if [ "$text_x" != "" -a "$text_y" != "" \
85        -a "$text_color" != "" -a "$text_size" != "" -a "$_silent" == "yes" ]; 
86   then
87     fbtruetype -x $text_x -y $text_y -t $text_color -s $text_size "$_boot"
88   fi
89 fi
90
91 # Now paint the progressbar. This is done via the proc 
92 # interface of the bootsplash.
93
94 echo "show $(( 65534 * ( $progress + 1 ) / $num ))" > /proc/splash
95
This page took 0.089194 seconds and 3 git commands to generate.