Annotation of /trunk/busybox/splash-functions.rc
Parent Directory | Revision Log
Revision 1277 -
(hide annotations)
(download)
Fri Feb 4 21:34:23 2011 UTC (13 years, 7 months ago) by niro
File size: 2264 byte(s)
Fri Feb 4 21:34:23 2011 UTC (13 years, 7 months ago) by niro
File size: 2264 byte(s)
- added a small hack to suppress screen flickers when starting X
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 | niro | 1276 | sleep 0.5 |
26 | niro | 1264 | |
27 | if [[ $runlevel = boot ]] || [[ ${runlevel} = sysinit ]] | ||
28 | then | ||
29 | fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ | ||
30 | -s ${SPLASH_THEMES}/${SPLASH_THEME}/startup-${resolution}.ppm.gz \ | ||
31 | -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ | ||
32 | -f ${SPLASH_FIFO} \ | ||
33 | ${SPLASH_OPTS} & | ||
34 | |||
35 | niro | 1275 | wait_for_fbsplash |
36 | niro | 1264 | splash_control "write:${SPLASH_BOOT_MESSAGE}" |
37 | fi | ||
38 | |||
39 | if [[ ${runlevel} = shutdown ]] | ||
40 | then | ||
41 | fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ | ||
42 | -s ${SPLASH_THEMES}/${SPLASH_THEME}/shutdown-${resolution}.ppm.gz \ | ||
43 | -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ | ||
44 | -f ${SPLASH_FIFO} \ | ||
45 | ${SPLASH_OPTS} & | ||
46 | |||
47 | niro | 1275 | wait_for_fbsplash |
48 | niro | 1264 | splash_control "write:${SPLASH_SHUTDOWN_MESSAGE}" |
49 | fi | ||
50 | |||
51 | if [[ $runlevel = reboot ]] | ||
52 | then | ||
53 | fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ | ||
54 | -s ${SPLASH_THEMES}/${SPLASH_THEME}/reboot-${resolution}.ppm.gz \ | ||
55 | -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ | ||
56 | -f ${SPLASH_FIFO} \ | ||
57 | ${SPLASH_OPTS} & | ||
58 | |||
59 | niro | 1275 | wait_for_fbsplash |
60 | niro | 1264 | splash_control "write:${SPLASH_REBOOT_MESSAGE}" |
61 | fi | ||
62 | fi | ||
63 | } | ||
64 | |||
65 | rc_exit() | ||
66 | { | ||
67 | if [[ ${SPLASH_MODE} = silent ]] | ||
68 | then | ||
69 | splash_control "exit" | ||
70 | splash_cursor enable | ||
71 | niro | 1277 | if [[ -n ${SPLASH_X11_TTY} ]] |
72 | then | ||
73 | chvt ${SPLASH_X11_TTY} | ||
74 | else | ||
75 | chvt 1 | ||
76 | fi | ||
77 | niro | 1264 | fi |
78 | } | ||
79 | |||
80 | splash_resolution() | ||
81 | { | ||
82 | fbres | ||
83 | } | ||
84 | |||
85 | niro | 1275 | wait_for_fbsplash() |
86 | { | ||
87 | while [[ -z $(pidof fbsplash) ]] | ||
88 | do | ||
89 | sleep 0.1 | ||
90 | done | ||
91 | } | ||
92 | |||
93 | niro | 1264 | splash_control() |
94 | { | ||
95 | # only write to fifo if the fbsplash process is runnning | ||
96 | # or the console will hang | ||
97 | if [[ -n $(pidof fbsplash) ]] | ||
98 | then | ||
99 | echo "$@" > ${SPLASH_FIFO} | ||
100 | niro | 1275 | else |
101 | # exit here | ||
102 | splash_cursor enable | ||
103 | chvt 1 | ||
104 | niro | 1264 | fi |
105 | } | ||
106 | |||
107 | # disable|enable | ||
108 | splash_cursor() | ||
109 | { | ||
110 | case $1 in | ||
111 | enable) echo -e "\e[?0c";; | ||
112 | disable) echo -e "\e[?1c" ;; | ||
113 | esac | ||
114 | } |