From c2def933f780ba16f6390e9733bb1f1bda0bf5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 12 Sep 2011 20:31:47 +0200 Subject: [PATCH] Add a script to handle binfmt.d directories. binfmt.d/ directories contain binfmt_misc entries (one per line, in format suitable for echoing into /proc/sys/fs/binfmt_misc/register). --- init.d/Makefile.Linux | 4 ++-- init.d/binfmt.in | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 init.d/binfmt.in diff --git a/init.d/Makefile.Linux b/init.d/Makefile.Linux index 5e57426..31c7d67 100644 --- a/init.d/Makefile.Linux +++ b/init.d/Makefile.Linux @@ -1,7 +1,7 @@ NET_LO= net.lo -SRCS+= devfs.in dmesg.in hwclock.in consolefont.in keymaps.in killprocs.in \ - modules.in mount-ro.in mtab.in numlock.in procfs.in sysfs.in \ +SRCS+= binfmt.in devfs.in dmesg.in hwclock.in consolefont.in keymaps.in \ + killprocs.in modules.in mount-ro.in mtab.in numlock.in procfs.in sysfs.in \ termencoding.in .SUFFIXES: .Linux.in diff --git a/init.d/binfmt.in b/init.d/binfmt.in new file mode 100644 index 0000000..04f3b9e --- /dev/null +++ b/init.d/binfmt.in @@ -0,0 +1,35 @@ +#!@PREFIX@/sbin/runscript +# Copyright (c) 2011 +# Released under the 2-clause BSD license. + +description='Associate binaries from binfmt.d using binfmt_misc' + +depend() +{ + need procfs + use localmount +} + +start() +{ + local f bn + + ebegin "Registering binfmt_misc executables" + eindent + for f in \ + /run/binfmt.d/*.conf \ + "@SYSCONFDIR@"/binfmt.d/*.conf \ + "@PREFIX@"/usr/lib/binfmt.d/*.conf + do + # XXX: we should check for duplicates + # right now, we just assume their names will collide and registrar + # will ignore them + + if [ -r "${f}" ]; then + ebegin "${f}" + grep '^[;#]' "${f}" > /proc/sys/fs/binfmt_misc/register + eend ${?} + fi + done + eoutdent +} -- 1.7.6.1