Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/busybox/splash-funtions.rc revision 1264 by niro, Fri Jan 28 19:08:48 2011 UTC trunk/busybox/splash-functions.rc revision 1838 by niro, Fri Jul 13 09:54:26 2012 UTC
# Line 5  Line 5 
5    
6  splash()  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   case $1 in
43   rc_init) rc_init ;;   rc_init) rc_init ;;
44   rc_verbose|rc_exit) rc_exit ;;   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   esac
66  }  }
67    
# Line 17  rc_init() Line 71  rc_init()
71   then   then
72   local resolution="$(splash_resolution)"   local resolution="$(splash_resolution)"
73    
  splash_cursor disable  
74   chvt ${SPLASH_TTY}   chvt ${SPLASH_TTY}
75     sleep 0.5
76    
77   if [[ $runlevel = boot ]] || [[ ${runlevel} = sysinit ]]   if [[ ${runlevel} = boot ]] || [[ ${runlevel} = sysinit ]]
78   then   then
79   fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \   fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \
80   -s ${SPLASH_THEMES}/${SPLASH_THEME}/startup-${resolution}.ppm.gz \   -s ${SPLASH_THEMES}/${SPLASH_THEME}/startup-${resolution}.ppm.gz \
# Line 28  rc_init() Line 82  rc_init()
82   -f ${SPLASH_FIFO} \   -f ${SPLASH_FIFO} \
83   ${SPLASH_OPTS} &   ${SPLASH_OPTS} &
84    
85     wait_for_fbsplash
86   splash_control "write:${SPLASH_BOOT_MESSAGE}"   splash_control "write:${SPLASH_BOOT_MESSAGE}"
87   fi   fi
88    
# Line 39  rc_init() Line 94  rc_init()
94   -f ${SPLASH_FIFO} \   -f ${SPLASH_FIFO} \
95   ${SPLASH_OPTS} &   ${SPLASH_OPTS} &
96    
97     wait_for_fbsplash
98   splash_control "write:${SPLASH_SHUTDOWN_MESSAGE}"   splash_control "write:${SPLASH_SHUTDOWN_MESSAGE}"
99   fi   fi
100    
101   if [[ $runlevel = reboot ]]   if [[ ${runlevel} = reboot ]]
102   then   then
103   fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \   fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \
104   -s ${SPLASH_THEMES}/${SPLASH_THEME}/reboot-${resolution}.ppm.gz \   -s ${SPLASH_THEMES}/${SPLASH_THEME}/reboot-${resolution}.ppm.gz \
# Line 50  rc_init() Line 106  rc_init()
106   -f ${SPLASH_FIFO} \   -f ${SPLASH_FIFO} \
107   ${SPLASH_OPTS} &   ${SPLASH_OPTS} &
108    
109     wait_for_fbsplash
110   splash_control "write:${SPLASH_REBOOT_MESSAGE}"   splash_control "write:${SPLASH_REBOOT_MESSAGE}"
111   fi   fi
112   fi   fi
# Line 60  rc_exit() Line 117  rc_exit()
117   if [[ ${SPLASH_MODE} = silent ]]   if [[ ${SPLASH_MODE} = silent ]]
118   then   then
119   splash_control "exit"   splash_control "exit"
120   splash_cursor enable   if [[ -n ${SPLASH_X11_TTY} ]]
121   chvt 1   then
122     chvt ${SPLASH_X11_TTY}
123     else
124     chvt 1
125     fi
126   fi   fi
127  }  }
128    
# Line 70  splash_resolution() Line 131  splash_resolution()
131   fbres   fbres
132  }  }
133    
134    wait_for_fbsplash()
135    {
136     while [[ -z $(pidof fbsplash) ]]
137     do
138     sleep 0.1
139     done
140    }
141    
142  splash_control()  splash_control()
143  {  {
144   # only write to fifo if the fbsplash process is runnning   # only write to fifo if the fbsplash process is runnning
# Line 79  splash_control() Line 148  splash_control()
148   echo "$@" > ${SPLASH_FIFO}   echo "$@" > ${SPLASH_FIFO}
149   fi   fi
150  }  }
   
 # disable|enable  
 splash_cursor()  
 {  
  case $1 in  
  enable) echo -e "\e[?0c";;  
  disable) echo -e "\e[?1c" ;;  
  esac  
 }  

Legend:
Removed from v.1264  
changed lines
  Added in v.1838