2 # /etc/rc.d/functions.d/fbsplash-basic.sh #
4 # Basic Fbsplash script for Arch Linux initscripts #
6 # Author: Kurt J. Bosch <kjb-temp-2009 at alpenjodel.de> #
7 # Based on the work of Greg Helton <gt at fallendusk.org> #
8 # Thomas Baechler <thomas at archlinux.org> #
11 # Distributed under the terms of the GNU General Public License (GPL) #
13 [[ $PREVLEVEL && $RUNLEVEL ]] ||
return 0
15 # Do nothing if advanced script is installed
16 [[ -r /etc
/rc.d
/functions.d
/fbsplash-extras.sh
]] && return
18 # Only do this where needed
19 # Since we use BASH, all important functions and variables are exported
20 case ${0#/etc/rc.} in sysinit | multi | shutdown
)
21 # splash-functions.sh will run splash_setup which needs /proc
22 # code line copied from /etc/rc.sysinit
23 /bin
/mountpoint
-q /proc ||
/bin
/mount
-n -t proc proc
/proc
-o nosuid
,noexec
,nodev
24 export SPLASH_PUSH_MESSAGES SPLASH_VERBOSE_ON_ERRORS
25 .
/sbin
/splash-functions.sh
# /etc/conf.d/splash is also sourced by this
26 unset options opt i
# eliminate splash_setup non local vars ## FIX ME ##
27 SPLASH_STEPS
=3 # sysinit steps
31 # Verbose mode is handled by fbcondecor kernel patch and daemon script
32 [[ $SPLASH_MODE_REQ = silent
]] ||
return 0
34 # Override - Don't try to use /usr/bin/basename
36 [[ $
( /bin
/pidof
-o %PPID
$spl_daemon ) ]] && echo "$@" >$spl_fifo &
39 case $0 in /etc
/rc.sysinit
)
40 # Prevent splash destruction
42 # Continue to use a splash daamon started in initcpio
43 if /bin
/mountpoint
-q /run
/.splash-cache
; then
44 /bin
/mount
--move /run
/.splash-cache
$spl_cachedir ||
return
45 splash_comm_send
set message
"$SPLASH_BOOT_MESSAGE"
48 ( splash_cache_prep
) ||
return
50 add_hook sysinit_udevsettled splash_sysinit_udevsettled
51 add_hook sysinit_postfsck splash_sysinit_postfsck
52 add_hook sysinit_postfsckloop splash_sysinit_postfsck
53 add_hook sysinit_premount splash_sysinit_premount
54 add_hook sysinit_end splash_sysinit_end
55 splash_sysinit_udevsettled
() {
60 splash_sysinit_premount
() {
63 splash_sysinit_postfsck
() { # fsck failure emergency exit
64 (( fsckret
> 1 && fsckret
!= 32 )) && chvt
1
66 splash_sysinit_end
() {
70 add_hook multi_start splash_multi_start
71 add_hook multi_end splash_multi_end
72 splash_multi_start
() {
73 SPLASH_STEPS_DONE
=$SPLASH_STEPS
77 [[ $1 = $SPLASH_XSERVICE ]] && SPLASH_EXIT_TYPE
=staysilent splash_stop
82 [[ $1 = $SPLASH_XSERVICE ]] && SPLASH_EXIT_TYPE
=staysilent splash_stop
83 stat_bkgd
"Starting $1"
84 ( SPLASH_PUSH_MESSAGES
="no" SPLASH_VERBOSE_ON_ERRORS
="no" \
85 /etc
/rc.d
/$1 start
) &>/dev
/null
&
88 if [[ $PREVLEVEL = N
]]; then
89 if ! in_array
"$SPLASH_XSERVICE" "${DAEMONS[@]}"; then
90 if [[ $RUNLEVEL = 5 ]]; then
91 SPLASH_EXIT_TYPE
=staysilent splash_stop
94 [[ $
( $spl_bindir/fgconsole
) = $SPLASH_TTY ]] && chvt
1
103 ;; /etc
/rc.shutdown
)
104 ( splash_cache_prep
) ||
return
105 # Not using XSERVICE here to avoid missing errors - X should chvt back to SPLASH_TTY
106 add_hook shutdown_start splash_shutdown_start
107 add_hook shutdown_prekillall splash_shutdown_prekillall
108 add_hook shutdown_postkillall splash_shutdown_postkillall
109 add_hook shutdown_poweroff splash_shutdown_poweroff
110 splash_shutdown_start
() {
113 splash_shutdown_prekillall
() {
114 splash_comm_send progress $
(( 65535*1/3 )); splash_comm_send paint
115 [[ -r $spl_pidfile ]] && add_omit_pids $
( <$spl_pidfile )
117 splash_shutdown_postkillall
() {
118 splash_comm_send progress $
(( 65535*2/3 )); splash_comm_send paint
120 splash_shutdown_poweroff
() {
121 SPLASH_EXIT_TYPE
=staysilent splash_stop
125 splash_progress_init
() {
126 for daemon
in "${DAEMONS[@]}"; do
127 case $daemon in $SPLASH_XSERVICE | @
$SPLASH_XSERVICE ) break
128 ;; \
!* |@
* ) continue
135 splash_comm_send progress $
(( 65535*++SPLASH_STEPS_DONE
/SPLASH_STEPS
))
136 splash_comm_send paint
139 # Start the splash daemon - using upstream function
141 if ! [[ $
( /bin
/pidof
-o %PPID
$spl_daemon ) ]]; then
142 stat_busy
"Starting Fbsplash daemon"
143 if [ -x /etc
/splash
/$SPLASH_THEME/scripts
/rc_init-pre
]; then
144 /etc
/splash
/$SPLASH_THEME/scripts
/rc_init-pre
${0#/etc/rc.d} $RUNLEVEL
147 stat_done || stat_fail
151 # Stop the splash daemon - if any
153 if [[ $
( /bin
/pidof
-o %PPID
$spl_daemon ) ]]; then
154 SPLASH_PUSH_MESSAGES
="no" stat_busy
"Stopping Fbsplash daemon"
155 splash_comm_send progress
65535; splash_comm_send paint
; /bin
/sleep .1
156 splash_comm_send
exit $SPLASH_EXIT_TYPE
157 # Wait for painting/fadeout
159 while [[ i
++ -lt 100 && $
( /bin
/pidof
-o %PPID
$spl_daemon ) ]]; do
167 printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} "
168 printf "${SAVE_POSITION}"
170 printf " ${C_OTHER}[${C_BUSY}BUSY${C_OTHER}]${C_CLEAR} "
172 if [[ $SPLASH_PUSH_MESSAGES = yes ]]; then
173 splash_comm_send
set message
"${1}"
174 splash_comm_send paint
180 printf " ${C_OTHER}[${C_FAIL}FAIL${C_OTHER}]${C_CLEAR} \n"
181 local event
=stop_failed
; [[ $PREVLEVEL = N
]] && event
=start_failed
182 # Provide a general failure status event and write to msglog textbox
183 splash_comm_send update_svc fbsplash-dummy svc_
${event}
184 splash_comm_send log
"Error $SPLASH_BUSY_MSG"
185 splash_comm_send paint
186 # Save for daemon restart ## FIX ME ##
187 if /bin
/mountpoint
-q $spl_cachedir; then
188 : >|
$spl_cachedir/${event}-fbsplash-dummy
190 # Upstream way of error handling
191 if [[ $SPLASH_VERBOSE_ON_ERRORS = yes ]]; then