# /etc/rc.splash # vim: syntax=sh # # Initialize splashy progressbar variables and # define the splashy boot script functions. # # Copyright 2008 Johannes Engel # using the original from openSUSE 10.3 for bootsplash # and THEME detection from splashy package by Holger Macht # SPLASH=yes SPLASHLOG="/var/log/susesplash.log" DUMMY=$(cat /etc/splashy/config.xml) THEME=$(echo $DUMMY | /usr/bin/perl -p -e 's///g;s/^.*//;s/<\/current_theme>.*$//;') export SPLASH RC_SPLASH test -x /usr/sbin/splashy -a -x /usr/sbin/splashy_update|| SPLASH=no test -n "$THEME" -a -d "/etc/splashy/themes/$THEME" || SPLASH=no case "$PREVLEVEL-$RUNLEVEL" in [2-5]-[2-5]) SPLASH=no esac if test "$SPLASH" = "yes" ; then if test "$1" = "B" ; then SPLASHSTART=100 SPLASHEND=20000 for i in /etc/init.d/boot.d/S[0-9][0-9]*; do test -x "$i" || continue : $((SPLASHNUM++)) done unset i else SPLASHSTART=0 SPLASHEND=65535 case "$PREVLEVEL-$RUNLEVEL" in N-[3-5]) SPLASHSTART=20000 ;; esac for i in /etc/init.d/rc${RUNLEVEL}.d/S[0-9][0-9]*; do test -x "$i" || continue : $((SPLASHNUM++)) done for i in /etc/init.d/rc${PREVLEVEL}.d/K[0-9][0-9]*; do test -x "$i" || continue : $((SPLASHNUM++)) done unset i fi # Progress is equal to start in the beginning SPLASHPROGRESS=$SPLASHSTART # rc.splash is called from rc.status for every service # So make sure SPLASHNUM has got a reasonable value # even when we are not booting or shutting down # i.e. splash screen is not invoked function splashtrigger () { case "$1" in rlreached*) [ "$2" = "B" ] || /usr/sbin/splashy_update exit 2> $SPLASHLOG # don't stop if RL B is reached return # do not start splashy if we are finishing # splashy makes kbd service fail # so we restart this service after disabling splashy # /etc/init.d/kbd restart ;; esac case "$RUNLEVEL" in 0|6) pidof splashy || /usr/sbin/splashy shutdown 2> $SPLASHLOG ;; *) pidof splashy || /usr/sbin/splashy boot 2> $SPLASHLOG ;; esac } function splashprogress () { local SPLASHDIFF local SPLASHPERCENT [ -n "$SPLASHNUM" -a "$SPLASHNUM" -ge 1 ] || SPLASHNUM=1 SPLASHDIFF=$(((SPLASHEND - SPLASHPROGRESS)/SPLASHNUM)) SPLASHPROGRESS=$((SPLASHPROGRESS+SPLASHDIFF)) SPLASHPERCENT=$((100*SPLASHPROGRESS/(SPLASHEND-SPLASHSTART))) # [ -n "$(pidof Xorg)" -o -n "$(pidof X)" -o -n "$(pidof Xgl)" ] && xrunning=TRUE || xrunning=FALSE; if [ -n "$(pidof splashy)" ]; then # splashy running, Xorg not running # if [ $xrunning ]; then # /usr/sbin/splashy_update exit 2> $SPLASHLOG # else /usr/sbin/splashy_update "progress $SPLASHPERCENT" 2> $SPLASHLOG /usr/sbin/splashy_update "print $1" 2> $SPLASHLOG # fi fi : $((SPLASHNUM--)) } function splashparallel () { local SPLASHDIFF local SPLASHOLDPROGRESS=$SPLASHPROGRESS for i; do test "$SPLASHNUM" -ge 1 || SPLASHNUM=1 SPLASHDIFF=$(((SPLASHEND-SPLASHPROGRESS)/SPLASHNUM)) SPLASHPROGRESS=$((SPLASHPROGRESS+SPLASHDIFF)) : $((SPLASHNUM--)) done SPLASHDIFF=$((SPLASHPROGRESS-SPLASHOLDPROGRESS)) echo "-S $SPLASHOLDSTART:$SPLASHDIFF" } function splashmake () { local SPLASHDIFF=$((SPLASHEND-SPLASHPROGRESS)) echo "-S $SPLASHSTART:$SPLASHDIFF" SPLASHPROGRESS=$SPLASHEND SPLASHNUM=0 } else function splashtrigger () { :; } function splashprogress () { :; } function splashparallel () { echo ""; } function splashmake () { echo ""; } fi