Annotation of /trunk/busybox/splash-functions.rc
Parent Directory | Revision Log
Revision 1275 -
(hide annotations)
(download)
Fri Feb 4 21:30:04 2011 UTC (13 years, 8 months ago) by niro
File size: 2174 byte(s)
Fri Feb 4 21:30:04 2011 UTC (13 years, 8 months ago) by niro
File size: 2174 byte(s)
- only run fbsplash, if the theme was found - added wait_for_splash() functions and wait until fbsplash is running, better approach then guessing sleep timings out of the blue - enable the console cursor and chvt 1 if splash_contol fails
1 | niro | 1264 | # /etc/rc.d/init.d/splash-functions - splashfunctions for busybox' fbsplash with tykef patch |
2 | # $Id$ | ||
3 | |||
4 | [[ -f /etc/splash/splash.conf ]] && . /etc/splash/splash.conf | ||
5 | |||
6 | splash() | ||
7 | { | ||
8 | niro | 1275 | # only run fbsplash if theme was found |
9 | [[ ! -e ${SPLASH_THEMES}/${SPLASH_THEME} ]] && return | ||
10 | |||
11 | niro | 1264 | case $1 in |
12 | rc_init) rc_init ;; | ||
13 | rc_verbose|rc_exit) rc_exit ;; | ||
14 | esac | ||
15 | } | ||
16 | |||
17 | rc_init() | ||
18 | { | ||
19 | if [[ ${SPLASH_MODE} = silent ]] | ||
20 | then | ||
21 | local resolution="$(splash_resolution)" | ||
22 | |||
23 | splash_cursor disable | ||
24 | chvt ${SPLASH_TTY} | ||
25 | |||
26 | if [[ $runlevel = boot ]] || [[ ${runlevel} = sysinit ]] | ||
27 | then | ||
28 | fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ | ||
29 | -s ${SPLASH_THEMES}/${SPLASH_THEME}/startup-${resolution}.ppm.gz \ | ||
30 | -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ | ||
31 | -f ${SPLASH_FIFO} \ | ||
32 | ${SPLASH_OPTS} & | ||
33 | |||
34 | niro | 1275 | wait_for_fbsplash |
35 | niro | 1264 | splash_control "write:${SPLASH_BOOT_MESSAGE}" |
36 | fi | ||
37 | |||
38 | if [[ ${runlevel} = shutdown ]] | ||
39 | then | ||
40 | fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ | ||
41 | -s ${SPLASH_THEMES}/${SPLASH_THEME}/shutdown-${resolution}.ppm.gz \ | ||
42 | -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ | ||
43 | -f ${SPLASH_FIFO} \ | ||
44 | ${SPLASH_OPTS} & | ||
45 | |||
46 | niro | 1275 | wait_for_fbsplash |
47 | niro | 1264 | splash_control "write:${SPLASH_SHUTDOWN_MESSAGE}" |
48 | fi | ||
49 | |||
50 | if [[ $runlevel = reboot ]] | ||
51 | then | ||
52 | fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ | ||
53 | -s ${SPLASH_THEMES}/${SPLASH_THEME}/reboot-${resolution}.ppm.gz \ | ||
54 | -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ | ||
55 | -f ${SPLASH_FIFO} \ | ||
56 | ${SPLASH_OPTS} & | ||
57 | |||
58 | niro | 1275 | wait_for_fbsplash |
59 | niro | 1264 | splash_control "write:${SPLASH_REBOOT_MESSAGE}" |
60 | fi | ||
61 | fi | ||
62 | } | ||
63 | |||
64 | rc_exit() | ||
65 | { | ||
66 | if [[ ${SPLASH_MODE} = silent ]] | ||
67 | then | ||
68 | splash_control "exit" | ||
69 | splash_cursor enable | ||
70 | chvt 1 | ||
71 | fi | ||
72 | } | ||
73 | |||
74 | splash_resolution() | ||
75 | { | ||
76 | fbres | ||
77 | } | ||
78 | |||
79 | niro | 1275 | wait_for_fbsplash() |
80 | { | ||
81 | while [[ -z $(pidof fbsplash) ]] | ||
82 | do | ||
83 | sleep 0.1 | ||
84 | done | ||
85 | } | ||
86 | |||
87 | niro | 1264 | splash_control() |
88 | { | ||
89 | # only write to fifo if the fbsplash process is runnning | ||
90 | # or the console will hang | ||
91 | if [[ -n $(pidof fbsplash) ]] | ||
92 | then | ||
93 | echo "$@" > ${SPLASH_FIFO} | ||
94 | niro | 1275 | else |
95 | # exit here | ||
96 | splash_cursor enable | ||
97 | chvt 1 | ||
98 | niro | 1264 | fi |
99 | } | ||
100 | |||
101 | # disable|enable | ||
102 | splash_cursor() | ||
103 | { | ||
104 | case $1 in | ||
105 | enable) echo -e "\e[?0c";; | ||
106 | disable) echo -e "\e[?1c" ;; | ||
107 | esac | ||
108 | } |