1 |
# Copyright 1999-2004 Gentoo Foundation |
# Copyright 1999-2004 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /root/magellan-cvs/src/splashutils-magellan/splash-functions,v 1.1 2005-03-04 18:09:01 niro Exp $ |
# $Header: /root/magellan-cvs/src/splashutils-magellan/splash-functions,v 1.2 2005-03-04 21:02:42 niro Exp $ |
4 |
|
|
5 |
# Author: Michal Januszewski <spock@gentoo.org> |
# Author: Michal Januszewski <spock@gentoo.org> |
6 |
# Maintainer: Michal Januszewski <spock@gentoo.org> |
# Maintainer: Michal Januszewski <spock@gentoo.org> |
7 |
|
|
8 |
# This is file is a part of splashutils. |
# This is file is a part of splashutils. |
9 |
|
|
|
# TODO: add drop-to-verbose-on-error |
|
|
|
|
10 |
# This is the main function that handles all events. |
# This is the main function that handles all events. |
11 |
# Accepted parameters: |
# Accepted parameters: |
12 |
# svc_start <name> |
# svc_start <name> |
13 |
# svc_stop <name> |
# svc_stop <name> |
14 |
# svc_started <name> <errcode> |
# svc_started <name> <errcode> |
15 |
# svc_stopped <name> <errcode> |
# svc_stopped <name> <errcode> |
16 |
|
# svc_input_begin <name> |
17 |
|
# svc_input_end <name> |
18 |
# rc_init <internal_runlevel> - used to distinguish between 'boot' and 'sysinit' |
# rc_init <internal_runlevel> - used to distinguish between 'boot' and 'sysinit' |
19 |
# rc_exit |
# rc_exit |
20 |
# critical |
# critical |
21 |
|
|
22 |
splash() |
splash() |
23 |
{ |
{ |
24 |
case "$1" in |
local event="$1" |
25 |
svc_start) ;; |
splash_setup |
26 |
svc_stop) ;; |
|
27 |
|
if [ -x "/etc/splash/${SPLASH_THEME}/scripts/${event}-pre" ]; then |
28 |
|
/etc/splash/${SPLASH_THEME}/scripts/${event}-pre "$2" "$3" |
29 |
|
fi |
30 |
|
|
31 |
|
case "$event" in |
32 |
|
svc_start) splash_svc_start "$2";; |
33 |
|
svc_stop) splash_svc_stop "$2";; |
34 |
svc_started) splash_svc "$2" "$3" "start";; |
svc_started) splash_svc "$2" "$3" "start";; |
35 |
svc_stopped) splash_svc "$2" "$3" "stop";; |
svc_stopped) splash_svc "$2" "$3" "stop";; |
36 |
|
svc_input_begin) splash_input_begin "$2";; |
37 |
|
svc_input_end) splash_input_end "$2";; |
38 |
rc_init) splash_init "$2";; |
rc_init) splash_init "$2";; |
39 |
rc_exit) splash_exit;; |
rc_exit) splash_exit;; |
40 |
critical) /sbin/splash "verbose";; |
critical) /sbin/splash "verbose";; |
41 |
esac |
esac |
42 |
|
|
43 |
|
if [ -x "/etc/splash/${SPLASH_THEME}/scripts/${event}-post" ]; then |
44 |
|
/etc/splash/${SPLASH_THEME}/scripts/${event}-post "$2" "$3" |
45 |
|
fi |
46 |
|
|
47 |
return 0 |
return 0 |
48 |
} |
} |
49 |
|
|
50 |
|
splash_setup() |
51 |
|
{ |
52 |
|
# if it's already setup, let's not waste time on parsing the config files again |
53 |
|
if [ "${SPLASH_THEME}" != "" ]; then |
54 |
|
return 0 |
55 |
|
fi |
56 |
|
|
57 |
|
export SPLASH_THEME="default" |
58 |
|
|
59 |
|
if [ -f /etc/conf.d/splash ]; then |
60 |
|
. /etc/conf.d/splash |
61 |
|
fi |
62 |
|
|
63 |
|
if [ -f /proc/cmdline ]; then |
64 |
|
# kernel command line override for the splash theme |
65 |
|
for param in `grep "theme:" /proc/cmdline`; do |
66 |
|
t=${param%:*} |
67 |
|
if [ "${t#*,}" == "theme" ]; then |
68 |
|
SPLASH_THEME="${param#*:}" |
69 |
|
fi |
70 |
|
done |
71 |
|
else |
72 |
|
echo "PROC NOT MOUNTED!!!" |
73 |
|
fi |
74 |
|
} |
75 |
|
|
76 |
|
splash_svc_start() |
77 |
|
{ |
78 |
|
local svc="$1" |
79 |
|
|
80 |
|
splash_load_vars |
81 |
|
SPL_SVC_START="${SPL_SVC_START}${svc} " |
82 |
|
SPL_SVC_INACTIVE_START="${SPL_SVC_INACTIVE_START// $svc / }" |
83 |
|
splash_save_vars |
84 |
|
|
85 |
|
/sbin/splash "$svc" |
86 |
|
} |
87 |
|
|
88 |
|
splash_svc_stop() |
89 |
|
{ |
90 |
|
local svc="$1" |
91 |
|
|
92 |
|
splash_load_vars |
93 |
|
SPL_SVC_STOP="${SPL_SVC_STOP}${svc} " |
94 |
|
SPL_SVC_INACTIVE_STOP="${SPL_SVC_INACTIVE_STOP// $svc / }" |
95 |
|
splash_save_vars |
96 |
|
|
97 |
|
/sbin/splash "$svc" |
98 |
|
} |
99 |
|
|
100 |
splash_init() |
splash_init() |
101 |
{ |
{ |
102 |
arg="$1" |
arg="$1" |