diff options
-rw-r--r-- | scripts/splash.sh | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/scripts/splash.sh b/scripts/splash.sh index ad13f2a..775c173 100644 --- a/scripts/splash.sh +++ b/scripts/splash.sh @@ -38,6 +38,20 @@ gprintf() { [ "${1#*\\n}" ] || TEXT="$TEXT\n" } +bootsplash_run() { + [ "$splash_mode" = "bootsplash" ] && /sbin/splash $* +} + +bootsplash_write() { + [ "$splash_mode" = "bootsplash" ] && echo $* > /proc/splash +} + +update_progress() { + if [ "$splash_mode" = "bootsplash" ]; then + bootsplash_write "show $(( 65534 * ( $progress + 1 ) / $num ))" + fi +} + # assertions test -r /proc/splash || exit 0 @@ -63,13 +77,13 @@ grep -q silent /proc/cmdline && grep -q silent /proc/splash && _silent="yes" test "$runlevel" == "6" -o "$runlevel" == "0" && _shutdown="yes" if [ "$1" == "verbose" ]; then - echo 'verbose' > /proc/splash + bootsplash_write 'verbose' fi if [ "$1" == "stop" -a $_shutdown == "no" ]; then if [[ $LOGO_CONSOLE == No ]] || [[ $LOGO_CONSOLE == no ]] || [[ $LOGO_CONSOLE == NO ]]; then if [[ -e /proc/splash ]];then - echo 0 > /proc/splash + bootsplash_write 0 exit 0 fi else @@ -77,7 +91,7 @@ if [ "$1" == "stop" -a $_shutdown == "no" ]; then for i in 0 1 2 3 4 5 do if [[ -f /etc/bootsplash/themes/$theme/config/vt$i-$res.cfg ]]; then - /sbin/splash -s -u $i /etc/bootsplash/themes/$theme/config/vt$i-$res.cfg + bootsplash_run -s -u $i /etc/bootsplash/themes/$theme/config/vt$i-$res.cfg fi done fi @@ -198,19 +212,19 @@ if [ "$progress" == 1 -o "$1" == "start" -o "$1" == "suspend" ]; then if test "$_shutdown" == "yes"; then gprintf "Shutting down the system..." - [[ -f /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg ]] && /sbin/splash -s -u 0 /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg - echo "silent" >/proc/splash + [[ -f /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg ]] && bootsplash_run -s -u 0 /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg + bootsplash_write "silent" chvt 1 elif [ "$1" == "suspend" ]; then gprintf "Suspending the system..." - [[ -f /etc/bootsplash/themes/$theme/config/hibernate-$res.cfg ]] && /sbin/splash -s -u 0 /etc/bootsplash/themes/$theme/config/hibernate-$res.cfg - echo "silent" >/proc/splash + [[ -f /etc/bootsplash/themes/$theme/config/hibernate-$res.cfg ]] && bootsplash_run -s -u 0 /etc/bootsplash/themes/$theme/config/hibernate-$res.cfg + bootsplash_write "silent" chvt 1 else if [ "$font" != "default" -a "$progress" != "1" -a -d /usr/share/bootsplash -a "$_silent" == "yes" ]; then if [[ -f /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg ]]; then - /sbin/splash -s -u 0 /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg - echo "show $(( 65534 * ( $progress + 1 ) / $num ))" > /proc/splash + bootsplash_run -s -u 0 /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg + update_progress fi fi gprintf "Booting the system..." @@ -226,4 +240,4 @@ fi # Paint progressbar.. test -z "$progress_enable" && exit 0 -echo "show $(( 65534 * ( $progress + 1 ) / $num ))" > /proc/splash +update_progress |