Contents of /trunk/busybox/splash-functions.rc
Parent Directory | Revision Log
Revision 1744 -
(show annotations)
(download)
Thu Apr 19 15:13:51 2012 UTC (12 years, 5 months ago) by niro
File size: 3530 byte(s)
Thu Apr 19 15:13:51 2012 UTC (12 years, 5 months ago) by niro
File size: 3530 byte(s)
-added more flicker fixups, needs a patched busybox fbsplash with the 'image:' cmd enabled
1 | # /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 | local cmd |
9 | local args |
10 | |
11 | # check for a framebuffer console first! |
12 | [[ ! -e /dev/fb0 ]] && return 0 |
13 | # proc must be mounted too |
14 | [[ ! -e /proc/cmdline ]] && return 0 |
15 | # only run fbsplash if theme was found |
16 | [[ ! -e ${SPLASH_THEMES}/${SPLASH_THEME} ]] && return |
17 | # and run only if a config for the current resolution exist |
18 | [[ ! -e ${SPLASH_THEMES}/${SPLASH_THEME}/$(splash_resolution).conf ]] && return |
19 | |
20 | # create fifo if not exist |
21 | if [[ ! -w ${SPLASH_FIFO} ]] |
22 | then |
23 | mkfifo ${SPLASH_FIFO} |
24 | fi |
25 | |
26 | # check cmdline for config_opts |
27 | # splash=silent,theme:mcore |
28 | for cmd in $(< /proc/cmdline) |
29 | do |
30 | case "${cmd}" in |
31 | splash=*) |
32 | # split the cmd and put everything into an array |
33 | args=( $(echo "${cmd}" | sed 's:[,\:=]:\ :g') ) |
34 | # mode is always args[1] |
35 | SPLASH_MODE="${args[1]}" |
36 | # theme is always args[3] |
37 | SPLASH_THEME="${args[3]}" |
38 | ;; |
39 | esac |
40 | done |
41 | |
42 | case $1 in |
43 | rc_init) rc_init ;; |
44 | rc_verbose|rc_exit) rc_exit ;; |
45 | # redraw splash image and text |
46 | svc_started) |
47 | if [[ ${runlevel} = boot ]] || [[ ${runlevel} = sysinit ]] |
48 | then |
49 | splash_control "image:" |
50 | splash_control "write:${SPLASH_BOOT_MESSAGE}" |
51 | fi |
52 | ;; |
53 | svc_stopped) |
54 | if [[ ${runlevel} = shutdown ]] |
55 | then |
56 | splash_control "image:" |
57 | splash_control "write:${SPLASH_SHUTDOWN_MESSAGE}" |
58 | fi |
59 | if [[ ${runlevel} = reboot ]] |
60 | then |
61 | splash_control "image:" |
62 | splash_control "write:${SPLASH_REBOOT_MESSAGE}" |
63 | fi |
64 | ;; |
65 | esac |
66 | } |
67 | |
68 | rc_init() |
69 | { |
70 | if [[ ${SPLASH_MODE} = silent ]] |
71 | then |
72 | local resolution="$(splash_resolution)" |
73 | |
74 | splash_cursor disable |
75 | chvt ${SPLASH_TTY} |
76 | sleep 0.5 |
77 | |
78 | if [[ ${runlevel} = boot ]] || [[ ${runlevel} = sysinit ]] |
79 | then |
80 | fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ |
81 | -s ${SPLASH_THEMES}/${SPLASH_THEME}/startup-${resolution}.ppm.gz \ |
82 | -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ |
83 | -f ${SPLASH_FIFO} \ |
84 | ${SPLASH_OPTS} & |
85 | |
86 | wait_for_fbsplash |
87 | splash_control "write:${SPLASH_BOOT_MESSAGE}" |
88 | fi |
89 | |
90 | if [[ ${runlevel} = shutdown ]] |
91 | then |
92 | fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ |
93 | -s ${SPLASH_THEMES}/${SPLASH_THEME}/shutdown-${resolution}.ppm.gz \ |
94 | -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ |
95 | -f ${SPLASH_FIFO} \ |
96 | ${SPLASH_OPTS} & |
97 | |
98 | wait_for_fbsplash |
99 | splash_control "write:${SPLASH_SHUTDOWN_MESSAGE}" |
100 | fi |
101 | |
102 | if [[ ${runlevel} = reboot ]] |
103 | then |
104 | fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ |
105 | -s ${SPLASH_THEMES}/${SPLASH_THEME}/reboot-${resolution}.ppm.gz \ |
106 | -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ |
107 | -f ${SPLASH_FIFO} \ |
108 | ${SPLASH_OPTS} & |
109 | |
110 | wait_for_fbsplash |
111 | splash_control "write:${SPLASH_REBOOT_MESSAGE}" |
112 | fi |
113 | fi |
114 | } |
115 | |
116 | rc_exit() |
117 | { |
118 | if [[ ${SPLASH_MODE} = silent ]] |
119 | then |
120 | splash_control "exit" |
121 | splash_cursor enable |
122 | if [[ -n ${SPLASH_X11_TTY} ]] |
123 | then |
124 | chvt ${SPLASH_X11_TTY} |
125 | else |
126 | chvt 1 |
127 | fi |
128 | fi |
129 | } |
130 | |
131 | splash_resolution() |
132 | { |
133 | fbres |
134 | } |
135 | |
136 | wait_for_fbsplash() |
137 | { |
138 | while [[ -z $(pidof fbsplash) ]] |
139 | do |
140 | sleep 0.1 |
141 | done |
142 | } |
143 | |
144 | splash_control() |
145 | { |
146 | # only write to fifo if the fbsplash process is runnning |
147 | # or the console will hang |
148 | if [[ -n $(pidof fbsplash) ]] |
149 | then |
150 | echo "$@" > ${SPLASH_FIFO} |
151 | else |
152 | # exit here |
153 | splash_cursor enable |
154 | chvt 1 |
155 | fi |
156 | } |
157 | |
158 | # disable|enable |
159 | splash_cursor() |
160 | { |
161 | case $1 in |
162 | enable) echo -e "\e[?0c";; |
163 | disable) echo -e "\e[?1c" ;; |
164 | esac |
165 | } |