On Tue, Jun 14, 2011 at 01:25:42PM +0200, Julian Andres Klode wrote: > On Tue, Jan 25, 2011 at 03:44:29PM +0100, Loïc Minier wrote: > > On Mon, Jan 24, 2011, Loïc Minier wrote: > > > While we could try parsing binfmt-support's format or binfmt_misc's > > > format, I think the best thing here would be to check with the > > > binfmt-support maintainer. I wonder whether binfmt-support is > > > Debian/Ubuntu specific. If it is, then poking the kernel format or > > > trying to run a binary might be best. If it's also used on other > > > distros, perhaps we can get some command which tells us what the > > > interpreter is for a specific binary. If that makes sense to you, I > > > can poke Colin about it, and perhaps open a bug report for the > > > binfmt-support changes. > > > > I've asked Colin about this, and he implemented support for that in > > trunk! :-) (I tested it, there was an issue in the original version > > but r109 fixed it) > > > > (bzr+ssh://bzr.debian.org/bzr/binfmt-support/trunk or > > http://bzr.debian.org/binfmt-support/trunk) > > > > % sudo apt-get build-dep binfmt-support > > % ./configure && make > > % src/update-binfmts --find $chroot/bin/true > > /usr/bin/qemu-arm-static > > > > Note that the --find might return multiple interpreters; in this case, > > the kernel tries them one by one. > > > > Perhaps we should do something like find the first static interpreter, > > or always copy the first interpreter and warn if there is more than > > one? > > > Attaching my solution for this. > Updated as per IRC comments. Changes since v1:
* Run in setup-recover as well * Reindent in accordance to other schroot scripts * Simply touch the emulator if it does not exist yet instead of trying to write a script there. -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
#!/bin/sh # Copyright © 2011 Julian Andres Klode <j...@debian.org> # # schroot is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # schroot is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see # <http://www.gnu.org/licenses/>. # ##################################################################### set -e . "$SETUP_DATA_DIR/common-data" . "$SETUP_DATA_DIR/common-functions" if [ "$STAGE" != "setup-start" ] && \ [ "$STAGE" != "setup-stop" ] && \ [ "$STAGE" != "setup-recover" ]; then exit 0 elif ! which update-binfmts > /dev/null; then info "Missing update-binfmts" exit 0 fi shell="${CHROOT_PATH}/bin/sh" for emulator in $(update-binfmts --find "$shell"); do dst="${CHROOT_PATH}$emulator" if [ ! -e "$emulator" ]; then info "Missing emulator: $emulator" else [ -e "$dst" ] || touch "$dst" mount --bind "$emulator" "$dst" mount -o remount,ro "$dst" fi done
pgpuEmIe43nhk.pgp
Description: PGP signature