Magellan Linux

Annotation of /trunk/busybox/splash-functions.rc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1276 - (hide annotations) (download)
Fri Feb 4 21:31:22 2011 UTC (13 years, 2 months ago) by niro
File size: 2186 byte(s)
- wait a little bit, to give chvt a chance changing the vts
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     chvt 1
72     fi
73     }
74    
75     splash_resolution()
76     {
77     fbres
78     }
79    
80 niro 1275 wait_for_fbsplash()
81     {
82     while [[ -z $(pidof fbsplash) ]]
83     do
84     sleep 0.1
85     done
86     }
87    
88 niro 1264 splash_control()
89     {
90     # only write to fifo if the fbsplash process is runnning
91     # or the console will hang
92     if [[ -n $(pidof fbsplash) ]]
93     then
94     echo "$@" > ${SPLASH_FIFO}
95 niro 1275 else
96     # exit here
97     splash_cursor enable
98     chvt 1
99 niro 1264 fi
100     }
101    
102     # disable|enable
103     splash_cursor()
104     {
105     case $1 in
106     enable) echo -e "\e[?0c";;
107     disable) echo -e "\e[?1c" ;;
108     esac
109     }