--- trunk/splashutils-magellan/splash-functions 2005/03/04 18:09:01 5 +++ trunk/splashutils-magellan/splash-functions 2005/03/04 21:02:46 9 @@ -1,39 +1,102 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /root/magellan-cvs/src/splashutils-magellan/splash-functions,v 1.1 2005-03-04 18:09:01 niro Exp $ +# $Header: /root/magellan-cvs/src/splashutils-magellan/splash-functions,v 1.2 2005-03-04 21:02:42 niro Exp $ # Author: Michal Januszewski # Maintainer: Michal Januszewski # This is file is a part of splashutils. -# TODO: add drop-to-verbose-on-error - # This is the main function that handles all events. # Accepted parameters: # svc_start # svc_stop # svc_started # svc_stopped +# svc_input_begin +# svc_input_end # rc_init - used to distinguish between 'boot' and 'sysinit' # rc_exit # critical splash() { - case "$1" in - svc_start) ;; - svc_stop) ;; + local event="$1" + splash_setup + + if [ -x "/etc/splash/${SPLASH_THEME}/scripts/${event}-pre" ]; then + /etc/splash/${SPLASH_THEME}/scripts/${event}-pre "$2" "$3" + fi + + case "$event" in + svc_start) splash_svc_start "$2";; + svc_stop) splash_svc_stop "$2";; svc_started) splash_svc "$2" "$3" "start";; svc_stopped) splash_svc "$2" "$3" "stop";; + svc_input_begin) splash_input_begin "$2";; + svc_input_end) splash_input_end "$2";; rc_init) splash_init "$2";; rc_exit) splash_exit;; critical) /sbin/splash "verbose";; esac - + + if [ -x "/etc/splash/${SPLASH_THEME}/scripts/${event}-post" ]; then + /etc/splash/${SPLASH_THEME}/scripts/${event}-post "$2" "$3" + fi + return 0 } +splash_setup() +{ + # if it's already setup, let's not waste time on parsing the config files again + if [ "${SPLASH_THEME}" != "" ]; then + return 0 + fi + + export SPLASH_THEME="default" + + if [ -f /etc/conf.d/splash ]; then + . /etc/conf.d/splash + fi + + if [ -f /proc/cmdline ]; then + # kernel command line override for the splash theme + for param in `grep "theme:" /proc/cmdline`; do + t=${param%:*} + if [ "${t#*,}" == "theme" ]; then + SPLASH_THEME="${param#*:}" + fi + done + else + echo "PROC NOT MOUNTED!!!" + fi +} + +splash_svc_start() +{ + local svc="$1" + + splash_load_vars + SPL_SVC_START="${SPL_SVC_START}${svc} " + SPL_SVC_INACTIVE_START="${SPL_SVC_INACTIVE_START// $svc / }" + splash_save_vars + + /sbin/splash "$svc" +} + +splash_svc_stop() +{ + local svc="$1" + + splash_load_vars + SPL_SVC_STOP="${SPL_SVC_STOP}${svc} " + SPL_SVC_INACTIVE_STOP="${SPL_SVC_INACTIVE_STOP// $svc / }" + splash_save_vars + + /sbin/splash "$svc" +} + splash_init() { arg="$1"