Unoffical empeg BBS

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

Topic Options
#17770 - 15/09/2000 09:57 init scripts
sc400
stranger

Registered: 09/09/2000
Posts: 42
Loc: SC
I'm starting this thread because I want to see how people are doing their /sbin/init scripts. Mine is nothing special, but here it is:
------------------
#!/bin/sh

PATH=.:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/empeg/bin
PS1=empeg:\\w\\$
/bin/mount -n -o nocheck,rw /proc
/bin/mount -n -o nocheck,ro /dev/hda4 /drive0
/empeg/bin/player
while (/bin/tetris | grep -v '0 lines'); do; done
exec /sbin/init.orig
------------------
This lets me start the player on power-up and quit to tetris using the menu. Then I can play as many tetris games as I want. When I am done, end a game without getting any lines and you are back in the player. If I quit again, I get a bash prompt on the serial port.



Top
#17771 - 15/09/2000 10:56 Re: init scripts [Re: sc400]
BillB
member

Registered: 13/04/2000
Posts: 134
Loc: Orlando, FL USA
hmmm... Didn't even think about tetris. Good idea! After all the discusson on the subject, I wrote my init to start inetd only if undocked. Init is as follows:

#!/bin/sh
PATH=./:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
PS1=empeg:\\w\\$
/bin/mount -n -o nocheck,rw /proc
/bin/mount -n -o nocheck,ro /dev/hda4 /drive0
if cat /proc/empeg_power | grep '0 (AC Power)'
then inetd &
fi
exec /bin/oldinit


Bill B.
Mk.2 SN 080000183 - 18 GB /
Green
_________________________
[orange]Bill B.
Mk.2 SN 080000183 - 38 GB /[/orange] [green] Green [/green]

Top
#17772 - 16/09/2000 14:39 Re: init scripts [Re: sc400]
bonzi
pooh-bah

Registered: 13/09/1999
Posts: 2401
Loc: Croatia
I don't modify ini script at all, but bash profile (/etc/profile). I intervene a little bit into player/shel loop by enabling 'Quit' option, and having shell execute a script that prompts me (using Rex's picker) to either really exit to shell, terminate the shell thus reexecuting the player, or run something else, like tetris :)

Dragi "Bonzi" Raos
Zagreb, Croatia
Q#5196, MkII#80000376, 18GB green
_________________________
Dragi "Bonzi" Raos Q#5196 MkII #080000376, 18GB green MkIIa #040103247, 60GB blue

Top
#17773 - 16/09/2000 15:12 Re: init scripts [Re: bonzi]
sc400
stranger

Registered: 09/09/2000
Posts: 42
Loc: SC
Can I have some more info on Rex's picker? Where can I get it?


Top
#17774 - 16/09/2000 17:08 Re: init scripts [Re: sc400]
rexkp
journeyman

Registered: 31/08/2000
Posts: 88
Can I have some more info on Rex's picker? Where can I get it?

Here

Much to add but this is enough to get most people started.

Cheers,

Rex.



Top
#17775 - 18/09/2000 16:08 Re: init scripts [Re: rexkp]
sc400
stranger

Registered: 09/09/2000
Posts: 42
Loc: SC
The picker looks good. Can we have the source? If not, I'd like to see the buttons on the remote behave appropriately (1=first choice, 2=second, etc). I would also like to see how you wrote to the display. Thanks.


Top
#17776 - 18/09/2000 16:17 Re: init scripts [Re: sc400]
rexkp
journeyman

Registered: 31/08/2000
Posts: 88
I plan on releasing the source soon. However, the idea about the remote buttons is excellent and I will look at adding that.

Writing to the display is detailed at:

http://www.empeg.mars.org/devel/hardware/display.php3

Thanks for the feedback.

Cheers,

Rex.


Top
#17777 - 18/09/2000 18:15 Re: init scripts [Re: rexkp]
sc400
stranger

Registered: 09/09/2000
Posts: 42
Loc: SC
Thanks. My Linux programming is a little weak. Could you give me just a snippet of the display code?


Top
#17778 - 18/09/2000 19:03 Re: init scripts [Re: rexkp]
sc400
stranger

Registered: 09/09/2000
Posts: 42
Loc: SC
I get an error when I run disp:

BUG IN DYNAMIC LINKER ld.so: dynamic-link.h: 57: elf_get_dynamic_info: Assertion
`! "bad dynamic tag"' failed!

And I can't get picker to run at all. bash thinks it is a directory. The file permitions are set correctly.

empeg:/drive0/stuff/bin# ./picker a b c d
bash: ./picker: Is a directory

Any idea whats going on here?


Top
#17779 - 19/09/2000 13:45 Re: init scripts [Re: sc400]
rexkp
journeyman

Registered: 31/08/2000
Posts: 88
I have updated picker to use the remote buttons. Thanks for the idea.

Also, now when it is run without any parameters it does not update the display but simply blocks until it receives a button press. i.e. it acts as a 'press any key to continue'.



Top
#17780 - 19/09/2000 13:51 Re: init scripts [Re: sc400]
rexkp
journeyman

Registered: 31/08/2000
Posts: 88
I have verified both binaries on the web site. They are intact and run on my empeg.

Has anyone else seen this problem?

Cheers,

Rex.


Top
#17781 - 19/09/2000 18:07 Re: init scripts [Re: rexkp]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
This is a suggestion in the spirit of "give them an inch, they'll take a yard". How about a timeout? Like the Windows boot loaders... Throw in a user configurable parameter (in seconds I guess) to default to one of the choices. Probably involve adding just a few lines of code. Sound do-able?

---
MkII 080000554
_________________________
- Tony C
my empeg stuff

Top
#17782 - 22/09/2000 19:08 Re: init scripts [Re: sc400]
TheAmigo
enthusiast

Registered: 14/09/2000
Posts: 363
You might change this
--------
while (/bin/tetris | grep -v '0 lines'); do; done
--------
to look like this
--------
while (/bin/tetris | grep -v '^0 lines'); do; done
--------
or maybe a space in place of the ^, depending on what it's output looks like. That way it won't have a 10% chance of quitting the loop because you got something like 130 lines (which has the string '0 lines').

--The Amigo
_________________________
--The Amigo

Top
#17783 - 23/09/2000 01:53 Re: init scripts [Re: sc400]
TommyE
enthusiast

Registered: 08/06/1999
Posts: 356
Loc: NORWAY
Hello
Not beeing a Linux guru, where do I put the init scripts, and what do I call them. Do I have to rename the old one. (Is there any?)

TommyE


Top
#17784 - 23/09/2000 14:16 Re: init scripts [Re: sc400]
fvgestel
old hand

Registered: 12/08/2000
Posts: 702
Loc: Netherlands
Here's mine :

#!/bin/bash
#
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/root/bin:/usr/local/root/sbin
TERM=vt100
export PATH TERM
IMGDIR=/usr/local/images
mount -n -o remount,ro /
/bin/mount -n -o nocheck,rw /proc
/bin/mount -n -o nocheck,ro /dev/hda4 /drive0
INETD=0
RW=0
while :
do
/empeg/bin/player
if grep -q '0 (AC Power)' /proc/empeg_power
then
if [ "$RW" = "0" ]
then
echo "Mounting readwrite"
blitraw < $IMGDIR/readwrite.raw
mount -n -o remount,rw /
mount -n -o remount,rw /drive0
echo "Activating swap"
blitraw < $IMGDIR/swapon.raw
sleep 1
swapon /usr/local/root/swapfile
RW=1
hostname empeg
if [ "$INETD" = "0" ]
then
blitraw < $IMGDIR/inetd.raw
echo "Starting inetd"
sleep 1
/sbin/inetd
INETD=1
/usr/local/sbin/fidstreamer&
fi
else
blitraw < $IMGDIR/swapoff.raw
echo "Turning off swap"
sleep 1
swapoff /usr/local/root/swapfile
blitraw < $IMGDIR/readonly.raw
echo "Mounting readonly"
sleep 1
mount -n -o remount,ro /
mount -n -o remount,ro /drive0
RW=0
fi
fi
echo "Press q to terminate to a shell"
/usr/local/sbin/getkey q && /bin/bash
done

getkey is a program I knew from redhat. It didn't work for me on a serial console so I put in an alarm which waits for 5 seconds.
source is at http://fvgestel.dyndns.org/empeg/getkey

Frank van Gestel
_________________________
Frank van Gestel

Top
#17785 - 25/09/2000 15:41 Re: init scripts [Re: TommyE]
sc400
stranger

Registered: 09/09/2000
Posts: 42
Loc: SC
The init file is under /bin. In the last line of the first post in this thread, you can see where the renamed original init is called. Now, based on bonzi's message in this thread, I renamed init.orig back to init and just changed the /etc/profile file. This file is executed whenever a shell is started. I just added one line to /etc/profile:

/bin/player-tetris-loop &

And that file does just what it says. It loops back and fourth between tetris and the player all while I have a bash prompt on the serial port. I use the -s- option (don't use serial port) when I call player since I'm already using the serial port for my bash prompt. And I have the quit menu option enabled so I can get to tetris even if the unit is in the car.

Good idea, TheAmigo. I hadn't thought about "*0 lines" being misinterpreted.



Top
#17786 - 29/09/2000 15:56 Re: init scripts [Re: tonyc]
rexkp
journeyman

Registered: 31/08/2000
Posts: 88

Done. There's an updated picker here.

Cheers,

Rex.



Top
#17787 - 29/09/2000 17:01 Re: init scripts [Re: rexkp]
rexkp
journeyman

Registered: 31/08/2000
Posts: 88
Oops, that link got messed up. Try here.

I have also posted sources to both picker and disp.

Enjoy!

Cheers,

Rex.



Top
#17788 - 29/09/2000 17:04 Re: init scripts [Re: sc400]
rexkp
journeyman

Registered: 31/08/2000
Posts: 88
The picker looks good. Can we have the source?

The sources are not posted here.

Enjoy!

Cheers,

Rex.


Top