Magellan Linux

Contents of /trunk/splashutils-magellan/splash

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (show annotations) (download)
Fri Mar 4 18:22:17 2005 UTC (19 years, 1 month ago) by niro
File size: 3609 byte(s)
updated to gentoo ver-0.1.4

1 #!/bin/bash
2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 #
5 # splash - a script to handle rc_scripts events and execute appropriate
6 # fbsplash actions; loosely based on bootsplash /sbin/splash
7 #
8 # Author: Michal Januszewski <spock@gentoo.org>
9 #
10 # $Header: /root/magellan-cvs/src/splashutils-magellan/splash,v 1.2 2005-03-04 18:22:17 niro Exp $
11
12 # this is a little hack that we use to avoid a hell lot of error msgs
13 # when sourcing splash configuration files
14 function box() { true; }
15 function icon() { true; }
16 function rect() { true; }
17
18 test -f /etc/conf.d/splash && . /etc/conf.d/splash
19 test -f /etc/conf.d/rc && . /etc/conf.d/rc
20 test -z "${SPLASH_THEME}" && SPLASH_THEME="default"
21 test "$RUNLEVEL" == "6" -o "$RUNLEVEL" == "0" && SHUTDOWN="yes"
22
23 SPLUTIL="/sbin/splash_util.static"
24
25 [ ! -e /proc/fbsplash ] && exit 1
26 [ ! -e /dev/fbsplash ] && exit 1
27 [ ! -x /sbin/fbres ] && exit 1
28 [ ! -x /sbin/splash_util.static ] && exit 1
29
30 # kernel command line override for the splash theme
31 for param in `grep "theme:" /proc/cmdline`; do
32 t=${param%:*}
33 if [ "${t#*,}" == "theme" ]; then
34 SPLASH_THEME="${param#*:}"
35 fi
36 done
37
38 res=$(/sbin/fbres)
39 themefile="/etc/splash/${SPLASH_THEME}/$res.cfg"
40 test -f "${themefile}" && . "${themefile}"
41
42 print_text() {
43 text="Booting the system... Press F2 for verbose mode"
44 [ -n "${SPLASH_BOOT_MESSAGE}" ] && text="${SPLASH_BOOT_MESSAGE}"
45
46 if [ "${SHUTDOWN}" == "yes" ]; then
47 text="Shutting down the system... Press F2 for verbose mode"
48 [ -n "${SPLASH_SHUTDOWN_MESSAGE}" ] && text="${SPLASH_SHUTDOWN_MESSAGE}"
49
50 if [ "${RUNLEVEL}" == "6" ]; then
51 text="Rebooting the system... Press F2 for verbose mode"
52 [ -n "${SPLASH_REBOOT_MESSAGE}" ] && text="${SPLASH_REBOOT_MESSAGE}"
53 fi
54 fi
55
56 if [ -n "$text_x" -a -n "$text_y" -a -n "$text_color" -a -n "$text_size" ]
57 then
58 options="-x $text_x -y $text_y -t $text_color -s $text_size"
59 if [ -n "${SPLASH_FONT}" -a -f "/etc/splash/${SPLASH_FONT}" ]; then
60 options="$options -f \"/etc/splash/${SPLASH_FONT}\""
61 fi
62
63 if [ -n "$text_font" -a -f "/etc/splash/${SPLASH_THEME}/$text_font" ]; then
64 options="$options -f \"/etc/splash/${SPLASH_THEME}/$text_font\""
65 fi
66
67 eval "/sbin/fbtruetype.static $options \"$text\""
68 fi
69 }
70
71 paint_progress() {
72 progress=$(($spl_init + ($spl_count) * ($spl_rate - $spl_init) / $spl_scripts))
73 ${SPLUTIL} --vc=0 --progress=${progress} --theme=${SPLASH_THEME} --mode=s --cmd=paint
74 }
75
76 # Start silent splash on system shutdown/reboot
77 if [ "$1" == "start" ]; then
78
79 if [ -n "`${SPLUTIL} -c getmode 2>/dev/null | grep silent 2>/dev/null`" ] ||
80 [ -n "`grep silent /proc/cmdline 2>/dev/null`" -a "${SHUTDOWN}" = "yes" ] ; then
81
82 if [ -x /usr/bin/chvt ]; then
83 /usr/bin/chvt 1
84 fi
85
86 ${SPLUTIL} -c setmode -m s
87 ${SPLUTIL} -c repaint -m s --theme=${SPLASH_THEME}
88
89 if [ "$?" != 0 ]; then
90 ${SPLUTIL} -c setmode -m v
91 ${SPLUTIL} -c off
92 else
93 ${SPLUTIL} -c on 2>/dev/null
94 print_text
95 fi
96 fi
97
98 elif [ "$1" == "silent" ]; then
99
100 ${SPLUTIL} -c setmode -m s
101 ${SPLUTIL} -c repaint -m s --theme=${SPLASH_THEME}
102
103 if [ "$?" != 0 ]; then
104 ${SPLUTIL} -c setmode -m v
105 ${SPLUTIL} -c off
106 else
107 ${SPLUTIL} -c on 2>/dev/null
108 paint_progress
109 print_text
110 fi
111
112 elif [ "$1" == "verbose" ]; then
113
114 if [ -n "`${SPLUTIL} -c getmode 2>/dev/null | grep silent 2>/dev/null`" ]; then
115 ${SPLUTIL} -c setmode -m v
116 fi
117
118 elif [ "$1" == "text" ]; then
119 if [ -n "`grep \"silent\" /proc/cmdline 2>/dev/null`" ]; then
120 print_text
121 fi
122 else
123 if [ -n "`${SPLUTIL} -c getmode | grep silent`" ]; then
124 paint_progress
125 fi
126 fi
127
128 exit 0

Properties

Name Value
svn:executable *