LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 06-07-2006, 11:01 PM   #1
gringer
LQ Newbie
 
Registered: Nov 2005
Posts: 21

Rep: Reputation: 0
Lightbulb [solved] getting bootsplash progress bar working with recent sysv-rc scripts (2.86+)


I'm posting this as a guide to my progress along finding a way to get bootsplash to work with sysv-rc (version on my computer is 2.86.ds1-14.1). Hopefully it can be of some use to others wanting to do a similar thing.

From the looks of things, sysv-rc was changed to shift a lot of the functionality from /etc/init.d/rcS to /etc/init.d/rc. The bootsplash sysv-rc patches from http://debian.bootsplash.de/ seem to have a lot more in /etc/init.d/rcS, which causes all the hunks to fail.

I have noticed that /etc/init.d/rc appears to have some support for usplash (the ubuntu userspace splash screen package), and suspect that modifying this slightly for bootsplash should be fairly straightforward. Here's the usplash related stuff in that file:
Code:
        # Count the number of scripts we need to run (for usplash progress bar)
        num_steps=0
        for s in /etc/rc$runlevel.d/S*; do
                num_steps=$(($num_steps + 1))
                case "${s##/etc/rc$runlevel.d/S??}" in
                  gdm|xdm|kdm)
                        break
                        ;;
                esac
        done
...
                # Use 50% of the progress bar for rcS and the rest for the
                # runlevel we want to end up in
                step=$(($step + $step_change))
                progress=$(($step * $progress_size / $num_steps + $first_step))
                if type usplash_write >/dev/null 2>&1; then
                        usplash_write "PROGRESS $progress" || true
                fi
And here's the rc_splash related lines from http://www.bootsplash.org:
Code:
function rc_splash()
{
  test "$SPLASH" != "no" && test "$_rc_splash" -eq 1 && /sbin/splash "$1"
  progress=$(( $progress + 1 ))
}
when adding the rc_splash call to your runlevel script scheduler, do it
about like this:
for i in $runrc/S${rex}*; do
[..]
# send information to bootsplash handler.
rc_splash "$i start"
[..]
done
I'll post a few more times to indicate my progress towards trying to find a way to integrate bootsplash with these scripts.

Last edited by gringer; 06-10-2006 at 11:34 AM.
 
Old 06-08-2006, 05:40 AM   #2
gringer
LQ Newbie
 
Registered: Nov 2005
Posts: 21

Original Poster
Rep: Reputation: 0
manually applying sysv-rc-bootsplash scripts

This is the diff file that results from a somewhat naive attempt at patching /etc/init.d/rc with the patch file from /usr/share/sysv-rc-bootsplash/rc-bootsplash.patch (i.e. the patch that failed on the attempted install of the package):

Code:
--- rc.old      2006-06-07 22:35:03.000000000 +1200
+++ rc  2006-06-08 21:23:22.000000000 +1200
@@ -140,6 +140,8 @@
 # Set onlcr to avoid staircase effect.
 stty onlcr 0>&1

+rc_splash "splash start"    # let bootsplash know we are ready
+
 # Now find out what the current and what the previous runlevel are.

 runlevel=$RUNLEVEL
@@ -170,6 +172,51 @@
 . /etc/default/rcS
 export VERBOSE

+# -- start bootsplash stuff --
+
+# source the bootsplash config file
+test -f /etc/default/bootsplash && . /etc/default/bootsplash
+
+#
+# initialize boosplash progressbar variables
+#
+runrcS=/etc/rcS.d
+runrc=/etc/rc2.d  # assume we will boot into runlevel 2
+
+SSC=($(echo $runrcS/S*))
+case "$SSC" in
+    *\*) sscripts=0 ;;
+    *) sscripts=${#SSC[*]} ;;
+esac
+
+SSC=($(echo $runrc/S*))
+case "$SSC" in
+    *\*) sscripts=0 ;;
+    *) sscripts=$((${#SSC[*]} + $sscripts)) ;;
+esac
+
+progress=0
+kscripts=0
+
+export sscripts kscropts progress
+
+#
+# Update bootsplash stuff. (progress bar, animations...)
+#
+rc_splash() {
+   #test "$SPLASH" != "no" && test "$_rc_splash" -eq 1 && /sbin/splash "$1"
+    test "$SPLASH" != "no" && /sbin/splash.sh "$1"
+
+   # make sure we don't add unless we really made progress
+    if [ "$1" != "master" -a "$1" != "splash start" -a "$1" != "shutdown" ]
+        then
+        progress=$(( $progress + 1 ))
+    fi
+}
+
+# -- end bootsplash stuff --
+
+
 # Is there an rc directory for this new runlevel?
 if [ -d /etc/rc$runlevel.d ]
 then
@@ -261,6 +308,8 @@
                for i in /etc/rc$runlevel.d/S$level*
                do
                        [ ! -f $i ] && continue
+
+                        rc_splash "$i start"      # update bootsplash progress bar

                        if [ "$previous" != N ]
                        then
@@ -307,6 +356,7 @@
        then
                /sbin/setup.sh
        fi
+        rc_splash "master"  # stop playing bootsplash animations
 fi

 trap - EXIT # Disable emergency handler
It does update the progress bar, but seems to reset the progress bar after the start of each new runlevel. This is probably related to the reset being placed early in the file.
 
Old 06-08-2006, 10:15 AM   #3
gringer
LQ Newbie
 
Registered: Nov 2005
Posts: 21

Original Poster
Rep: Reputation: 0
smaller diff, uses usplash variables

Okay, here's another diff. This time I've tried to think through what the usplash lines mean, and make bootsplash work with those:

Code:
--- rc.old      2006-06-07 22:35:03.000000000 +1200
+++ rc  2006-06-09 02:09:31.000000000 +1200
@@ -140,6 +140,15 @@
 # Set onlcr to avoid staircase effect.
 stty onlcr 0>&1

+# source the bootsplash config file
+test -f /etc/default/bootsplash && . /etc/default/bootsplash
+rc_splash "splash start"    # let bootsplash know we are ready
+
+# Update bootsplash stuff. (progress bar, animations...)
+rc_splash() {
+    test "$SPLASH" != "no" && /sbin/splash.sh "$1"
+}
+
 # Now find out what the current and what the previous runlevel are.

 runlevel=$RUNLEVEL
@@ -245,6 +254,12 @@
                esac
        done

+        # initialize boosplash progressbar variables
+        progress=0
+        kscripts=0
+        sscripts=$progress_size
+        export sscripts kscripts progress
+
        # Now run the START scripts for this runlevel.
        # Run all scripts with the same level in parallel
        CURLEVEL=""
@@ -289,6 +304,7 @@
                if type usplash_write >/dev/null 2>&1; then
                        usplash_write "PROGRESS $progress" || true
                fi
+                rc_splash "$i start"      # update bootsplash progress bar
        done
 fi

@@ -307,6 +323,7 @@
        then
                /sbin/setup.sh
        fi
+        rc_splash "master"  # stop playing bootsplash animations
 fi

 trap - EXIT # Disable emergency handler
I'm still gettting the progress bar resetting itself halfway through, and I'm not sure if I'm right in assuming $sscripts in bootsplash should be the same as $progress_size when using the usplash progress variables.
 
Old 06-09-2006, 09:23 AM   #4
gringer
LQ Newbie
 
Registered: Nov 2005
Posts: 21

Original Poster
Rep: Reputation: 0
properly working progress bar, startup and shutdown

I had a look at the progress bar for ubuntu 6.06 LTS, and noticed that it seemed to progress on startup and shutdown correctly, so had a look at those scripts to see if anything could be done. The following diff is the result of that:

Code:
--- rc.old      2006-06-07 22:35:03.000000000 +1200
+++ rc  2006-06-10 01:10:45.000000000 +1200
@@ -28,6 +28,20 @@

 umask 022

+# Update bootsplash stuff. (progress bar, animations...)
+rc_splash() {
+    test "$SPLASH" != "no" && /sbin/splash.sh "$1"
+}
+
+update_splash() {
+    step=$(($step + $step_change))
+    progress=$(($step * $progress_size / $num_steps + $first_step))
+    if type usplash_write >/dev/null 2>&1; then
+        usplash_write "PROGRESS $progress" || true
+    fi
+    rc_splash "$i start"      # update bootsplash progress bar
+}
+
 #
 # Start script or program.
 #
@@ -58,6 +72,7 @@
                                $debug "$script" $action
                                ;;
                        esac
+                        update_splash
                done
        }
        ;;
@@ -89,6 +104,7 @@
                                backgrounded=1
                                ;;
                        esac
+                        update_splash
                done
                [ 1 = "$backgrounded" ] && wait
        }
@@ -140,6 +156,10 @@
 # Set onlcr to avoid staircase effect.
 stty onlcr 0>&1

+# source the bootsplash config file
+test -f /etc/default/bootsplash && . /etc/default/bootsplash
+rc_splash "splash start"    # let bootsplash know we are ready
+
 # Now find out what the current and what the previous runlevel are.

 runlevel=$RUNLEVEL
@@ -173,6 +193,56 @@
 # Is there an rc directory for this new runlevel?
 if [ -d /etc/rc$runlevel.d ]
 then
+        # Find out where in the progress bar the initramfs got to.
+        PROGRESS_STATE=0
+        if [ -f /dev/.initramfs/progress_state ]; then
+            . /dev/.initramfs/progress_state
+        fi
+
+        # Split the remaining portion of the progress bar into thirds
+        progress_size=$(((100 - $PROGRESS_STATE) / 3))
+
+
+       case "$runlevel" in
+         0|6)
+               ACTION=stop
+                # count down from 100 and use the whole bar
+               first_step=100
+               progress_size=100
+               step_change=-1
+               ;;
+         S)
+               ACTION=start
+               first_step=$PROGRESS_STATE
+               progress_size=$(($progress_size * 2))
+               step_change=1
+               ;;
+         *)
+               ACTION=start
+                first_step=$(($progress_size * 2 + $PROGRESS_STATE))
+               step_change=1
+               ;;
+       esac
+
+       # Count the number of scripts we need to run (for usplash progress bar)
+       num_steps=0
+       for s in /etc/rc$runlevel.d/[SK]*; do
+               case "${s##/etc/rc$runlevel.d/S??}" in
+                 gdm|xdm|kdm|reboot|halt)
+                       break
+                       ;;
+               esac
+               num_steps=$(($num_steps + 1))
+       done
+        step=0
+
+        # initialize boosplash progressbar variables
+        progress=0
+        kscripts=100
+        sscripts=100
+        export sscripts kscripts progress
+
        # First, run the KILL scripts.
        if [ "$previous" != N ]
        then
@@ -213,38 +283,6 @@
                done
        fi

-       case "$runlevel" in
-         0|6)
-               ACTION=stop
-               first_step=100
-               progress_size=100
-               step_change=-1
-               ;;
-         S)
-               ACTION=start
-               first_step=0
-               progress_size=100
-               step_change=1
-               ;;
-         *)
-               ACTION=start
-               first_step=0
-               progress_size=100
-               step_change=1
-               ;;
-       esac
-
-       # Count the number of scripts we need to run (for usplash progress bar)
-       num_steps=0
-       for s in /etc/rc$runlevel.d/S*; do
-               num_steps=$(($num_steps + 1))
-               case "${s##/etc/rc$runlevel.d/S??}" in
-                 gdm|xdm|kdm)
-                       break
-                       ;;
-               esac
-       done
-
        # Now run the START scripts for this runlevel.
        # Run all scripts with the same level in parallel
        CURLEVEL=""
@@ -282,13 +320,6 @@
                done
                startup $ACTION $SCRIPTS

-               # Use 50% of the progress bar for rcS and the rest for the
-               # runlevel we want to end up in
-               step=$(($step + $step_change))
-               progress=$(($step * $progress_size / $num_steps + $first_step))
-               if type usplash_write >/dev/null 2>&1; then
-                       usplash_write "PROGRESS $progress" || true
-               fi
        done
 fi

@@ -307,6 +338,7 @@
        then
                /sbin/setup.sh
        fi
+        rc_splash "master"  # stop playing bootsplash animations
 fi

 trap - EXIT # Disable emergency handler
The progress bar now moves correctly at startup from start to finish without resetting, getting to the end just before booting into X. In addition, it moves from finish back to start on shutdown, although there's a few delays at the start and end of the progress movement (I suspect these are not all that related to this rc script). This should be all the patching required for /etc/init.d/rc to get the progress bar showing progress correctly. When I looked at the dapper ubuntu scripts, I noticed that there also seemed to be functionality for the initramfs stuff (it checks /dev/.initramfs/progress_state), so I'll explore that next.

Edit: fixed progress delay problems at shutdown

Last edited by gringer; 06-10-2006 at 11:32 AM.
 
Old 06-11-2006, 12:34 AM   #5
gringer
LQ Newbie
 
Registered: Nov 2005
Posts: 21

Original Poster
Rep: Reputation: 0
initramfs-tools patches -- /usr/share/initramfs-tools/scripts/functions

This patch should complete the splash progress. It puts another bit into the initramfs functions to update the progress bar while the ramdisk is going through its paces.

Code:
--- initramfs-tools.old/scripts/functions       2006-06-10 02:01:49.000000000 +1200
+++ initramfs-tools/scripts/functions   2006-06-11 16:25:25.000000000 +1200
@@ -52,6 +52,9 @@
        if [ -x /sbin/usplash_write ]; then
                /sbin/usplash_write "PROGRESS $PROGRESS_STATE"
        fi
+       if [ -w /proc/splash ]; then
+            echo "show $(( $PROGRESS_STATE * 65534 / 100 ))" > /proc/splash
+       fi
 }

 panic()
So, hopefully, there you have it. Patches to two files that enable and update the bootsplash progress bar with recent sysv-rc scripts. This assumes (at a minimum -- there are other requirements) that you have included a repository similar to 'deb http://debian.bootsplash.de/ unstable main' in /etc/apt/sources.list, and have /sbin/splash.sh, /usr/sbin/splash and /usr/share/initramfs-tools/hooks/bootsplash.

Enjoy!

Last edited by gringer; 06-11-2006 at 12:36 AM.
 
Old 06-11-2006, 03:45 AM   #6
powadha
Member
 
Registered: Nov 2003
Location: Zwolle
Distribution: Arch
Posts: 651

Rep: Reputation: 31
Hmm, using splashy keeps you from having to patch the kernel, it just runs in user space.
 
Old 10-19-2006, 07:43 PM   #7
gringer
LQ Newbie
 
Registered: Nov 2005
Posts: 21

Original Poster
Rep: Reputation: 0
And it appears that the more recent unstable Debian builds (as of about October 2006) seem to support an updating splash screen "out of the box" (whatever that means for Debian...).
 
Old 10-19-2006, 09:12 PM   #8
JackieBrown
Member
 
Registered: Dec 2004
Location: San Antonio, TX
Distribution: Debian-AMD64 Sid
Posts: 481

Rep: Reputation: 31
Gringer, you should submit your patch to the bug report for that package.

A lot of users (myself include) would really benefit from this.
 
Old 10-19-2006, 09:33 PM   #9
gringer
LQ Newbie
 
Registered: Nov 2005
Posts: 21

Original Poster
Rep: Reputation: 0
from the looks of the sysv-rc-bootsplash bugs list, it's already been dealt with:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=388745
 
Old 04-28-2007, 01:07 AM   #10
ninjabob7
Member
 
Registered: Nov 2005
Distribution: Ubuntu 9.10 and Slackware 13.1
Posts: 78

Rep: Reputation: 15
Hey... I've been trying to get bootsplash working on Feisty... Will this patch still work, or does it need to be modified?
 
Old 04-28-2007, 05:10 AM   #11
gringer
LQ Newbie
 
Registered: Nov 2005
Posts: 21

Original Poster
Rep: Reputation: 0
The patch is for a Debian system (sid/etch), and the changes that I made were pulled from Ubuntu (dapper), which seemed to work fine for me anyway. If you're trying to do this on Feisty and it doesn't already work, it's very likely that it will need to be modified.
 
  


Reply

Tags
bootsplash, dapper, guide, initramfs, progress, shutdown, startup, usplash


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cp progress bar edwardsiow Linux - General 26 09-04-2011 09:53 AM
Bootsplash - progress bar - not working depi Linux - General 2 08-13-2007 06:26 AM
progress bar in bootsplash cb951303 Slackware 3 05-23-2006 09:04 AM
MDK 10.1: bootsplash progress bar not working fulat2k Mandriva 1 11-04-2004 07:18 PM
bootsplash : progress ykcorse Linux - Software 4 04-02-2004 07:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 08:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration