Unoffical empeg BBS

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

Topic Options
#68027 - 06/02/2002 22:29 my first useful empeg program: Starter
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
After a bit of futzing I came up with what I think is/will be a useful empeg program. It's a Starter program which starts (hopefully) other userland apps, this is useful in the case that you use a userland app only occasionally, so you don't want to add it to your startup script, thus slowing boot times and taking valuable memory. The idea of the Starter program is that it only starts programs when you need them. Basically you provide it a configuration file and for each entry it will bind to the hijack menu and provide you with a way of starting the program you want. I've attached the source, and an example configuration program.
So far the only program I've been able to start is empegVNC, I'm trying to start EmpTriv but it needs it's current directory to be where it's installed and unfortunately I can't figure out how to make a script to change the working directory.. it just keeps says "Invalid file or directory" when I do a "cd /drive0/var/emptriv" in the script, even though this works at the prompt itself.. any ideas anyone (I'm not smart with linux btw)? Make sure to start this program with a '&' at the end, and all programs in the script file should have the '&' too of course.


Attachments
66163-starter.zip (66 downloads)


Top
#68028 - 07/02/2002 10:09 Re: my first useful empeg program: Starter [Re: siberia37]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
/drive0 won't be mounted when you're trying to do this. You'll have to manually mount the filesystem and then unmount it afterwards, so as not to confuse the process that eventually gets around to mounting it.
_________________________
Bitt Faulk

Top
#68029 - 07/02/2002 10:22 Re: my first useful empeg program: Starter [Re: wfaulk]
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
Don't think this could be the case since the Starter program runs as a background process along with the player. You cannot tell it to start a program until after the player is running since it binds to hijack's menus. So are you saying the player unmounts /drive0 and mounts it as something else?? Also this still doesn't explain why I can't make a startup script with these contents:
cd /drive0/var/emptriv
emptriv&
and have it work when run from the serial console does it? Is there some other way to change working directory in linux besides "cd"??

Top
#68030 - 07/02/2002 10:23 Re: my first useful empeg program: Starter [Re: siberia37]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Sorry. I made an unreasonable assumption.

Edit: I took a look at your source, and I'm unsure about the reasons you're doing things the way you are. First, shell scripts should have their first line set to ``#!/bin/sh'' (or whatever shell you want to use), and should be set as executable. Second, it seems like a waste of resources to start bash via execve() in order for it to just execute other commands, unless you want to be able to execute commands like ``cd /drive0/var/emptris && ./emptris'', which would, in all honesty, probably solve your problem here.

My guess is that you're trying to execute startemptris by execve()ing ``/bin/sh -c startemptris''. First, the `-c' tells bash that the arg following is a shell command, instead of a script. Second, startemptris is probably not in bash's search path, so you'd need to specify a path to startemptris, even if it's just ``./startemptris''. Third, I'm guessing that startemptris isn't executable, so it'll still fail. My guess is that you should try to start the programs without necessarily executing bash to start them. Just run the programs directly and make sure that they're properly configured. That way, your program could run both shell scripts and binary executables, plus you avoid that useless overhead.

Also, you don't need to `&' empegVNC; it backgrounds itself, or at least the newer versions do.


Edited by wfaulk (07/02/2002 10:43)
_________________________
Bitt Faulk

Top
#68031 - 07/02/2002 10:23 Re: my first useful empeg program: Starter [Re: siberia37]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14491
Loc: Canada
Actually, hijack is up and running long before the player, so you can bind to Hijack menus much earlier..

Top
#68032 - 07/02/2002 10:27 Re: my first useful empeg program: Starter [Re: mlord]
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
sure but the user couldn't select anything from the menu until after the player starts right? Therefore nothing will get executed by the starter until after the user selects "Start userlandapp" and /drive0 is mounted.

Top
#68033 - 07/02/2002 10:29 Re: my first useful empeg program: Starter [Re: siberia37]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14491
Loc: Canada
Well, actually, you can select from the Hijack menu *anytime* after the hijack boot "splash" message, like while Tux is waving at you..

Top
#68034 - 07/02/2002 10:32 Re: my first useful empeg program: Starter [Re: mlord]
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
hmm did not know this, will have to try this sometime, always assumed player had to be running for hijack to come up.

Top
#68035 - 07/02/2002 10:46 Re: my first useful empeg program: Starter [Re: wfaulk]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I edited the post that this is in reply to. Took longer than I thought (four more posts got added in the mean time), so I thought I'd draw your attention to it.
_________________________
Bitt Faulk

Top
#68036 - 07/02/2002 10:48 Re: my first useful empeg program: Starter [Re: siberia37]
Nosferatu
enthusiast

Registered: 24/08/2001
Posts: 344
Loc: France, Champagne
He Starter Works well for to start VNC server but i'd like to see how to stop it.

Maybe to see with wfaulk a command like empegVNC start | stop style and that stuff will be very cool !!!!!!!!
_________________________
Empeg IIa - 10 Gb - Red Fascia - Tuner, the day is coming - I Will Strike From the Grey -

Top
#68037 - 07/02/2002 12:35 Re: my first useful empeg program: Starter [Re: wfaulk]
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
>Edit: I took a look at your source, and I'm unsure about the >reasons you're doing things the way you are. First, shell >scripts should have their first line set to ``#!/bin/sh'' (or >whatever shell you want to use), and should be set as >executable.
I took out the #!/bin/sh for testing since I couldn't get it to work, the script was marked executable.

> Second, it seems like a waste of resources to start bash >via execve() in order for it to just execute other commands, >unless you want to be able to execute commands like >``cd /drive0/var/emptris && ./emptris'', which would, in all >honesty, probably solve your problem here.

This is quite true I'm sure, I thought about executing the files directly, but then I ran into this problem with a program needing a working directory. And now I just realized my mistake with the startemptriv script I didn't run ./emptriv I just ran emptriv (doh!).

Ok the next version of Starter will run programs directly. If you need to run scripts (like in this case) you can just put /bin/sh -c /myscript in the program config file. I'll also have to look into a way of killing a program after it's started.

On a side note to the killing a program idea.. does anyone know how to Unbind a menu item in hijack?? This is what I need so starter could start a program, unbind it's menu item and then bind a new menu item called "Stop EmpegVNC" or whatever




Edited by siberia37 (07/02/2002 12:42)

Top
#68038 - 07/02/2002 12:36 Re: my first useful empeg program: Starter [Re: Nosferatu]
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
I'll try to get stopping to work in the next version I make (which will hopefully be soon)..

Top
#68039 - 17/03/2002 12:25 Re: my first useful empeg program: Starter [Re: siberia37]
hybrid8
carpal tunnel

Registered: 12/11/2001
Posts: 7738
Loc: Toronto, CANADA
Any updates to your software recently?

Bruno
_________________________
Bruno
Twisted Melon : Fine Mac OS Software

Top
#68040 - 18/03/2002 09:16 Re: my first useful empeg program: Starter [Re: hybrid8]
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
Never got the idea people were much interested in it.. if there's any interest I'd finish it up. I was also working on a userland app installer program for installing apps on the empeg for newbies who don't know how to use a bash prompt. It would basically allow userland app designers to make a script file which the installer program would run and do things like install files, set executable permissions and hopefully even add it to the startup scripts (or to Starters list). Any interest in something like this? I have the app installer halfway done if anyone thinks this would be useful.

Top
#68041 - 18/03/2002 09:43 Re: my first useful empeg program: Starter [Re: siberia37]
ellweber
member

Registered: 14/01/2002
Posts: 156
Loc: Saratoga, CA, USA
Yes and Yes!!

Top
#68042 - 18/03/2002 10:14 Re: my first useful empeg program: Starter [Re: siberia37]
sancho
journeyman

Registered: 17/08/2000
Posts: 70
i, too, am interested in the app installer and starter...
--
sancho

Top
#68043 - 18/03/2002 20:19 Re: my first useful empeg program: Starter [Re: siberia37]
hybrid8
carpal tunnel

Registered: 12/11/2001
Posts: 7738
Loc: Toronto, CANADA
Since I popped this thread back to the top, YES from me as well. On both projects. The installer issue was just brought up in the empwake thread by Tony. He gave some good points on the stuff he'd really like to see supported.

Starter could be a really cool applet as well. It sounds perfect for launching apps you don't need launched when you first start the player. It will obviously be most useful as those apps start getting written and released... But it's good incentive.

Bruno
_________________________
Bruno
Twisted Melon : Fine Mac OS Software

Top
#68044 - 18/03/2002 22:24 Re: my first useful empeg program: Starter [Re: siberia37]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
I'm interested in seeing what you've got so far with this installer... We could use something like that.
_________________________
- Tony C
my empeg stuff

Top
#68045 - 19/03/2002 07:48 Re: my first useful empeg program: Starter [Re: tonyc]
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
I'll try to get a functional release of the App installing program released in the next couple days. I think I'm done with the code that actually does the app installing, now I'm going to work on the code that interprets the script and gives the user choices on where to install the app, whether it should be run always at startup or only from Starter etc..

When I'm done with that part I'd like to go around and collect some userland apps from here and put them in one package with install scripts. If a user wanted to install any of the apps they would just have to double-click on the install script (ideally).

Top
#68046 - 19/03/2002 09:43 Re: my first useful empeg program: Starter [Re: siberia37]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
When I'm done with that part I'd like to go around and collect some userland apps from here and put them in one package with install scripts. If a user wanted to install any of the apps they would just have to double-click on the install script (ideally).

Sounds great. I'm all for anything that makes my stuff easier to install. I also think you'd want to allow for the script to ask the user questions, e.g. "where do you want to install this to?"

Mike Schrag mentioned some good ideas on a common format for these install packages, and he seems willing to integrate this functionality into jEmplode. Not sure if what you have will complement what he's doing or not, but it's worth looking at.


Edited by yn0t_ (19/03/2002 09:44)
_________________________
- Tony C
my empeg stuff

Top
#68047 - 19/03/2002 09:57 Re: my first useful empeg program: Starter [Re: tonyc]
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
>Sounds great. I'm all for anything that makes my
>stuff easier to install. I also think you'd want to allow for >the script to ask the user questions, e.g. "where do you >want to install this to?"

It will definetly do this.. I plan on making a pretty wizard and everything and asking users if they want the app to start all the time, or only when they click "Start app" using Starter.

> Schrag mentioned some good ideas on a common format >for these install packages, and he seems willing to integrate >this functionality into jEmplode. Not sure if what you have >will complement what he's doing or not, but it's worth >looking at.

Ya.. looks like this would be a good job for Emplode. Oh well a little competition always helps improve products.

Top
#68048 - 19/03/2002 10:04 Re: my first useful empeg program: Starter [Re: siberia37]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Agreed. In typical capitalist fashion, I will support whichever product does the job best, and when the other does it better, I will shamelessly switch allegiance in a heartbeat.
_________________________
- Tony C
my empeg stuff

Top
#68049 - 19/03/2002 10:09 Re: my first useful empeg program: Starter [Re: siberia37]
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA
Let's definitely agree on the package formats, etc. so our apps can interoperate nicely ... Take a look at the App Installer thread that I spawned off of this one, and maybe we can get a discussion going about the right way to get this implemented.

Mike

Top