Mailing List Archive

simple 'binfmtload' script in python
--r5Pyd7+fXNt84Ff3
Content-Type: text/plain; charset=us-ascii

greetings,

in an effort to move forward with another project I've been working on, I
wrote up a simple script that tells a linux 2.2.x kernel how to execute a
java binary.

I based this script on information in /usr/src/linux/Documentation/java.txt
and experimentation.

it seems to work for me. I'd like to know if anyone else finds it useful, or
has ideas on how it can be improved. it's terribly simple, but it get's the
job done.

regards,
J
--
|| visit gfd <http://quark.newimage.com/>
|| psa member #293 <http://www.python.org/>
|| New Image Systems & Services, Inc. <http://www.newimage.com/>

--r5Pyd7+fXNt84Ff3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="binfmtload.py"

#!/usr/bin/env python

fp = open("/proc/sys/fs/binfmt_misc/register", "w+b")
fp.write(":Java:M::\xca\xfe\xba\xbe::/usr/local/java/jdk1.2/bin/java:\n")
fp.close()
fp = open("/proc/sys/fs/binfmt_misc/register", "w+b")
fp.write(":Applet:M::<!--applet::/usr/local/java/jdk1.2/bin/appletviewer:\n")
fp.close()

--r5Pyd7+fXNt84Ff3--