# /etc/rc.d/init.d/splash-functions - splashfunctions for busybox' fbsplash with tykef patch # $Id$ [[ -f /etc/splash/splash.conf ]] && . /etc/splash/splash.conf splash() { local cmd local args # check for a framebuffer console first! [[ ! -e ${SPLASH_DEV} ]] && return 0 # proc must be mounted too [[ ! -e /proc/cmdline ]] && return 0 # only run fbsplash if theme was found [[ ! -e ${SPLASH_THEMES}/${SPLASH_THEME} ]] && return # and run only if a config for the current resolution exist [[ ! -e ${SPLASH_THEMES}/${SPLASH_THEME}/$(splash_resolution).conf ]] && return # create fifo if not exist if [[ ! -w ${SPLASH_FIFO} ]] then mkfifo ${SPLASH_FIFO} fi # check cmdline for config_opts # splash=silent,theme:mcore for cmd in $(< /proc/cmdline) do case "${cmd}" in splash=*) # split the cmd and put everything into an array args=( $(echo "${cmd}" | sed 's:[,\:=]:\ :g') ) # mode is always args[1] SPLASH_MODE="${args[1]}" # theme is always args[3] SPLASH_THEME="${args[3]}" ;; esac done case $1 in rc_init) rc_init ;; rc_verbose|rc_exit) rc_exit ;; # redraw splash image and text svc_started) if [[ ${runlevel} = boot ]] || [[ ${runlevel} = sysinit ]] then splash_control "image:" splash_control "write:${SPLASH_BOOT_MESSAGE}" fi ;; svc_stopped) if [[ ${runlevel} = shutdown ]] then splash_control "image:" splash_control "write:${SPLASH_SHUTDOWN_MESSAGE}" fi if [[ ${runlevel} = reboot ]] then splash_control "image:" splash_control "write:${SPLASH_REBOOT_MESSAGE}" fi ;; esac } rc_init() { if [[ ${SPLASH_MODE} = silent ]] then local resolution="$(splash_resolution)" chvt ${SPLASH_TTY} sleep 0.5 if [[ ${runlevel} = boot ]] || [[ ${runlevel} = sysinit ]] then fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ -s ${SPLASH_THEMES}/${SPLASH_THEME}/startup-${resolution}.ppm.gz \ -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ -f ${SPLASH_FIFO} \ -d ${SPLASH_DEV} \ ${SPLASH_OPTS} & wait_for_fbsplash splash_control "write:${SPLASH_BOOT_MESSAGE}" fi if [[ ${runlevel} = shutdown ]] then fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ -s ${SPLASH_THEMES}/${SPLASH_THEME}/shutdown-${resolution}.ppm.gz \ -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ -f ${SPLASH_FIFO} \ -d ${SPLASH_DEV} \ ${SPLASH_OPTS} & wait_for_fbsplash splash_control "write:${SPLASH_SHUTDOWN_MESSAGE}" fi if [[ ${runlevel} = reboot ]] then fbsplash -i ${SPLASH_THEMES}/${SPLASH_THEME}/${resolution}.conf \ -s ${SPLASH_THEMES}/${SPLASH_THEME}/reboot-${resolution}.ppm.gz \ -m ${SPLASH_THEMES}/${SPLASH_THEME}/splash-font.gz \ -f ${SPLASH_FIFO} \ -d ${SPLASH_DEV} \ ${SPLASH_OPTS} & wait_for_fbsplash splash_control "write:${SPLASH_REBOOT_MESSAGE}" fi fi } rc_exit() { if [[ ${SPLASH_MODE} = silent ]] then splash_control "exit" if [[ -n ${SPLASH_X11_TTY} ]] then chvt ${SPLASH_X11_TTY} else chvt 1 fi fi } splash_resolution() { fbres } wait_for_fbsplash() { while [[ -z $(pidof fbsplash) ]] do sleep 0.1 done } splash_control() { # only write to fifo if the fbsplash process is runnning # or the console will hang if [[ -n $(pidof fbsplash) ]] then echo "$@" > ${SPLASH_FIFO} fi }