Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#83796 - 26/03/2002 23:02 empeg-preinit v2
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I'd noticed that people were actually using my empeg-preinit binary, so I thought I'd upgrade it to do some useful stuff.

This version adds the ability to wait on the music partitions to be mounted. This is accomplished by naming your script starting with a capital `M'. All scripts that need to run immediately now need to start with a capital `N'. This will break current scripts, as ones that start with neither an `N' nor an `M' will not be executed at all. Future releases will (hopefully) have a sorting mechanism so that one script can depend on another having been exectuted. Based on that, I would suggest that scripts have their second and third characters be a two digit number (a la ``N75telnetd'' or ``M33alarmclock'') so that future revisions can sort properly.

This new version also prints out the fact that it has started and has stopped. I would suggest that all scripts do the same thing. Something like this seems appropriate:
#!/bin/sh

echo -e "starting telnetd...\c"
/empeg/bin/telnetd
echo "done"
Of course, some error notification might also be useful, but I'll leave that up to script writers.

It is, as always available at http://www.beaglebros.com/empeg/empeg-preinit/.
_________________________
Bitt Faulk

Top
#83797 - 27/03/2002 00:26 Re: empeg-preinit v2 [Re: wfaulk]
justinlarsen
old hand

Registered: 31/12/2001
Posts: 1109
Loc: Petaluma, CA
thanks Bitt
_________________________
---- Justin Larsen

Top
#83798 - 27/03/2002 21:05 Re: empeg-preinit v2 [Re: wfaulk]
whitetrash
new poster

Registered: 27/03/2002
Posts: 1
Loc: SLC, UT
Just installed preinit and a very similar startup script for telnetd. I am a happy camper! No need to console in anymore. Woo-hoo!
_________________________
B5.5 VW Passat w/MK2a '56 VW Bug w/AM '57 VW Bus w/AM

Top
#83799 - 28/03/2002 11:10 Re: empeg-preinit v2 [Re: wfaulk]
crazymelki
enthusiast

Registered: 16/02/2001
Posts: 373
Loc: Switzerland
Hello Bitt,

I have there a question. With you earlier version of preinit I had it work with the viewer. Now I changed the name of the script file to "N12viewerinit" and have the follwing string there:

#!/bin/sh
echo -e "starting viewer...\c"
/empeg/bin/viewer/viewer
echo "done"

The viewer file is still in the /empeg/bin/viewer/ directory...

I did only not create the preinit.d directory because it was existing already....

any idea?

thanks
_________________________
crazymelki.com

Top
#83800 - 28/03/2002 16:47 Re: empeg-preinit v2 [Re: crazymelki]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
And it doesn't work now? Odd.

I haven't played with the viewer app, so I don't know if it needs to wait for config.ini to be available or anything (I can't imagine that it does, since it worked with the old preinit).

Can you watch the serial port on boot and make sure that you see the output from preinit itself and from your script. And afterwards, can you run ``ps ax'' and see if you see the viewer app running?
_________________________
Bitt Faulk

Top
#83801 - 28/03/2002 23:27 Re: empeg-preinit v2 [Re: wfaulk]
crazymelki
enthusiast

Registered: 16/02/2001
Posts: 373
Loc: Switzerland
Hello Bitt,

Ok...I was watching the serial port!

During the boot I can see
empeg-preinit starting...
empeg-preinit complete

but then on the end there is an error:
No such file or directoryinit.d/M13empwake: /empeg/bin/empwake/empwake

I had the same error with the viewer. The files are there in this right diectory all with chmod 755. I did also check that the file names are in lower case letter. I use Hijack V251

any ideas? Can I delete the preinit.d directory and start the V2 form the scratch?

bye

_________________________
crazymelki.com

Top
#83802 - 28/03/2002 23:39 Re: empeg-preinit v2 [Re: crazymelki]
mtempsch
pooh-bah

Registered: 02/06/2000
Posts: 1996
Loc: Gothenburg, Sweden
No such file or directoryinit.d/M13empwake: /empeg/bin/empwake/empwake

I had the same error with the viewer. The files are there in this right diectory all with chmod 755. I did also check that the file names are in lower case letter.


Any chance you created the file(s) on a windows system without saving as Unix style (in regard to linefeeds)? In that case it'll actually be looking for a file named /empeg/bin/empwake/empwake^M, as there's an extra Control-M (carriage return) character before the linefeed...

/Michael
_________________________
/Michael

Top
#83803 - 28/03/2002 23:46 Re: empeg-preinit v2 [Re: mtempsch]
crazymelki
enthusiast

Registered: 16/02/2001
Posts: 373
Loc: Switzerland
hello Michael,

Yeep. In the meantime I found it! But they was with the old preinit working in a windows style.. Not 100% sure. I changed the style now to Unix and it works fine..both viewer and empwake.

many thanks!

bye
_________________________
crazymelki.com

Top
#83804 - 29/03/2002 00:22 Re: empeg-preinit v2 [Re: crazymelki]
mtempsch
pooh-bah

Registered: 02/06/2000
Posts: 1996
Loc: Gothenburg, Sweden
Hailing Tony, keeper of the FAQ:

This is starting to become a frequent "gotcha"... The FAQ touches upon the subject of Unix/Windows style linefeeds in a couple of places, but a new entry
"Why does it say it can't find my script/file" might be in order. This could also mention the fact that the current directory isn't automatically in the path, sensitivity to CapITalizAtion etc...

/Michael
_________________________
/Michael

Top
#83805 - 29/03/2002 10:24 Re: empeg-preinit v2 [Re: crazymelki]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
That's weird. I changed nothing in the code that actually executes the script. (In fact, it just calls /bin/sh to do it. My app never even looks at the data in the script file.) Did you add any commands to the script? If the call to your app was the last line in the script, then it might not have been followed by the errant Ctrl-M.
_________________________
Bitt Faulk

Top
#83806 - 29/03/2002 10:57 Re: empeg-preinit v2 [Re: wfaulk]
crazymelki
enthusiast

Registered: 16/02/2001
Posts: 373
Loc: Switzerland
Bitt,

I did first download the old script via FTP from my device. Then I did modify it with Ultraedit (normally there is a info message about conversion) as following:

#!/bin/sh
echo -e "starting viewer...\c"
/empeg/bin/viewer/viewer
echo "done"

I saved the file and uploaded it to my device.

that's what I did.

bye
_________________________
crazymelki.com

Top
#83807 - 31/03/2002 13:48 Re: empeg-preinit v2 [Re: wfaulk]
bonzi
pooh-bah

Registered: 13/09/1999
Posts: 2401
Loc: Croatia
Bitt, I am quite sure the new empeg-preinit executes only one each of M* and N* scripts (I have three - VNC, viewer and telnetd, and all can be N*, but I shuffled them around). All are executable, with Unix line terminators and essentially identical. I get echo only from one script from each group, and can verify (ps -ef) that really only those got started. By shuffling the scripts among groups I got them all to start at least once (that is, if a script is the only one in either N* or M* group, it gets started), so that would rule out the problem with scripts themselves. All 'illegally' named files got reported on console. I took a quick look at source, but could not see anything wrong (at least with the loop that reads the directory - I got only that far at the moment).

This is not a big deal, since I can wrap them all into one script, but I thought you would like to know...

BTW, thanks for this hack - I prefer to keep stock init
_________________________
Dragi "Bonzi" Raos Q#5196 MkII #080000376, 18GB green MkIIa #040103247, 60GB blue

Top
#83808 - 31/03/2002 18:02 Re: empeg-preinit v2 [Re: bonzi]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I'm sure that that's my fault. It occurs to me that I never did check that multiple scripts actually worked.

Edit: Yeah. My whole linked list implementation is fucked. Man, it's been a long time. I'll have a fix tomorrow, most likely.


Edited by wfaulk (31/03/2002 18:47)
_________________________
Bitt Faulk

Top
#83809 - 31/03/2002 19:31 empeg-preinit v3 [Re: wfaulk]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Okay. Now I've got it fixed. Still at http://www.beaglebros.com/empeg/empeg-preinit/
_________________________
Bitt Faulk

Top
#83810 - 31/03/2002 19:32 Re: empeg-preinit v3 [Re: wfaulk]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Is the numeric sorting implemented in this version?
_________________________
- Tony C
my empeg stuff

Top
#83811 - 31/03/2002 19:33 Re: empeg-preinit v3 [Re: tonyc]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Nope. Is it something you need?

Edit: Although, in practice, you might be able to use the fact that readdir() seems to sort things itself by creation time, and create the scripts in the order you want them executed.


Edited by wfaulk (31/03/2002 19:37)
_________________________
Bitt Faulk

Top
#83812 - 31/03/2002 19:50 Re: empeg-preinit v3 [Re: wfaulk]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Edit: Although, in practice, you might be able to use the fact that readdir() seems to sort things itself by creation time, and create the scripts in the order you want them executed.

Good enough for me. I just wanted this:

N10usrmount: mounts my /usr partition (/dev/hda2)
N20myprog1: runs my program which resides on /usr

etc. Since my user programs all live on /usr I wanted to create one that executes first to mount it. The create time thing is fine for me.
_________________________
- Tony C
my empeg stuff

Top
#83813 - 31/03/2002 20:04 Re: empeg-preinit v3 [Re: tonyc]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Well, what about making it a M* script? That will (should) wait until the drives are mounted before running the script.

Edit: Then again, you did say your /usr partition. Nevermind.


Edited by wfaulk (31/03/2002 20:04)
_________________________
Bitt Faulk

Top
#83814 - 01/04/2002 12:11 Re: empeg-preinit v3 [Re: wfaulk]
bonzi
pooh-bah

Registered: 13/09/1999
Posts: 2401
Loc: Croatia
Works now. Thanks!
_________________________
Dragi "Bonzi" Raos Q#5196 MkII #080000376, 18GB green MkIIa #040103247, 60GB blue

Top