[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Idea: /proc/sys/fs/binfmt_misc/register in the policy?



On Thu, 17 Jun 1999 at 12:43:00 +0200, Peter Van Eynde wrote on
debian-policy:
> In the 2.2.x series there is a feature that allows the user to define
> shells for certain types of files. Selecting on extension or a few magic
> bytes. 
> 
> This could be useful for languages where the "#!" trick wouldn't work,
> like lisp. For the moment I have in a documentation-file:
> 
> #!/bin/sh
> echo ':lisp:E::x86f::/usr/bin/lisp-start:'  > /proc/sys/fs/binfmt_misc/register
> # this should only work for root under linux 2.1.XX or later
> # now you can do "chmod a+x hello.x86f" and
> # ./hello.x86f
> # from your favorite shell.
> 
> Is there sufficient interest to make a register-binary-format shell
> script (like update-inetd, or register-window-manager) and put it into
> the documentation?

I know this was a long time ago, but I've since written a tool called
update-binfmts and uploaded it to unstable in the binfmt-support
package. Using that, a package could do the above by putting this in its
postinst:

  if [ "$1" = configure ]; then
    /usr/sbin/update-binfmts --package foo \
      --install lisp /usr/bin/lisp-start --extension x86f
  fi

... and the following in its prerm:

  if [ "$1" = remove ]; then
    /usr/sbin/update-binfmts --package foo \
      --remove lisp /usr/bin/lisp-start
  fi

Binary format registrations are stored in /var/lib/binfmts, and an init
script enables them at boot time.

Any comments? I realize it will have to be in reasonably widespread use
before the suggestion above to put something like this in policy could
be implemented.

Cheers,

-- 
Colin Watson                                     [cjw44@flatline.org.uk]



Reply to: