]>
Commit | Line | Data |
---|---|---|
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 | ||
37 | [ -f /etc/sysconfig/system ] && . /etc/sysconfig/system | |
38 | ||
39 | _procsplash=$(cat /proc/splash 2> /dev/null) | |
40 | ||
41 | # assertions | |
42 | [ -e /proc/splash ] || exit 0 | |
43 | [ -z "$progress" -a -z "$num" ] && exit 0 | |
44 | [ -z "$(echo $_procsplash | grep on)" ] && exit 0 | |
45 | ||
46 | # We chose verbose in grub | |
47 | cat /proc/cmdline | grep -v -q "splash=silent" && exit 0 | |
48 | ||
49 | if [ "$previous" == "3" -o "$previous" == "5" ] ; then | |
50 | if [ "$runlevel" = "3" -o "$runlevel" == "5" ] ; then | |
51 | exit 0 | |
52 | fi | |
53 | fi | |
54 | ||
55 | # acquire data | |
56 | # | |
57 | num=$(( $sscripts + 2 )) | |
58 | _shutdown="no" | |
59 | _silent="no" | |
60 | cat /proc/splash | grep -q silent && _silent="yes" | |
61 | [ "$runlevel" == "6" -o "$runlevel" == "0" ] && _shutdown="yes" | |
62 | [ "$_shutdown" == "yes" ] && num=$(( $kscripts + 2 )) | |
63 | ||
64 | # Print text string. (Booting/Shutting down the system. Press | |
65 | # F2 for verbose mode) | |
66 | # | |
67 | ||
68 | if [ "$progress" == 1 -o "$1" == "splash start" ]; then | |
69 | [ "$_shutdown" == "yes" ] && ( echo "silent" > /proc/splash ; chvt 1) | |
70 | _boot="Booting" | |
71 | [ "$_shutdown" == "yes" ] && _boot="Shutting down" | |
72 | ||
73 | if [ "$text_x" != "" -a "$text_y" != "" \ | |
74 | -a "$text_color" != "" -a "$text_size" != "" -a "$_silent" == "yes" ]; | |
75 | then | |
76 | fbtruetype -x $text_x -y $text_y -t $text_color -s $text_size \ | |
77 | "$_boot the system... Press F2 for verbose mode" | |
78 | fi | |
79 | fi | |
80 | ||
81 | # Now paint the progressbar. This is done via the proc | |
82 | # interface of the bootsplash. | |
83 | ||
84 | echo "show $(( 65534 * ( $progress + 1 ) / $num ))" > /proc/splash | |
85 |