View previous topic :: View next topic |
Author |
Message |
blackamon n00b
Joined: 16 Apr 2002 Posts: 32 Location: Gothenburg/Sweden
|
Posted: Mon Apr 14, 2003 6:31 pm Post subject: initlevels, bootsplash and progressbar? |
|
|
after a day and a half playing around and reading the forums i still got a couple of questions. i've come as far as to getting the progressbar moving by using echo "show <value>(ex 32000)" > /proc/splash in my /etc/conf.d/local.start file, the problem is that i don't know which files are read and in which order so i can't make it progress nicely. bootsplash.org suggests adding it to init levels but the thing is gentoo doesn't seem to have those files at all. so to narrow it down, how do i get bootsplash to show progress nicely using a progressbar? what init levels exists and how do i use them? what files should be tinkered with?
/B _________________ Blackamon (David Sinclair)
"- do { life(); } while(world_exists == true); " |
|
Back to top |
|
|
Chickpea l33t
Joined: 03 Jun 2002 Posts: 846 Location: Vancouver WA
|
Posted: Mon Apr 14, 2003 6:45 pm Post subject: |
|
|
I have been wondering this as well. I have not figured this part out either. I dont know that much about the init scripts to know which is which. I hope someone out there does. It would be nice.
Cat |
|
Back to top |
|
|
blackamon n00b
Joined: 16 Apr 2002 Posts: 32 Location: Gothenburg/Sweden
|
Posted: Tue Apr 15, 2003 9:38 am Post subject: solution on the way... |
|
|
i've been at this around the clock and i think i got the solution. i'm at work at the moment, but the tests i ran this morning indicate that it will work.
it's not fully implemented yet, but i've got the progressbar to move as the system progresses through the boot. stay tuned! i will post the solution a couple of hours after i get home.
/B
EDIT: i was stressed out when i wrote it so i had to rewrite it. _________________ Blackamon (David Sinclair)
"- do { life(); } while(world_exists == true); " |
|
Back to top |
|
|
blackamon n00b
Joined: 16 Apr 2002 Posts: 32 Location: Gothenburg/Sweden
|
Posted: Wed Apr 16, 2003 9:38 am Post subject: stuck with the problem... |
|
|
well i didn't update last night because it didn't work as i expected. it worked 1 time and that's it. my solution was:
---
edit runscript.sh in /etc/init.d
add:
export NEW_VALUE=$(((`cat /etc/counter` + 1500)))
echo "show $NEW_VALUE" > /proc/splash
rm -f /etc/counter
echo $NEW_VALUE >> /etc/counter
---
ok, the thing is runscript.sh runs when you shutdown so the value of /etc/counter is wrong when the computer boots. the value should be 0 at every boot, but i haven't figured out a solution yet. another flaw of this is that runscript.sh isn't used directly at when control is goes to sysinit.
if anyone has any ideas or suggestions i would really appreciate it!
/B _________________ Blackamon (David Sinclair)
"- do { life(); } while(world_exists == true); " |
|
Back to top |
|
|
pYrania Retired Dev
Joined: 27 Oct 2002 Posts: 650 Location: Cologne - Germany
|
Posted: Wed Apr 16, 2003 10:20 am Post subject: |
|
|
how about s.th. like this?
source /etc/init.d/progbar
Code: | #!/sbin/runscript
depend() {
after local
}
start() {
ebegin "Starting ProgbarStatus"
export NEW_VALUE=$(((`cat /etc/counter` + 1500)))
echo "show $NEW_VALUE" > /proc/splash
rm -f /etc/counter
echo $NEW_VALUE >> /etc/counter
}
stop() {
echo 0 >> /etc/counter
} |
I really don't know if it works and i won't going to test it either, but from your input, i think that's what you need. _________________ Markus Nigbur |
|
Back to top |
|
|
blackamon n00b
Joined: 16 Apr 2002 Posts: 32 Location: Gothenburg/Sweden
|
Posted: Wed Apr 16, 2003 2:17 pm Post subject: hm... dunno |
|
|
ok, first how do i use it? where do i add it? how can i make it run directly at sysinit? the stop() should be:
Code: | stop () {
rm -f /etc/counter
echo 0 >> /etc/counter
} |
i'll try to explain myself a little better... for every [ OK ] i want the progressbar to update, for that i need a counter that adds a value to itself everytime its called.
thanks!
/B _________________ Blackamon (David Sinclair)
"- do { life(); } while(world_exists == true); " |
|
Back to top |
|
|
jaloha n00b
Joined: 07 Apr 2003 Posts: 35 Location: Honolulu, Hawai'i
|
Posted: Thu Apr 17, 2003 4:41 am Post subject: Where to put it |
|
|
This may not be at all what the problem is, but I think the implication was to put it in the file /etc/init.d/progbar
Then create a sym-link to it in your default runlevel directory (usually /etc/runlevels/default). I think there is a tool for doing this, but I don't know what it is named.
The Gentoo Linux rc-script Guide at http://www.gentoo.org/main/en/docs.xml may be useful for undertaking this project.
I am guessing you already know all of this, please don't be insulted if it is not what you were looking for.
Aloha |
|
Back to top |
|
|
D-e-e n00b
Joined: 22 Apr 2003 Posts: 27 Location: Canada
|
Posted: Tue Apr 22, 2003 8:48 am Post subject: |
|
|
I added the following into the function eend in the file /sbin/functions.sh.
Code: |
if [ "${BOOT}" = "yes" ] && [ -z "${EBUILD}" -a -w /proc/splash ] && [ -s /dev/shm/ ]
then
if ! [ -e /dev/shm/progress_bar_counter ] ; then echo 0 > /dev/shm/progress_bar_counter ; fi
NEW_VALUE=$(( `cat /dev/shm/progress_bar_counter` + 2849 ))
echo "$NEW_VALUE" > /dev/shm/progress_bar_counter
echo "show $NEW_VALUE" > /proc/splash
fi |
Place the above code at the begining of the eend(){} function, so that it executes before the rest of the function does.
I came up with the number "2849" by adding the number of scripts that were called after the shared memory (/dev/shm) was mounted, added one to that number, and divided 65536 by it. Eg. 65536/(number_of_scripts + 1).
With this additon the progress bar animates smoothly without any hitches. Must have the following code in your fstab to mount /dev/shm
Code: | none /dev/shm tmpfs defaults 0 0 |
This code will only move the progress bar during BOOT.
If you refine this code, or find a better solution please let me know. _________________ --- D-e-e |
|
Back to top |
|
|
zhenlin Veteran
Joined: 09 Nov 2002 Posts: 1361
|
Posted: Tue Apr 22, 2003 1:54 pm Post subject: |
|
|
The best solution is to count up the number of scripts that will run, and use the progress bar to mark the percentage of runscripts completed. Of course, this will not count each and every [ ok ] that appears, but at least it works.
The best way to find out how many services are going to be started is to find the number of unique, valid symlinks in /etc/init.d/boot and /etc/init.d/<runlevel>. The best way to update the progress bar <at boot> is from /sbin/rc. /sbin/runscript deals with individual scripts, DO NOT TINKER WITH IT.
Progress bars are for people who don't know what services they are starting at boot... that is a bad thing. |
|
Back to top |
|
|
blackamon n00b
Joined: 16 Apr 2002 Posts: 32 Location: Gothenburg/Sweden
|
Posted: Tue Apr 22, 2003 2:41 pm Post subject: same old... |
|
|
this is a common perception... you must be a complete idiot if you don't want to look at the same old boring text everytime you start your computer. i've been flamed multiple times by people who think they're elite just because they live in the console. but hey... i prefer to look at something neat when my computer starts AND when it's running. if i need to see the boot messages i press F2, it's that simple. but the biggest point here is, the FREEDOM OF CHOICE. i don't care about what other people think and the choice is mine and mine alone!
[ok, this is all crap rolled into one message so don't take it personal zhenlin]
/B no offense... _________________ Blackamon (David Sinclair)
"- do { life(); } while(world_exists == true); " |
|
Back to top |
|
|
dice Guru
Joined: 21 Apr 2002 Posts: 577
|
Posted: Tue Apr 22, 2003 3:38 pm Post subject: Re: same old... |
|
|
blackamon wrote: | you must be a complete idiot if you don't want to look at the same old boring text everytime you start your computer |
The thing I like about Linux is that I almost never restart my computer
I reboot about as often as there are stable kernel releases. |
|
Back to top |
|
|
Swishy Guru
Joined: 06 Jun 2002 Posts: 491 Location: NZ
|
Posted: Sat Apr 26, 2003 10:30 pm Post subject: Re: same old... |
|
|
blackamon wrote: | this is a common perception... you must be a complete idiot if you don't want to look at the same old boring text everytime you start your computer. i've been flamed multiple times by people who think they're elite just because they live in the console. but hey... i prefer to look at something neat when my computer starts AND when it's running. if i need to see the boot messages i press F2, it's that simple. but the biggest point here is, the FREEDOM OF CHOICE. i don't care about what other people think and the choice is mine and mine alone!
[ok, this is all crap rolled into one message so don't take it personal zhenlin]
/B no offense... |
Not to mention the few of us building systems for people who just them for email etc want something that looks good is fast and doesnt want to know any more and we have to administer them ........(oh and got sick of getting us to reinstall windows )
Cheers
Dale. _________________ Theres no substitute for C.I. |
|
Back to top |
|
|
nempo Guru
Joined: 16 Apr 2002 Posts: 360 Location: Linkoping, Sweden
|
Posted: Sun Apr 27, 2003 10:11 am Post subject: |
|
|
D-e-e wrote: | I added the following into the function eend in the file /sbin/functions.sh.
Code: |
if [ "${BOOT}" = "yes" ] && [ -z "${EBUILD}" -a -w /proc/splash ] && [ -s /dev/shm/ ]
then
if ! [ -e /dev/shm/progress_bar_counter ] ; then echo 0 > /dev/shm/progress_bar_counter ; fi
NEW_VALUE=$(( `cat /dev/shm/progress_bar_counter` + 2849 ))
echo "$NEW_VALUE" > /dev/shm/progress_bar_counter
echo "show $NEW_VALUE" > /proc/splash
fi |
Place the above code at the begining of the eend(){} function, so that it executes before the rest of the function does.
I came up with the number "2849" by adding the number of scripts that were called after the shared memory (/dev/shm) was mounted, added one to that number, and divided 65536 by it. Eg. 65536/(number_of_scripts + 1).
With this additon the progress bar animates smoothly without any hitches. Must have the following code in your fstab to mount /dev/shm
Code: | none /dev/shm tmpfs defaults 0 0 |
This code will only move the progress bar during BOOT.
If you refine this code, or find a better solution please let me know. |
It works till about 65% then it resets and moments later my prompt comes up. Is this cause'd by the number 2849 ? ;0
And I wouldn't call the animation smooth, not here atleast.
Edit: It was, I just fixed it so it fits 'my' computer now. It still resets after 100% tho ;( _________________
homeobocks wrote: | superjaded wrote: |
would Big Brother become a reality? |
Yeah . . . it would be just like the tv show. Except somebody would be watching. |
|
|
Back to top |
|
|
mojo n00b
Joined: 21 Nov 2002 Posts: 47 Location: Heidelberg, Germany
|
Posted: Sun Apr 27, 2003 10:31 am Post subject: |
|
|
when will /dev/shm be mounted? in which setp/script? |
|
Back to top |
|
|
blackamon n00b
Joined: 16 Apr 2002 Posts: 32 Location: Gothenburg/Sweden
|
Posted: Sun Apr 27, 2003 12:23 pm Post subject: 100% reset |
|
|
i got this before too... just change the last value to be hit by -1, i.e 65534.
there are alot of fading options too that would make it alot nicer... don't have a clue on how the work though...
/B _________________ Blackamon (David Sinclair)
"- do { life(); } while(world_exists == true); " |
|
Back to top |
|
|
carrett Apprentice
Joined: 22 Mar 2003 Posts: 273
|
Posted: Mon Apr 28, 2003 4:12 pm Post subject: stolen from bootsplash.org |
|
|
i don't know how useful this is, but here it is:
Quote: | # Progress bar handling in the init scripts.
To have a progress bar during bootup you need the following
* A theme that contains a progress bar. Look in the Theme section
for information on how to add a progress bar and for example themes.
* The above function rc_splash (or comparable functionality)
* The splash.sh script (called from rc_splash as a wrapper to the splash utility)
Additionally you need to make your runlevel script scheduler (i.e. /etc/init.d/rc) aware of the number of scripts to be executed in the current runlevel:
#
# initialize boosplash progressbar variables
#
runrc=/etc/init.d/rc${RUNLEVEL}.d
prerc=/etc/init.d/rc${PREVLEVEL}.d
SSC=($runrc/S*)
case "$SSC" in
*\*) sscripts=0 ;;
*) sscripts=${#SSC[*]}
esac
export sscripts
if test "$PREVLEVEL" != "N" ; then
KSC=($prerc/K*)
case "$KSC" in
*\*) kscripts=0 ;;
*) kscripts=${#KSC[*]}
esac
export kscripts
fi
if [ "$PREVLEVEL" == "N" -a "$RUNLEVEL" == "5" ]; then
export progress=16
sscripts=$(( $sscripts+15 ))
else
export progress=0
fi
To switch the bootsplash off when the final runlevel is reached you can add the following to the runlevel script scheduler at the according place:
rc_splash "master"
This will cause most themes to switch off the bootsplash screen. |
_________________ I'm against picketing, but I don't know how to show it. |
|
Back to top |
|
|
micha n00b
Joined: 03 Oct 2002 Posts: 24 Location: Germany
|
Posted: Sun May 04, 2003 12:29 pm Post subject: |
|
|
Hi,
here's my solution:
First add these functions to /sbin/functions.sh :
Code: |
splash_init() {
pb_init=0
pb_count=0
pb_scripts=0
pb_rate=0
if [ -f /etc/conf.d/bootsplash.conf ]; then
. /etc/conf.d/bootsplash.conf
if [ -n "${PROGRESS_INIT_RATE}" ]; then
rate=$((65535*${PROGRESS_INIT_RATE}/100))
fi
scripts="${PROGRESS_INIT_SCRIPTS}"
fi
if [ "${RUNLEVEL}" == "S" ]; then
pb_scripts=5
pb_rate=9000
[ -n "$scripts" ] && pb_scripts="$scripts"
[ -n "$rate" ] && pb_rate="$rate"
fi
export pb_init pb_count pb_scripts pb_rate
}
splash_calc() {
pb_runs=(/etc/runlevels/$1/*)
pb_runb=(/etc/runlevels/boot/*)
pb_scripts=${#pb_runs[*]}
pb_boot=${#pb_runb[*]}
if [ -f /etc/conf.d/bootsplash.conf ]; then
. /etc/conf.d/bootsplash.conf
if [ -n "${PROGRESS_INIT_RATE}" ]; then
init_rate=$((65535*${PROGRESS_INIT_RATE}/100))
fi
if [ -n "${PROGRESS_BOOT_RATE}" ]; then
boot_rate=$((65535*${PROGRESS_BOOT_RATE}/100))
fi
fi
if [ "${BOOT}" == "yes" ]; then
pb_init=9000
pb_rate=21845
pb_count=0
[ -n "$init_rate" ] && pb_init=$init_rate
[ -n "$boot_rate" ] && pb_rate=$boot_rate
elif [ "${RUNLEVEL}" == "0" -o "${RUNLEVEL}" == "6" ]; then
pb_scripts=$(($pb_scripts + $pb_boot))
pb_rate=65534
else
pb_scripts=$(($pb_scripts + $pb_boot))
pb_init=31845
pb_rate=65534
if [ -n "$init_rate" -a -n "$boot_rate" ]; then
pb_init=$(($init_rate + $boot_rate))
fi
fi
}
splash_update() {
[ "$splash" != "silent" ] && return
[ "$PREVLEVEL" == "N" -a "$1" == "stop" ] && return
/sbin/splash "$1" "$2"
pb_count=$(($pb_count + 1))
}
|
Additionally the function eend() in /sbin/function.sh has to be extended by these lines ( at the beginning ) :
Code: |
eend() {
if [ "${RUNLEVEL}" == "S" -a "${0}" == "/sbin/rc" ]; then
splash_update
fi
[...]
}
|
After that edit the /sbin/rc script and add the following (only bold lines):
Code: | [i]at line 40:[/i]
[...]
# save $1
argv1="$1"
# Bootsplash progressbar begin
[b]splash_init[/b]
# Bootsplash progressbar end
# first time boot stuff goes here
if [ "${RUNLEVEL}" = "S" -a "${argv1}" = "boot" ]
then
[...]
|
Code: | [i]at line 247:[/i]
[...]
fi # boot ends here
# Progressbar begin
[b]splash_calc "${argv1}"[/b]
# Progressbar end
if [ -z "${argv1}" ]
then
[...]
|
Code: | [i]at line 375:[/i]
[...]
# stop services
for i in $(dolisting ${svcdir}/started/)
do
# Progressbar begin
[b] splash_update "stop" "$i"[/b]
# Progressbar end
dep_stop ${i}
done
[...]
|
Code: | [i]at line 425:[/i]
[...]
# start scripts
for i in $(dolisting ${svcdir}/softscripts/)
do
# Progressbar begin
[b] splash_update "start" "$i"[/b]
# Progressbar end
dep_start ${i}
done
[...]
|
Now add some variables to /etc/conf.d/bootsplash.conf:
Code: |
# /etc/init.d/bootsplash.conf
#
# only one option at the moment
#
BOOTSPLASH_THEME=SuSE-8.2
#
# Progressbar rate of inline boot scripts
# in /sbin/rc ( per cent ), e.g. "20"
#
PROGRESS_INIT_RATE="13"
PROGRESS_BOOT_RATE="33"
#
# Number of inline boot scripts in /sbin/rc
#
PROGRESS_INIT_SCRIPTS="5"
|
The number of init scripts has to be adapted to your configuration.
Finally remove the bootsplash-init-script from the init process (rc-update del bootsplash), move /sbin/splash to /sbin/splash.bin and copy this wrapper-script to /sbin/splash:
Code: |
#!/bin/bash
#
# splash - script to paint progressbar during
# system startup/shutdown
#
# parts are based on the splash.sh script from SuSE
# execute splash binary utility because we are a wrapper
if [ "$1" == "-s" -o "$1" == "-u" -o "$1" == "-n" -o "$1" == "-f" ]; then
exec /sbin/splash.bin $*
else
( exec /sbin/splash.bin "$*" )
fi
test -r /proc/splash || exit 0
test -z "$pb_count" -a -z "$pb_scripts" && exit 0
test "$RUNLEVEL" == "6" -o "$RUNLEVEL" == "0" && SHUTDOWN="yes"
function box() { true; }
test -f /etc/conf.d/bootsplash.conf && . /etc/conf.d/bootsplash.conf
test -z "${BOOTSPLASH_THEME}" && BOOTSPLASH_THEME="default"
config="/etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-$(/sbin/fbresolution).cfg"
test -f $config && . $config
# Print text string...
if [ "$pb_count" == "0" ]; then
if [ "$SHUTDOWN" == "yes" ]; then
/sbin/splash -s -u 0 $config
echo "silent" > /proc/splash
/usr/bin/chvt 1
fi
if [ "${BOOT}" != "yes" -o "$SHUTDOWN" == "yes" ]; then
text="Booting"; test "$SHUTDOWN" == "yes" && text="Shutting down"
if [ "$text_x" != "" -a "$text_y" != "" -a "$text_color" != "" -a "$text_size" != "" ]; then
/sbin/fbtruetype -x $text_x -y $text_y -t $text_color -s $text_size \
"$text the system... Press F2 for verbose mode"
fi
fi
fi
# Paint progressbar...
test -z "$progress_enable" && exit 0
value=$(($pb_init + ($pb_count + 1) * ($pb_rate - $pb_init) / $pb_scripts))
echo "show $value" > /proc/splash
|
Ok, that's it.
Hope it'll work for you as good as it does for me
micha |
|
Back to top |
|
|
micha n00b
Joined: 03 Oct 2002 Posts: 24 Location: Germany
|
Posted: Sun May 04, 2003 9:07 pm Post subject: |
|
|
Some additional information:
The splash image seems to be killed by /etc/init.d/halt.sh during shutdown. To prevent the script from doing this, comment out the following lines in /etc/init.d/halt.sh:
Code: |
#ebegin "Sending all processes the TERM signal"
#killall5 -15 &>/dev/null
#eend $?
#sleep 5
#ebegin "Sending all processes the KILL signal"
#killall5 -9 &>/dev/null
#eend $?
|
These two signals are already emitted by the init process during shutdown and I haven't noticed any side-effects yet.
Another thing I've noticed: The progress bar doesn't work with the Gentoo bootsplash (I tested it with the SuSE splash which works fine).
Does the Gentoo splash support a progress bar ?
[edit]
Sure, the progress bar is supported - was my fault (BOOTSPLASH_THEME contained "Gentoo" instead of "gentoo" )
[/edit]
micha |
|
Back to top |
|
|
micha n00b
Joined: 03 Oct 2002 Posts: 24 Location: Germany
|
|
Back to top |
|
|
blackamon n00b
Joined: 16 Apr 2002 Posts: 32 Location: Gothenburg/Sweden
|
Posted: Mon May 05, 2003 3:22 pm Post subject: great work! |
|
|
thanks alot man...
/B _________________ Blackamon (David Sinclair)
"- do { life(); } while(world_exists == true); " |
|
Back to top |
|
|
micha n00b
Joined: 03 Oct 2002 Posts: 24 Location: Germany
|
|
Back to top |
|
|
Lovechild Advocate
Joined: 17 May 2002 Posts: 2858 Location: Århus, Denmark
|
Posted: Thu May 15, 2003 2:19 pm Post subject: |
|
|
I'm a bit confused - no kernel patches or is this broken off from a different thread I completely missed?
because I would like this, but I was concerned that it might not work with my 2.5.69-mm5 kernel. |
|
Back to top |
|
|
Swishy Guru
Joined: 06 Jun 2002 Posts: 491 Location: NZ
|
Posted: Thu May 15, 2003 2:27 pm Post subject: |
|
|
Lovechild wrote: | I'm a bit confused - no kernel patches or is this broken off from a different thread I completely missed?
because I would like this, but I was concerned that it might not work with my 2.5.69-mm5 kernel. |
Most of the "gentoo" kernels are prepatched ie gentoo-sources gaming-sources etc , you can emerge bootsplash which will automagically patch the kernel when the script is run after emerging .....you could have fun patching against the 2.5 series kernel though ......
The work Micha and co were doing is to get the boot progress bar working as the system boots in a progressive manner that related to the actual booting of the machine ......
Check out http://www.bootsplash.org/ for furthur info
Cheers
Dale. _________________ Theres no substitute for C.I. |
|
Back to top |
|
|
Lovechild Advocate
Joined: 17 May 2002 Posts: 2858 Location: Århus, Denmark
|
Posted: Thu May 15, 2003 2:31 pm Post subject: |
|
|
Okay, Gentoo-sources 2.4.20-r5 here we go, then we can see how much I mess up. |
|
Back to top |
|
|
Swishy Guru
Joined: 06 Jun 2002 Posts: 491 Location: NZ
|
Posted: Thu May 15, 2003 2:39 pm Post subject: |
|
|
Lovechild wrote: | Okay, Gentoo-sources 2.4.20-r5 here we go, then we can see how much I mess up. |
Id recommend gaming-sources atm (if for desktop use) , closest ive had to a dev 2.5 kernel as far as responce goes and appears stable to me (I was previously using the ingo/linus patch on a 2.5.64 kernel)
Cheers
Dale. _________________ Theres no substitute for C.I. |
|
Back to top |
|
|
|