You are not logged in.

#1 2003-10-13 16:18:03

bolero
Member
Registered: 2003-10-05
Posts: 60

bootsplash trigger events

on the bootsplash webpage it says to

trigger events during bootup

we suggest that you add a function to your init scripts that is called every time an init script is started. This can either be done in the runlevel scripts themselves or by the script/program scheduling it (i.e. /etc/init.d/rc)

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

but where is the archs program scheduling file., as i dont seem to see a /etc/init.d/rc, im tying to get the  Default Linux theme at bootsplashes webpage to work.. i got everything to work except silent mode to display the silent Jpeg and gradient bar

thanks

-bolero

Offline

#2 2003-10-13 17:23:40

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: bootsplash trigger events

bolero,

I don't use bootsplash, so I haven't tested this, but I think it is saying that you can add the function rc_splash() to your init scripts, and then have the function called in the "start" routine for that particular init script.  The alternative method involves a runlevel script scheduler, which I don't think arch uses.

You can define the function in /etc/rc.d/functions so that you don't have to type it into every init script.  Just make sure that you init script has the following (right at the top, just after #!/bin/bash), as this is what allows it to use functions you define within /etc/rc.d/functions

# general config
. /etc/rc.conf
. /etc/rc.d/functions

and add the function rc_spash() in /etc/rc.d/function by entering the following:

function rc_splash()
{
test "$SPLASH" != "no" && test "$_rc_splash" -eq 1 && /sbin/splash "$1"
progress=$(( $progress + 1 ))
} 

Then go to the init script you want to see the progess bar in.  Find the "start" block of code, and just add a line containing just the word "rc_spash"  without the quotes of course.  I am guessing that you would add it as the first line in the start routine, but that is just a guess.

Again, I haven't tested this, but this is how I interpreted their directions.  Let me know how it works.


Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#3 2003-10-13 17:50:03

bolero
Member
Registered: 2003-10-05
Posts: 60

Re: bootsplash trigger events

well i tried that.. i added in the code you said to functions and the ./etc/rc.d conf stuff at the top then add in the splash function code.. then i dunno if this was the right spot to add it but i tried adding in Rc_splash near the top of rc.sysinit
that didnt work.. it loads but no silent jpeg splash screen.. and then it didnt show everything loading.. it just sat there.. and then the login screen came.
so right now i just see the verbose background linux in my consoel while booting
thansk for thje help though!!

-bolero

Offline

#4 2003-10-13 18:22:48

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: bootsplash trigger events

bolero,

I don't think what you did is quite right.  I'll try to explain it a bit better, although I still can't guarantee that this will work, it is just the way that I would do it going by their directions.

**************************************************

1.  Edit /etc/rc.d/functions, and add the following function:

function rc_splash()
{
test "$SPLASH" != "no" && test "$_rc_splash" -eq 1 && /sbin/splash "$1"
progress=$(( $progress + 1 ))
} 

****************************************************

2.  In all the init scripts that you want to contribute to the gradient bar, you must do two things.  Let's use /etc/rc.d/httpd for example:

2a.  First, ensure that near the top of the script, you have the line that sources /etc/rc.d/functions so that the script will know what the rc_splash() function is:

#!/bin/bash

# general config
. /etc/rc.conf
. /etc/rc.d/functions

2b.  Now, let add the rc_splash function to the start routing within /etc/rc.d/httpd:

case "$1" in
  start)
     rc_splash   #THIS IS THE IMPORTANT LINE
     stat_busy "Starting HTTP Daemon"
                if [ "$HTTPD_USE_SSL" = "yes" -o "$HTTPD_USE_SSL" = "YES" ]; then
      /usr/sbin/apachectl startssl &>/dev/null
                else
      /usr/sbin/apachectl start &>/dev/null
                fi
    if [ $? -gt 0 ]; then
      stat_fail
    else
      add_daemon httpd
      stat_done
    fi
    ;;

********************************************************

You must add the rc_spash function into each init script that you want to contibute to the progress of the gradient bar.  You don't need to touch /etc/rc.sysinit at all.

Hope this is more clear, and good luck

PS - there is likely a slicker way of doing this with /etc/rc.sysinit, but as I can't test it first, I don't want to tell you to do anything that will bork your system.


Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#5 2004-04-03 02:50:43

topito
Member
From: Catalonia
Registered: 2004-03-25
Posts: 118
Website

Re: bootsplash trigger events

Hi, I tried that and I got something like: "integer expression expected" any ideas cos I am stuck...

Also, could be possible to add the function into another one just to avoid editing all rc.d files? for example in stat_done:

stat_done() {
        deltext
        echo -e "   $C_OTHER[${C_DONE}DONE$C_OTHER]$C_CLEAR "
        
       # Bootsplash progress
        test "$SPLASH" != "no" && test "$_rc_splash" -eq 1 && /sbin/splash "$1"
        progress=$(( $progress + 1 ))
}

every time stat_done is executed the bootsplash will uptade the progress bar, isn't it?

Thanks  smile

Offline

#6 2004-04-06 16:05:53

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

Two comments++:

1) stat_done() doesn't take an argument, so the /sbin/splash "$1" part better go in stat_busy() - "$1" is supposed to be the text to display.

2) Incrementing $progress isn't going to update the statusbar. You'll need to do something like this:

echo "show $(( 65534 * ( $progress + 1 ) / $num ))" > /proc/splash

Which brings us to what I see as the greatest challange of making the progress bar work - you need to know how many steps the bar will need to grow to full length, that's what $num in the code above represents. This might be calculated by searching for status() and stat_busy() calls in rc.sysinit and rc.local, plus counting the number of enabled items in the DAEMONS list. And btw, you must make sure that vars like $progress and $num are global across all scripts that update the statusbar. I guess what you need to do is export them all the way out to init's environment.

-bogomipz


All of your mips are belong to us!!

Offline

#7 2004-04-12 20:27:52

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

I have now gotten the progress bar to work. After trying a couple different approaches, this is my best shot. In /etc/rc.d/functions I extended stat_busy(), stat_done() and stat_fail() to look like this:

stat_busy() {
  echo -ne "$C_OTHER$PREFIX_REG $C_MAIN$1$C_CLEAR "
  deltext
  echo -ne "   $C_OTHER[${C_BUSY}BUSY$C_OTHER]$C_CLEAR "
  [ "$BOOTSPLASH_PROGRESS" -a "$BOOTSPLASH_DELTA" ] && 
    BOOTSPLASH_PROGRESS=$(($BOOTSPLASH_PROGRESS+$BOOTSPLASH_DELTA))
}

stat_done() {
  deltext
  echo -e "   $C_OTHER[${C_DONE}DONE$C_OTHER]$C_CLEAR "
  [ "$BOOTSPLASH_PROGRESS" -a -w /proc/splash ] && 
    echo "show $BOOTSPLASH_PROGRESS" > /proc/splash
}

stat_fail() {
  deltext
  echo -e "   $C_OTHER[${C_FAIL}FAIL$C_OTHER]$C_CLEAR "
  [ "$BOOTSPLASH_PROGRESS" -a -w /proc/splash ] && 
    echo "show $BOOTSPLASH_PROGRESS" > /proc/splash
}

The idea is that $BOOTSPLASH_PROGRESS holds the current value of the progress bar (which is in the range 0 - 65535) and $BOOTSPLASH_DELTA is the amount to increase the progress counter with on each stat_busy. These values are initialized in rc.sysinit like this:

[ "$BOOTSPLASH_SYSINIT" ] || 
  BOOTSPLASH_SYSINIT=`grep -c -e stat_busy -e status /etc/rc.sysinit`
[ "$BOOTSPLASH_LOCAL" ] || 
  BOOTSPLASH_LOCAL=`grep -c -e stat_busy -e status /etc/rc.local`
BOOTSPLASH_DAEMONS=`echo ${DAEMONS[@]} | sed 's/![^ ]*//g' | wc -w`
BOOTSPLASH_ALL=$(($BOOTSPLASH_SYSINIT+$BOOTSPLASH_LOCAL+$BOOTSPLASH_DAEMONS))
BOOTSPLASH_DELTA=$((65535/$BOOTSPLASH_ALL))
BOOTSPLASH_PROGRESS=$((65535-$BOOTSPLASH_ALL*$BOOTSPLASH_DELTA))

I put this right before the point where local file systems are mounted, because the progress bar can't be updated before /proc is accessible. Another option is to initialize these variables in the beginning of rc.sysinit to make earlier stat_busy calls get counted, but the updates won't be visible before /proc is mounted anyway.

Because there is no way to export these variables from rc.sysinit to init's environment, rc.multi has to calculate them from scratch. Also the loop that starts daemons has to increase the counter because the daemon scripts can't export the new values. My full rc.multi script looks like this:

. /etc/rc.conf
. /etc/rc.d/functions

[ "$BOOTSPLASH_SYSINIT" ] || 
  BOOTSPLASH_SYSINIT=`grep -c -e stat_busy -e status /etc/rc.sysinit`
[ "$BOOTSPLASH_LOCAL" ] || 
  BOOTSPLASH_LOCAL=`grep -c -e stat_busy -e status /etc/rc.local`
BOOTSPLASH_DAEMONS=`echo ${DAEMONS[@]} | sed 's/![^ ]*//g' | wc -w`
BOOTSPLASH_DELTA=$((65535/($BOOTSPLASH_SYSINIT+$BOOTSPLASH_LOCAL+$BOOTSPLASH_DAEMONS)))
BOOTSPLASH_PROGRESS=$((65535-($BOOTSPLASH_LOCAL+$BOOTSPLASH_DAEMONS)*$BOOTSPLASH_DELTA))
export BOOTSPLASH_PROGRESS BOOTSPLASH_DELTA

# Start daemons
for daemon in "${DAEMONS[@]}"; do
  if [[ `echo $daemon | grep '^[^!]' | wc -l` -eq 1 ]]; then
    /etc/rc.d/$daemon start
    BOOTSPLASH_PROGRESS=$(($BOOTSPLASH_PROGRESS+$BOOTSPLASH_DELTA))
  fi
done

if [ -x /etc/rc.local ]; then
  /etc/rc.local
fi

Like I mentioned in my previous post, it's hard to know how many steps the bar is going to need. Especially rc.sysinit is full of conditional stat_busy statements. Therefor I made it possible to specify $BOOTSPLASH_SYSINIT (number of steps in rc.sysinit) in rc.conf. With the current rc.sysinit script this value is calculated as 19, but on my system rc.sysinit only executes 8 of the steps after the point where /proc is mounted.

The code presented here doesn't display text for the different stat_busy calls. I kind of had that working as well, but the texts were written on top of each other (old text wasn't erased) and you had to source the bootsplash-theme to get the text's font and position - it wasn't pretty.

I hope somebody finds this useful, and I might make a bootsplash package that includes the splash utils, an Arch theme and patches for the init scripts.

-bogomipz


All of your mips are belong to us!!

Offline

#8 2004-04-12 21:39:21

topito
Member
From: Catalonia
Registered: 2004-03-25
Posts: 118
Website

Re: bootsplash trigger events

lol, it works!  big_smile

Offline

#9 2004-06-10 18:05:11

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

After the last upgrade of initscripts, I rewrote my bootsplash progress bar routines. This time they work even better because I:
- made /proc mount earlier so it's possible to start updating the bar
- don't recalculate from scratch in rc.multi
- correct errors introduced when stat_busy calls are skipped in rc.sysinit
Since the changes to rc.sysinit are more scattered than last time I present this as a patch. This also makes it easy to apply each time the files are overwritten by pacman. That is, unless the patch is applied to the initscripts package itself  tongue which should be perfectly safe because it doesn't have any effect unless you boot a bootsplash enabled kernel in silent mode.

Fetch the patch here, go to /etc and perform; patch -Np1 < path/to/bootsplash_initscripts.patch


All of your mips are belong to us!!

Offline

#10 2004-06-16 20:01:31

iotc247
Member
From: Florida
Registered: 2004-05-31
Posts: 177
Website

Re: bootsplash trigger events

Well ah how can i get the progressbar to work then?

Offline

#11 2004-06-16 23:28:43

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

If you've already got basic bootsplash working (i.e. you patched your kernel and see a bootsplash with a non-working progress bar) all you need to do is apply the patch above. It will change /etc/rc.sysinit, /etc/rc.multi and /etc/rc.d/functions.

I should point out that your version of the initscripts package better be the same as mine, which is initscripts-0.6-9.

Now, slightly more verbose than in my previous post, you apply the patch as follows:
- download bootsplash_initscripts.patch, let's say to /home/andy/
- become root
- cd /etc
- patch -Np1 < /home/andy/bootsplash_initscripts.patch
That should be it. Remember that you won't see much difference unless you use silent mode bootsplash, so make sure you're passing the splash=silent option to the kernel at boot. Also the bootsplash theme must have working boxes for the progress bar.

My simple bootsplash theme file looks like this:

version=3
state=1

fgcolor=7
bgcolor=0

tx=6
ty=4
tw=794
th=596

text_x=160
text_y=400
text_size=20
text_color=0xeef4ff

jpeg=/etc/bootsplash/themes/p1120/images/archelder.jpg
silentjpeg=/etc/bootsplash/themes/p1120/images/archelder.jpg

progress_enable=1
overpaintok=1

# silent mode
box silent       160 540 640 560 #313234
box silent inter 160 540 159 560 #526bb0
box silent       160 540 640 560 #526bb0

# normal mode
box noover 0 0 800 600 #000000a0

All of your mips are belong to us!!

Offline

#12 2004-06-17 13:23:19

iotc247
Member
From: Florida
Registered: 2004-05-31
Posts: 177
Website

Re: bootsplash trigger events

That patched screwed me startup up.. Theres a major bug in it because if it mounts proc it cant unmount it it has some kind of bug with that..

Offline

#13 2004-06-18 16:19:20

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

Oh-oh, I'm sorry to hear that iotc247.

I've checked the output on my system in verbose mode and checked the logs. I don't see any error messages here. I also find it very strange that /proc can't be unmounted, and I don't see why it should be a problem if it couldn't. You are sure you had initscripts-0.6-9 installed?

Before anybody else messes up their systems, I should make it clear that you try this at your own risk. It's also a good thing to have initscripts-0.6-9.pkg.tar.gz around so you can undo the damage if anything fails.

I hope you get your system up and running again without too much hassle.


All of your mips are belong to us!!

Offline

#14 2004-06-18 16:29:56

iotc247
Member
From: Florida
Registered: 2004-05-31
Posts: 177
Website

Re: bootsplash trigger events

Thats the package i have.. Well i fixed it now.. Anyways i just commented out the mount and unmount part of my rc.sysinit and it fixed it..

Offline

#15 2004-06-18 17:36:23

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

Ok, that works as long as you don't use LVM, but the progress bar will be put out of action again. That's unless you change the 'if grep -qs silent /proc/splash' part in rc.sysinit.

Does anybody have an explaination for why iotc247's system freaked out when trying to unmound /proc before mounting local filesystems?


All of your mips are belong to us!!

Offline

#16 2004-06-18 17:39:09

iotc247
Member
From: Florida
Registered: 2004-05-31
Posts: 177
Website

Re: bootsplash trigger events

my rc.init didnt have everything urs did.. So i had to add a few things.. I think proc is mounted before the boot splash stuff happens so all i did was comment out the mount and umount proc stuff in rc.sysinit and it works.. the prog bar works.. Thats all i have to say..

Offline

#17 2004-06-18 18:12:31

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

I must have misinterpreted something about your situation, because there is no way the progress bar will work if you don't have /proc mounted when you get to the if statement in the code below.

# get ready for bootsplash
/bin/mount -n -t proc none /proc
if grep -qs silent /proc/splash; then
        BOOTSPLASH_NUMBER=$((`echo ${DAEMONS[@]} | sed 's/![^ t]*//g' | wc -w` + 
                `cat /etc/rc.{sysinit,multi,local} | grep -c -e status -e stat_busy`))
        BOOTSPLASH_DELTA=$((60000 / $BOOTSPLASH_NUMBER))
        BOOTSPLASH_PROGRESS=$((65535 - $BOOTSPLASH_NUMBER * $BOOTSPLASH_DELTA))
        [ -w /proc/splash ] && echo "show $BOOTSPLASH_PROGRESS" > /proc/splash
fi

All of your mips are belong to us!!

Offline

#18 2004-06-18 18:17:39

iotc247
Member
From: Florida
Registered: 2004-05-31
Posts: 177
Website

Re: bootsplash trigger events

# get ready for bootsplash
#/bin/umount /proc
#/bin/mount -n -t proc none /proc
if grep -qs silent /proc/splash; then
        BOOTSPLASH_NUMBER=$((`echo ${DAEMONS[@]} | sed 's/![^ t]*//g' | wc -w`$
                `cat /etc/rc.{sysinit,multi,local} | grep -c -e status -e sta$
        BOOTSPLASH_DELTA=$((60000 / $BOOTSPLASH_NUMBER))
        BOOTSPLASH_PROGRESS=$((65535 - $BOOTSPLASH_NUMBER * $BOOTSPLASH_DELTA))
        [ -w /proc/splash ] && echo "show $BOOTSPLASH_PROGRESS" > /proc/splash
fi

Thats what the patch inserted.. So i think the patch was wrong..

Offline

#19 2004-06-22 14:12:46

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

How on Earth did that umount command end up there? I did a pacman -S initscripts yesterday to check one more time if the patch does what I intended it to. It works perfectly on my system, and the part we both listed looks exactly like it does in my previous post.

EDIT: I still wonder why this didn't work on iotc247's system. I simply can't see any reason.


All of your mips are belong to us!!

Offline

#20 2004-06-22 14:37:01

iotc247
Member
From: Florida
Registered: 2004-05-31
Posts: 177
Website

Re: bootsplash trigger events

Well my initscripts were patched for udev so i think thats why.. I think udev mounts proc before the bootsplash part is started.. Anyways i dont use arch as much anymore.. Trying out gentoo..

Offline

#21 2004-06-22 16:11:39

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

If you already patched the initscripts, that may of course interfere. I wouldn't think that being unable to unmount /proc would make things go awry though.


All of your mips are belong to us!!

Offline

#22 2004-06-28 20:09:17

iotc247
Member
From: Florida
Registered: 2004-05-31
Posts: 177
Website

Re: bootsplash trigger events

Ok im back.. Got tired of stupid compiling everything.. I mess around with distros alot and come back to my main one.. Anyways i think the udev mounts /proc before rc.sysinit is used.. Like in the kernel boot part.. Anyways it dont matter.. never like silent anyways.. I just like the nice verbose backrounds...

Offline

#23 2004-09-17 15:44:37

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: bootsplash trigger events

bogomipz - will these patches still work with the current init scripts?!!  If not will you please update your patch big_smile

Offline

#24 2004-09-19 10:23:07

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: bootsplash trigger events

i have been trying the old patch on the latest initscripts - it works fine apart from one hunk in rc.sysinit

diff -u -r old/rc.sysinit new/rc.sysinit
--- old/rc.sysinit    2004-05-21 18:32:28.000000000 +0200
+++ new/rc.sysinit    2004-05-21 19:15:18.000000000 +0200

@@ -26,19 +36,15 @@
 if [ "$USELVM" = "yes" -o "$USELVM" = "YES" ]; then
     if [ -f /etc/lvmtab -a -x /sbin/vgchange ]; then
         # Kernel 2.4.x, LVM1 groups
-        /bin/mount -n -t proc none /proc
         stat_busy "Activating LVM1 groups"
         /sbin/vgchange -a y
         stat_done
-        umount /proc
     elif [ -x /sbin/lvm ]; then
         # Kernel 2.6.x, LVM2 groups
-        /bin/mount -n -t proc none /proc
         /bin/mount -n -t sysfs none /sys
         stat_busy "Activating LVM2 groups"
         /sbin/lvm vgchange --ignorelockingfailure -a y
         stat_done
-        umount /proc
         umount /sys
     fi
 fi

can this be fixed?  i don't know what is safe.

Offline

#25 2004-09-19 16:56:13

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: bootsplash trigger events

First, let me say I'm sorry that I'm not as active in the community as I used to be. I just finished my master degree and don't hang around at the uni's network 24/7 any more.

Brice has a package named initscripts-bootsplash in his TUR. It's the stock initscripts with my patch applied, but even though the package is at version 0.7-1, it's based on the 0.6-9 version (I think) of the original initscripts package. What I should do when I get time, is help him update this package to match the newest plain initscripts package.

When I get even more time, I might look into setting up fbsplash because that's the successor to bootsplash. Actually, my current kernel has fbsplash and not bootsplash (fbsplash is included in the -ck patchset, which is a kernel flavor for increased desktop performance - search for Con Kolivas on google to find it).

dibblethewrecker - if you don't use LVM, it shouldn't really matter if that part isn't patched. I'll look into updating the patch later. Also, removing everything that has to do with mounting/unmounting /proc can safely be removed from the patch if that makes it apply cleanly - the reason why I made /proc mount earlier was that /proc/splash is needed to update the progress bar, so it will not start to work before the mount.

Cheers,
-bogomipz


All of your mips are belong to us!!

Offline

Board footer

Powered by FluxBB