2 # Copyright © 2011 Julian Andres Klode <jak@debian.org>
4 # schroot is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # schroot is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see
16 # <http://www.gnu.org/licenses/>.
18 #####################################################################
22 .
"$SETUP_DATA_DIR/common-data"
23 .
"$SETUP_DATA_DIR/common-functions"
24 .
"$SETUP_DATA_DIR/common-config"
27 if [ "$STAGE" != "setup-start" ] && \
28 [ "$STAGE" != "setup-stop" ] && \
29 [ "$STAGE" != "setup-recover" ]; then
31 elif ! which update-binfmts
> /dev
/null
2>&1; then
32 info
"Missing update-binfmts; not enabling binfmt support"
36 shell
="${CHROOT_PATH}/bin/sh"
38 for emulator
in $
(update-binfmts
--find "$shell"); do
39 dst
="${CHROOT_PATH}$emulator"
40 if [ ! -e
"$emulator" ]; then
41 info
"Missing emulator: $emulator; not enabling binfmt support"
42 elif [ ! -e
"$dst" ]; then
43 ## [mdw] don't bind over an existing qemu. Two things go wrong:
44 ## firstly, and more obviously, this forces the use of the host qemu,
45 ## which may be too old to run more bleeding-edge code; and secondly,
46 ## if the chroot's emulator is a symlink to a file in the host
47 ## filesystem to be bound into the chroot, then this bind mount is
48 ## never cleaned up. It's just a bad idea.
50 mount
--bind "$emulator" "$dst"
51 mount
-o remount
,ro
,bind "$dst"