dumb question - run script / command at startup


sswam

Advanced Member
Joined
Dec 16, 2009
Messages
1,393
hi, I want to run a certain command each time the Pandora boots up.

And I want to make an installer PND, which causes that command to be run at boot.

Where's the best place to put my boot-time command or script?

At the moment on my own Pandora, I'm adding a new little script in /etc/rc5.d/

Is there another place that would be better?

The script I want to run in this case is a binfmt hack to make .pnd files directly executable, something like this:

mount -t binfmt_misc none /proc/sys/fs/binfmt_misc

echo ":squashPND:M::hsqs::/usr/bin/pnd_run:" >/proc/sys/fs/binfmt_misc/register
 
Last edited by a moderator:
Does this hack work well? Maybe it would be useful in firmware by default.

Other than that it should probably go to /etc/rc5.d/ as a new file like you say, if you overwrite anything a firmware update might revert it.
 
it propably only works for squashfs'd pnd files... you propably could write a line for iso9660 but that would also make .iso's executable (like that one makes random squashfs files executable), but it might be just fine (maybe make sure pnd_run does a graceful exit if you try to do something wtf like that)...
 
Does this hack work well? Maybe it would be useful in firmware by default.

Other than that it should probably go to /etc/rc5.d/ as a new file like you say, if you overwrite anything a firmware update might revert it.
Thanks Notaz.

The binfmt hack is helping me launch commands from an unmounted pnd directly, so I can type like:


mplayer foo.avi
/usr/local/bin/mplayer is a symlink to my smplayer2.pnd

The binfmt hack runs a script "pnd_exec", which mounts the PND, finds "mplayer" in it, and execs it with the original arguments.

This is working well for me, I can run commands such as mplayer, make, gcc as if they were installed on the root.

It's not ready for prime time yet:

  - relies on symlinks, so won't work with vfat

  - some inconsistencies with the way PNDs are normally run / mounted

I am thinking to implement a simpler version of the pnd system.

it propably only works for squashfs'd pnd files... you propably could write a line for iso9660 but that would also make .iso's executable
 

Yeah, I might add isofs binfmt hack, but I'm trying to keep this short and simple, and barely any PNDs use isofs.

 

I'm not worried about making .isos or squash filesystems executable:

  - on a proper FS, just don't chmod +x them

  - my pnd_exec script can refuse to run files without the .pnd extension

  - on FAT / ntfs where everything is +x, there are bigger problems - all text files can be executed as shell scripts!

 

 

About my "simpler version of the pnd system", some ideas:

 

- transparently run commands from an unmounted PND

- lazy unmounting, keep PNDs mounted until we need to unmount them

- appdata name and mount point are based on the PND filename, not metadata

- PND filename does not change between versions

- I'd like to get rid of or ignore the PXML metadata, I don't like XML for that purpose

- if it's wildly incompatible, I will call this "box" instead of "pnd", and use the file extension ".box"

- fancy features by means of helper scripts, not part of the main "mount and run" system

- somehow encourage to provide source code

- a PND upgrade feature

- better multi-user / home directory support
 
Back
Top