/programs and preinit - the easy way.

Posted by: genixia

/programs and preinit - the easy way. - 20/07/2002 22:09

Ok, so I've finally gotten around to playing with preinit and various posts, and decided to hone my shell scripting in the process. Attached is a script that will format /dev/hda2 and set up a mount entry (/programs0) for it. It will also create 'rwp' and 'rop' entries for manipulating it in a similar way to rw and ro. If you have a second drive then it will also create /programs1 on /dev/hdc1. The script also goes on and populates /etc/preinit.d with a few shell scripts for starting apps, although I'm sure there's a few more that will need to be added.

Note: You will still need to install the preinit binary and the apps themselves. I have defaulted telnetd to live in /bin, but everything else under /programs0, but you can modify these to suit your needs.





#!/bin/sh

#This script sets stuff up for preinit and 3rd party apps.
#It formats and sets up /dev/hda2 (and /dev/hdc2 if present) for use, and is
#reasonably intelligent - if it can mount a partition then it wont reformat it
#It also provides a couple of utilities for mounting the partitions.
#It then creates /etc/preinit.d and populates it with some useful start scripts - again, if /etc/preinit.d
#already exists, then it will skip this stage.

#CMA Warning: Do not leave this script with executable permissions on your home linux boxes. chmod it to 600.

# copyright: Ian Danby. 2002.
# GPL Version 2 or later. See www.fsf.org for legalese.

#Put root into rw mode.
rw || exit

#Create mountpoints
mkdir /programs0
mkdir /programs1
chmod 755 /programs0
chmod 755 /programs1

#Format partitions. We'll try mounting the partitions first.
#If we can grep them in /proc/mounts then we alread have a valid fs and should skip.

mount -n -r -t ext2 /dev/hda2 /programs0
[ -e /proc/ide/hdb ] && mount -n -r -t ext2 /dev/hdc2 /programs1

grep /dev/hda2 /proc/mounts > /tmpfile
if [ -s /tmpfile ]; then
echo "/dev/hda2 already formatted. Skipping."
else
mke2fs /dev/hda2
fi
rm /tmpfile

if [ -e /proc/ide/hdb ]; then
grep /dev/hdc2 /proc/mounts > /tmpfile
if [ -s /tmpfile ]; then
echo "/dev/hdc2 already formatted. Skipping."
else
mke2fs /dev/hdc2
fi
rm /tmpfile
fi

#Modify /etc/fstab

grep /dev/hda2 /etc/fstab > /tmpfile
if [ -s /tmpfile ]; then
echo "/etc/fstab already contains an entry for /dev/hda2. Skipping."
else
echo "/dev/hda2 /programs0 ext2 defaults,ro 1 1" >> /etc/fstab
echo "Entry for /dev/hda2 appended to /etc/fstab"
fi
rm /tmpfile

if [ -e /proc/ide/hdb ]; then
grep /dev/hdc2 /etc/fstab > /tmpfile
if [ -s /tmpfile ]; then
echo "/etc/fstab already contains an entry for /dev/hdc2. Skipping."
else
echo "/dev/hdc2 /programs1 ext2 defaults,ro 1 1" >> /etc/fstab
echo "Entry for /dev/hdc2 appended to /etc/fstab"
fi
rm /tmpfile
fi


#Create a couple of useful 'binaries', /bin/rwp and /bin/rop. Guess what they do.
cat <<-END > /bin/rwp
#!/bin/sh
mount -n -o remount,rw /programs0
[ -e /proc/ide/hdb ] && mount -n -o remount,rw /programs1
END
chmod 755 /bin/rwp

cat <<-END > /bin/rop
#!/bin/sh
mount -n -o remount,ro /programs0
[ -e /proc/ide/hdb ] && mount -n -o remount,ro /programs1
END
chmod 755 /bin/rop



#Create /etc/preinit.d and populate it. Skip and exit if it already exists.
if [ -e /etc/preinit.d ]; then
echo "/etc/preinit.d already exists!. Skipping."
ro
exit
else
mkdir /etc/preinit.d
fi

#It shouldn't matter if we try to preinit stuff that doesn't exist. The shell deals with missing binaries
####

#telnetd. Best put in the /bin partition so that we can access it immediately. Lets do this first just in case.
#Note that the 'N' prefix tells preinit to do this before config.ini is read (ie drives aren't mounted yet)
cat <<-END > /etc/preinit.d/N10telnetd
#!/bin/bash
/bin/telnetd
END
chmod 755 /etc/preinit.d/N10telnetd

#mount the new drives. Also done before config.ini is read.
cat <<-END > /etc/preinit.d/N20mount
#!/bin/bash
mount -n /programs0
[ /proc/ide/hdb ] && mount -n /programs1
END
chmod 755 /etc/preinit.d/N20mount


#Everything else that follows should probably live in the new parition(s), so need the 'M' prefix.
#For now, let's stuff everything in /programs0...Edit to suit
#Let me know what I've missed.
####

#empacman. The reason I finally got around to doing this...Great stuff.
cat <<-END > /etc/preinit.d/M10empacman
#!/bin/bash
/programs0/empacman
END
chmod 755 /etc/preinit.d/M10empacman


#emptris
cat <<-END > /etc/preinit.d/M20emptris
#!/bin/bash
/programs0/emptris
END
chmod 755 /etc/preinit.d/M20emptris

#emptriv. Note that this is a subdir.
cat <<-END > /etc/preinit.d/M30emptriv
#!/bin/bash
/programs0/emptriv/emptriv
END
chmod 755 /etc/preinit.d/M30emptriv

#empan. AFAIK, there is is command line only at the moment, hence the commenting out.
#Maybe some nice soul will hijackify it, and give a means of menu-selecting a file from a named directory
#cat <<-END > /etc/preinit.d/M40empan
# #!/bin/bash
# /programs0/empan
#END
#chmod 755 /etc/preinit.d/M40empan


#Lets be paranoid before exiting.
ro
rop

exit
Posted by: genixia

Re: /programs and preinit - the easy way. - 21/07/2002 08:55

This version has the mke2fs commands run with "-N 50000" so that there are enough inodes for emptriv
Posted by: genixia

Re: /programs and preinit - the easy way. - 21/07/2002 09:46

Ok, so how to use this - you obviously need hijack installed before you start.

Assuming that you don't have telnetd set up yet, you'll need a serial connection.

Download empeg-preinit.v3.tar.gz, emptelnetd.tar etc from riocar.org and save somewhere convenient. Download the second attachment above and save to the same place as mkprgpt

Get your serial connection, and press "q" to get a shell. Type "rw" to make the root drive writeable. Leave the connection open..

On your PC, ftp mkprgpt and emptelnetd.tar, and empeg-preinit (extract it from the tar first) to the empeg:

ftp empeg
put mkprgpt
put emptelnetd.tar
put empeg-preinit
bye


Back on the serial connection:

mv empeg-preinit /bin/hijack
chmod 755 /bin/hijack

tar xf emptelnetd
chmod 755 devs
mv telnetd /bin
chmod 755 /bin/telnetd
./devs
rm ./devs

chmod 755 mkprgpt
./mkprgpt


mkprgpt should have left all the drives read-only, so you should now be able to safely reboot..
After rebooting, you should be able to telnet into the empeg, and you'll find a new partition at /programs0 ready for your apps. (and also /programs1 if you have 2 drives). To make these new paritions writeable, run "rwp". Remember to run "rop" before rebooting to make them read-only again, although at 32MB, they shouldn't take long to fsck if you forget.

If you put the empacman in /programs0 and chmod it to 755, then after a reboot, it will automagically appear in the hijack menu.
Put the emptriv distribution into a subdir /programs0/emptriv, and that should also appear.


I think it's time for an empeg LSB.

Posted by: mandiola

Re: /programs and preinit - the easy way. - 21/07/2002 12:15

Hrmm.. i cant seem to get emtriv to run, any ideas?. Also, can empgps be ran from here (preferably with the -s- switch on the player so it doesnt get messed up from my gps segnals).

Thanks!,
Greg
Posted by: genixia

Re: /programs and preinit - the easy way. - 21/07/2002 13:35

Yeah, just found that one myself - I needed to edit the /etc/preinit.d/M30emptriv so that it looked like:

#!/bin/bash
cd /programs0/emptriv
/programs0/emptriv/emptriv


This will start emptriv from it's own directory so that it can find it's font file. I've made the change to my script - attached. If you remove the /etc/preinit.d directory, it'll get recreated correctly when you rerun the script.
Posted by: genixia

Re: /programs and preinit - the easy way. - 21/07/2002 13:40

I haven't looked at empgps yet. Does it bind to the hijack menu? It it does, then you should be able to. Let me look into it.
Posted by: genixia

Re: /programs and preinit - the easy way. - 21/07/2002 13:58

Now with empgps support. And yes, it appears to work
Posted by: mandiola

Re: /programs and preinit - the easy way. - 21/07/2002 14:41

AHHHHH.. still cant get it to work... even if i cd to the dir in telnet and try to run it with ./emptriv i get the same error.

by the way... how did you get empgps to run.. you just posted empgps file not the script ; ) (edit: i got it to run.. just want to make sure i did it correctly)
-Greg
Posted by: genixia

Re: /programs and preinit - the easy way. - 21/07/2002 19:10

Oops. My mistake, I was rushing out to see MIB2... ([censored] hilarious BTW)..

What error are you getting with emptriv? Check the permissions on all the files in emptriv. In fact, just blast them all to 755 to be sure... chmod 755 *

Here's the latest version of my script. This time I promise that it's not empgps!
Posted by: mandiola

Re: /programs and preinit - the easy way. - 21/07/2002 23:24

Thanks.. i got it to work... now the only problem is that emptriv and empgps dont play well together... when i try to use emptriv, empgps popsup in front of it... if i move the knob i can see emptriv popup but then go immediatly to the background. ; /

-Greg
Posted by: mandiola

Re: /programs and preinit - the easy way. - 21/07/2002 23:35

Hrmm.. now that i try empgps it doesnt run very well at all... it start up about a minute after the player and once you run it you cant get back to the player.. and now it doesnt even read my gp... heh.. this is odd.

-Greg
Posted by: TedP

Re: /programs and preinit - removed menu entry: - 21/07/2002 23:39

this rocks.. a well spent 2 hours!

but when i invoke emptriv, i see--
hijack: removed menu entry: "empacman".

empacman then disappears from hijack. if i invoke empacman, i see the same message, but the menu does not disappear!

hmmmm...?

-ted
Posted by: genixia

Re: /programs and preinit - removed menu entry: - 22/07/2002 05:08

Yeah, some of the apps still don't play nicely together - these are either application or hijack problems - I suspect application problems as it isn't consistent, and should be addressed in a thread specific to the app. The emptriv/empacman menu thing has been noted before, and hopefully should be addressed soon.

The empgps/emptriv thing I haven't heard of before.. Can you mention it in a relevant thread?
Posted by: mandiola

Re: /programs and preinit - the easy way. - 24/07/2002 09:39

Ok i think I figured out why empgps gets all weird... the guy who wrote it said to load the player using the -s- switch... right now you have empgps loaded with the -s- switch..... i think it has to be the player part wich is loaded with it. Is there any way to do this?

-Greg
Posted by: genixia

Re: /programs and preinit - the easy way. - 24/07/2002 10:05

/me goes scurrying to check this out.

Posted by: genixia

Re: /programs and preinit - the easy way. - 24/07/2002 10:10

Yep you're right. I'll find a fix.
Posted by: mandiola

Re: /programs and preinit - the easy way. - 24/07/2002 10:18

Cool.. Thanks for all the help.

-Greg
Posted by: genixia

Re: /programs and preinit - the easy way. - 24/07/2002 10:51

Ahh, not so easy to do - the command line that starts the player is embedded into the /bin/init binary that we don't have the source to. It may be that turning serial off can be achieved through a config.ini parameter - I'll ask you to check that out (and report back!).

If not, the only real solution that I see is to move the player binary to /empeg/bin/player.bin and create a shell script that calls it with the -s- option. But that would have ramifications for things like upgrades and stuff Certainly not something I really want to put on *everyone's* empeg. Let me look at that.
Posted by: Armin

Re: /programs and preinit - the easy way. - 24/07/2002 11:33

Great stuff!
Boy, you don't follow this BBS for a couple weeks and look what happens!

I got dnetc to work this way, keeping /programs0 always in rw mode so dnetc can store it's files there. Any concerns about doing this?

Also, while I was toying around in the shell, something kept spitting numbers at me that looked like this:
F404a
F404c
F404e
F4050
F4052
F4054
F4056
F4058

what gives?

Armin
Posted by: tfabris

Re: /programs and preinit - the easy way. - 24/07/2002 11:37

Those numbers are the FIDs it's playing. That's what you get when you enable the "notify=1" flag in the config.ini.
Posted by: Armin

Re: /programs and preinit - the easy way. - 24/07/2002 11:38

Oh, and I thought that should only happen while the player is running...

Armin
Posted by: genixia

Re: /programs and preinit - the easy way. - 24/07/2002 12:11


I got dnetc to work this way, keeping /programs0 always in rw mode so dnetc can store it's files there. Any concerns about doing this?


No major concerns - the worst you could do is trash that one 32MB partition, but in practice ext2fs and fsck are pretty resilient. Worst case scenario is having to rebuild that one parition - but at least your music paritions would be fine. In the long run I'm hoping that the excellent ext3 work being done can be included into hijack, and this issue disappears.
Posted by: andym

Re: /programs and preinit - the easy way. - 24/07/2002 14:05

I've been asking about this for a while as I'm writing my own GPS display, complete with compass and pointer! I'll try and post a piccy.
I've tried the renaming of player and putting a script in it's place, this causes Hijack to have a fit and stop reading it's config file. If someone could help, that would be great.
Posted by: wfaulk

Re: /programs and preinit - the easy way. - 24/07/2002 16:45

The way I did that was to make the last N script that preinit executes run the player with the -s- option. Since it won't return, it will never get around to running the real init.

It will return, though, if you exit the player (does this happen when syncing?), so you might want to put it in a loop emulating the stock init, if you care.
Posted by: genixia

Re: /programs and preinit - the easy way. - 24/07/2002 17:43

Yeah, this is the only solution that I can see at the moment. Just another observation - running the player with the -s- option also means that you wont be able to get to a serial prompt. So either install telnetd (but not if you use your empeg on a public/work network - or remember that you can use ftp to obliterate that preinit script should you ever need to get to the shell prompt.

There is another option - *Don't* put the command in a loop, and ensure that you have quit=1 in your config.ini (can't remember which section - check the FAQ). That way you can use the Quit menu item when it's necessary to get a shell prompt. This will cause the -s-'d incarnation of the player to exit and then the real init will then run, starting the player in stock form, hence making the serial port available for shell access.

I don't really think that losing your empgps-capable player when syncing is really an issue - I'm guessing that you only sync at home, and only use empgps in the car...
Posted by: tman

Re: /programs and preinit - the easy way. - 24/07/2002 17:53

Do people want a proper login for the telnet daemon? I never bothered with it since by default the HTTP, FTP and emplode interfaces were wide open. But I guess some people disable those when at work.

- Trevor
Posted by: drakino

Re: /programs and preinit - the easy way. - 24/07/2002 18:43

I got dnetc to work this way, keeping /programs0 always in rw mode so dnetc can store it's files there

If you want to reduce the risk, run the buffers out of a ramdrive. I did this with no problem back on my Mark 1, so there should be plenty of room for a RAM drive capable of holding a few thousand blocks. I ran a script that copied the buffers back to disk from time to time, remounting the drive each time. Only issue I had whas when it played with the mounts in the middle of an emplode session, but using the 32meg partition should resolve that as well.
Posted by: genixia

Re: /programs and preinit - the easy way. - 24/07/2002 19:58

Yes!

The ftp has a password mechanism for those who choose to use it, and httpd is fairly limited in the damage it could cause, but telnet is just too powerful to run without a password. Ok, so telnet in general should be banned because of the inherent sniffibility of the protocol, but at least a password would mean that someone would have to sniff or guess it first before wreaking havoc on your empeg - at the moment they just have to be curious enough to try connecting.

I'm trying to cross-compile sshd at the moment. I have no idea how feasible that is...but I'm trying
Posted by: wfaulk

Re: /programs and preinit - the easy way. - 24/07/2002 20:02

I was trying to do it, too, but I was too lazy to actually get started. One thing that occurred to me is that utilizing only RSA/DSA keys for authentication would be a good idea.
Posted by: tms13

Re: /programs and preinit - the easy way. - 25/07/2002 02:01

In reply to:

The way I did that was to make the last N script that preinit executes run the player with the -s- option. Since it won't return, it will never get around to running the real init.

It will return, though, if you exit the player (does this happen when syncing?), so you might want to put it in a loop emulating the stock init, if you care.


Perhaps preinit should come with a file to run the player (N99player, I guess), rather than having it compiled-in. Then people could easily play with the script, remove it, or override it (using their own N90player that doesn't return, for instance).
Posted by: mandiola

Re: /programs and preinit - the easy way. - 25/07/2002 02:07

Cool. I used the -s- switch in N20Mount right at the end to load the player... now all the programs seem to play nice. I am testing it more now... im sure something will come up.. hehe

[edit]: Now the only problems seem to be that the programs unbind themselves from hijack after they are run and another program is run after them.. hrmmm....

Thanks,
Greg
Posted by: wfaulk

Re: /programs and preinit - the easy way. - 25/07/2002 10:45

It actually runs /sbin/init as its last function.

I don't know that that default init only starts the player. In fact, I'm pretty sure that it also mounts filesystems. It might do other things, as well. I don't want to bypass it by default. That doesn't make it any more difficult to create a script that does, though. Maybe I should just point that out in some docs somewhere.
Posted by: tonyc

Re: /programs and preinit - the easy way. - 25/07/2002 11:49

I always thought Frank van Gestel's modified init was pretty cool. It's the one I use. It calls a shell script (/sbin/userinit I believe) to do init type stuff. You manually call the player when you want to in that script rather than being at the mercy of how init handles it. It lets you get pretty fancy with how you set things up, and if it can't find /sbin/userinit, it just calls the stock init, or if something fails, it drops to a shell so you can fix things.

Too bad it's not on the Empeg distribution. That'd be nice.
Posted by: Mitsu7374

Re: /programs and preinit - the easy way. - 26/07/2002 15:54

I am having trouble with this program. I have it loaded and running on the serial port. At home it runs fine from the Hijack menu but in my car it gets all funky. It switches from Aux to Player back and forth making it impossible to play. I tried switching to Aux mode then playing from hijack menu but same results. Any ideas?
Posted by: AndrewT

Re: /programs and preinit - the easy way. - 26/07/2002 16:24

I configured empeg-preinit v3 etc. manually and also had this problem in-car so it's probably not a problem with genixia's shell script as such. FWIW, at the time I would have been running 2.0b11, pre-init v3 & Hijack 276.

It only occured during one 'sitting'. Pulling the player from the sled didn't make any difference and (AFAICR) I had to select Player as the music source to get rid of it.

That was earlier this week and was the first (and last) time it happened.
Posted by: Mitsu7374

Re: /programs and preinit - the easy way. - 26/07/2002 16:51

I pulled mine from the car. Deleted empacan. Put it back on player and it is working fine now. Must have been an freaky thing. Oh well, all is good now.
Posted by: tman

Re: /programs and preinit - the easy way. - 26/07/2002 17:32

Okay. I'll give it a go tommorow when I've got some spare time

- Trevor
Posted by: andym

Re: /programs and preinit - the easy way. - 27/07/2002 03:02

I got exactly the same thing with my GPS code, it runs fine when plugged in at home but when it's in the car, it just goes apesh*t and the only way to stop it is by pulling the player out of the dash and popping it back in. I've so far not been able to fix this problem.
Posted by: FlibblE

Re: /programs and preinit - the easy way. - 28/07/2002 15:42

I've been trying out running the player from a preinit script but I can't seem to get it working! The script I made basically calls /empeg/bin/player -s-

The error I get looks like this (on the serial port):

! empeg_id.cpp : 49:Unable to open /proc/empeg_id
player.cpp : 385:empeg-car 2.00-beta13 2002/07/24.
! player.cpp : 291:MainThread::Init failed!
bin dev drive0 drive1 empeg etc lib lost+found mnt proc sbin swapfile tmp usr va
r

dunno if that last line is relavent! but it seems to me that /proc isn't mounted yet. Does this get mounted by the stock init? If so, what's everyone doing to get round this?

Another thing that I can't get my head round is if it doesn't return, doesn't pre-init time out, quit and carry on anyway, running the stock init?

Cheers.
Posted by: wfaulk

Re: /programs and preinit - the easy way. - 28/07/2002 19:20

    Another thing that I can't get my head round is if it doesn't return, doesn't pre-init time out, quit and carry on anyway, running the stock init?
Ummm. Yeah. I forgot I put that in there. In v5, I plan to put in the facility for there to be a single `B' script that will prevent that from happening.

And I imagine that the stock init mounts pretty much everything except the root filesystem (already mounted) and the /drive0 and /drive1 filesystems (as it remounts them during syncs, so I figure it just retains control over them altogether). Just place a ``mount /proc'' in your script somewhere before it blocks. Of course, you'll need to wait for v5 before it'll be useful, huh?
Posted by: FlibblE

Re: /programs and preinit - the easy way. - 29/07/2002 01:39

Ah, that's ok then! Roll on v5!

Does the stock init just mount /proc before running the player? or is there more to it than that? Just a thought: perhaps there could be a sample 'B' script that includes stuff that the stock init does - if it's more than just mounting /proc!

I'll give it a try later, mounting /proc first and see if it complains any more. Just gotta knock together a power supply - i'll see what I can rob around work!

Cheers.
Posted by: wfaulk

Re: /programs and preinit - the easy way. - 29/07/2002 01:57

I don't honestly know. I'm just making assumptions.
Posted by: anti

Re: /programs and preinit - the easy way. - 29/07/2002 02:38

I have sshd running for quite a while now (~01/2001),
but the disk with the toolchain on it died.

Since the crosscompile was super simple (just follow the manual) I never bothered with writing a howto.

One drawback:
If you log in via pub/priv-key while playing a tune, it can take a while to have that key calculated
Posted by: genixia

Re: /programs and preinit - the easy way. - 29/07/2002 07:41

Since the crosscompile was super simple (just follow the manual) I never bothered with writing a howto.

Hmm, Looks like I missed that manual somehow. zlib and openssl have compiled easily, but openssh is being a PITA.
/me goes off a hunting.

Did you compile statically? Do you still have the binaries? That is all we really need
Posted by: wfaulk

Re: /programs and preinit - the easy way. - 29/07/2002 13:19

Maybe he compiled up the non-open ssh.... It is more monolithic, at least....
Posted by: tman

Re: /programs and preinit - the easy way. - 29/07/2002 17:20

I've got OpenSSH 3.4p1 working on the empeg but the install instructions are a little long so I need to write a nice simple install script for it. I'll do it tommorow because I'm really sleepy at the moment.

Oh yeah. Key generation on the empeg takes AGES...

- Trevor
Posted by: anti

Re: /programs and preinit - the easy way. - 30/07/2002 02:21

hmmm ... looks my self compiled ssh is gone,
but:
# dpkg -l|grep ssh
ii ssh 3.4p1-1 Secure rlogin/rsh/rcp replacement (OpenSSH)

I guess installing debian might solve your problem ... as usual.

I'll skim through my old backups anyway, maybe I find the static binary somewhere.
Posted by: FlibblE

Re: /programs and preinit - the easy way. - 30/07/2002 05:09

Mounting /proc and /drive0 seems ok but I still get this error after the player starts:

! mp3_decoder.cpp :1049:Failed to find valid sync after seeking to offset 3471
990, error=0xc0044000

When pre-init times out and runs the stock init, I don't get that error.

Oh well, anyone know where I can get the modified init by Frank van Gestel's mentioned earlier on?

Edit: Found it: http://empeg.comms.net/php/showthreaded.php?Cat=&Board=empeg_tech&Number=20407&Search=true&Forum=All_Forums&Words=modified%20init%20%2Fsbin%2Fuserinit&Match=And&Searchpage=0&Limit=25&Old=allposts&Main=18016
Posted by: frog51

Re: /programs and preinit - the easy way. - 30/07/2002 08:15

>>! mp3_decoder.cpp :1049:Failed to find valid sync after seeking to offset 3471
990, error=0xc0044000

I can't remember which thread it was discussed in, but isn't that error merely caused by the player starting mid song?? And as such, pretty much a non-error.
Posted by: wfaulk

Re: /programs and preinit - the easy way. - 30/07/2002 11:57

Yeah. It definitely happens occasionally to very often, with or without any additional software. IIRC, it has something to do with the player not quite jumping to the right spot in VBR files, but I could easily not be RC.

Sigh. I guess I'll spend the ten minutes and hack up a blocking version. Gimme a few.
Posted by: wfaulk

empeg-preinit.v5-beta - 30/07/2002 12:35

Okay, for those of you that want to block the normal init sequence, I've put out an empeg-preinit.v5-beta. It's just the binary. It's not been tested. But you should be able to create scripts that start with a `B' and expect them to be run in order after the `N' scripts, but the timeout has been defeated while they run. The idea is to just have one `B' script, but you can have multiple ones if you want, for some reason.

Make absolutely sure that your `B' script works properly. Otherwise you'll have to reflash the whole system to get it back to a working state. I'd suggest not putting it in a loop to begin with, so that if it fails it can exit and go back to the normal init.

Lemme know how it turns out.
Posted by: tman

Re: /programs and preinit - the easy way. - 30/07/2002 18:31

Still messing about trying to get this to run with reasonable speed. It's excruciatingly slow at the moment...

- Trevor
Posted by: genixia

Re: empeg-preinit.v5-beta - 30/07/2002 20:48


Make absolutely sure that your `B' script works properly. Otherwise you'll have to reflash the whole system to get it back to a working state.


Couldn't you nuke a bad B script via ftp?
Posted by: wfaulk

Re: empeg-preinit.v5-beta - 30/07/2002 22:38

IIRC, Hijack's FTP server is not running at that point in the startup process.
Posted by: genixia

Re: empeg-preinit.v5-beta - 30/07/2002 22:57

Hmm, Hadn't thought about that - you might be right though. It's a good idea to install telnetd to /bin then
Posted by: wfaulk

Re: empeg-preinit.v5-beta - 30/07/2002 23:18

Now that's a good idea.
Posted by: tms13

Re: empeg-preinit.v5-beta - 31/07/2002 04:15

In reply to:

Make absolutely sure that your `B' script works properly. Otherwise you'll have to reflash the whole system to get it back to a working state.


Is kftpd not active by then? I thought it was possible to (re)move your B scripts by FTP, then reboot.
Posted by: wfaulk

Re: empeg-preinit.v5-beta - 31/07/2002 14:21

See above.
Posted by: durden

Re: /programs and preinit - the easy way. - 05/08/2002 22:57

Thanks for the script and the instructions, worked great for getting me set up with telnetd and getting empacman bound to the hijack menu. One question though.... And I think this was mentioned somewhere (maybe in another thread) dealing with empacman and emptriv I think..

I had empacman working great, it would bind everytime I started up and be in the hijack menu and work fine. I decided to add empsoko, but found out that it would not bind automatically (just by putting it in the /programs0 directory, I figured that out, you just dont have an empsoko entry in the preinit.d directory ).. Well I *thought* I had it figured out, I would just need to add it as something like M70empsoko and put the necessery lines in the file..

Sure enough, after I made that file and rebooted, they were both in the Hijack menu. I started up empsoko, and it worked great. But unfortunately, now the empacman menu entry *also* loads empsoko.. So.. where do I go from here?

Posted by: tman

Re: /programs and preinit - the easy way. - 06/08/2002 08:48

There is a bug in Hijack which for some reason prevents you from having two user apps. I'll have a look at the kernel code later on but I can't guarantee anything because I'm quite busy. So if anybody else wants to fix it in the mean time...

- Trevor
Posted by: durden

Re: /programs and preinit - the easy way. - 08/08/2002 16:59

Nothing against your script.. but..

How do I undo the changes that were made to my empeg by it? I'm somewhere past a linux newbie and way from being an expert, but I get lost in all the bash programming.. I'd like to keep the /programs0 etc, but remove most of the other changes that were made by it..

Thanks..
Posted by: tman

Re: /programs and preinit - the easy way. - 08/08/2002 17:14

I'm assuming you mean the script in the telnetd package???
That's the only one I can think of that I wrote...

All it does it create some extra device files in /dev/ which are used for the telnet daemon. They're harmless and won't affect anything else.

The files it creates are ttyp0 to ttypf and ptyp0 to ptyf. You can get rid of them if you don't want the telnet daemon.

If you're talking about the big script at the top of this thread to setup preinit then that's nothing to do with me Ask genixia

- Trevor
Posted by: durden

Re: /programs and preinit - the easy way. - 08/08/2002 19:10

haha.. my bad
Posted by: durden

Re: /programs and preinit - the easy way. - 08/08/2002 19:14

So... yes, I was referring to genixia's script.. How do I undo the changes to my empeg that were added from your script? I mean, I know it created that /programs0 directory, and added some preinit files for empacman etc, but what other things did it do? (I tried looking through the script myself to figure out what to undo, but I just got really confused..

Thanks!
Posted by: genixia

Re: /programs and preinit - the easy way. - 09/08/2002 05:12

1) Formatted paritions. I doubt you want to undo this.
2) Created mount points. Ditto.
3) Update /etc/fstab so that you can 'mount -n -r /programs0' etc. Again, it sounds like to need to keep this.
4) Created 2 utilities 'rop' and 'rwp' so that you can easily re-mount the new partitions read-only or read-write. These are in /bin. You can remove them if you want, but then you will need to manually remount partitions for writing, and back to read-only. cat /bin/rop and cat /bin/rwp to see how.
5) Created /etc/preinit.d and populated it with scripts. If you removed the entire directory, then the new partition wont be mounted at boot, so you may want to keep the N20mount script. But you can cd /etc/preinit.d and remove the others if you so desire.

That's all.
Posted by: jets

Re: /programs and preinit - the easy way. - 10/09/2002 14:07

Get your serial connection, and press "q" to get a shell. Type "rw" to make the root drive writeable. Leave the connection open..

can someone explain how to do this please?
Posted by: tfabris

Re: /programs and preinit - the easy way. - 10/09/2002 14:21

Why don't you start here which is the FAQ entry for "How do I send and receive files from the player?"

Note that if you've got Hijack installed, a serial connection is not necessary, you can use FTP. You'll still need the serial connection to launch the applet, and links to that are included in the document I just linked.
Posted by: image

Re: /programs and preinit - the easy way. - 06/10/2002 10:08

i was just thinking.....

how about just make /etc/preinit.d a symbolic link to a directory in /program0/. that will allow people to keep their custom preinit scripts from being deleted on a player reflash.
Posted by: image

Re: /programs and preinit - the easy way. - 06/10/2002 10:20

crap, i tried it, and just did a chicken or the egg deal.

how can i store preinit.d on a partition that needs to use preinit.d to mount itself.

duh.
Posted by: wfaulk

Re: /programs and preinit - the easy way. - 06/10/2002 10:33

That gives me an idea. I could have preinit attempt to mount /programs0 and if it's successful and /programs0/preinit.d exists, use that directory, otherwise fall back to /etc/preinit.d.

I'll see if I can't incorporate those bugfixes from another post and do this later on today.
Posted by: genixia

Re: /programs and preinit - the easy way. - 08/10/2002 06:49

That sounds like a plan to me

I wonder if it's worthwhile attempting to mount /programs1 at the same time so that we can remove the N10mount script totally? (..but only use /programs0 for your conditional...)