Control: block -1 by 945019 Hi,
On Sat, Jul 01, 2017 at 04:07:08PM +0200, Jochen Sprickerhof wrote: > currently qemu-user-static doesn't depend on binfmt-support but tries to use > it > in it's postinst. Installing qemu-user-static first and binfmt-support results > in the binfmt registration not being done. I would propose to either add a > dependency to binfmt-support or add a dpkg trigger to do the registration > later. I've also run into this issue. I don't find the "hard dependency" solution particularly pleasing and agree with the idea of dpkg triggers. Doing the trigger thing properly, requires help from binfmt-support. To that end, I've filed #945019 However for getting there, we need qemu to stop issuing those long calls and using the more recent --import/--unimport interface (since buster). That variant can be turned into triggers while the current method cannot. To that end, I'm attaching a patch for qemu. It doesn't fix the issue, but resolves the qemu part of it. And it moves a lot of code from maintainer script to build time. Helmut
diff -Nru qemu-4.1/debian/binfmt-update-in qemu-4.1/debian/binfmt-update-in --- qemu-4.1/debian/binfmt-update-in 2019-08-24 13:55:11.000000000 +0200 +++ qemu-4.1/debian/binfmt-update-in 1970-01-01 01:00:00.000000000 +0100 @@ -1,116 +0,0 @@ -# check if we're running inside an (lxc) container -# (we may copy or move this to the postinst script too, to skip installing it) -grep -zqs ^container= /proc/1/environ && exit 0 - -# == binfmt registration/deregistration == -if command -v update-binfmts > /dev/null ; then - -fmts="aarch64 alpha arm armeb cris hppa i386 m68k microblaze mips mipsel mipsn32 mipsn32el mips64 mips64el ppc ppc64 ppc64abi32 ppc64le riscv32 riscv64 s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64 xtensa xtensaeb" - -# linux ELF_OSABI(byte7) can be 0 (traditional,SYSV) or 3 (GNU/LINUX extensions) -# binfmt registration does not allow a enum, only value&mask. So we use broader mask -# to allow both 0 and 3 here, this also lets 1 (HPUX) and 2 (NETBSD) - 0xfc not 0xff -# alternative is to create 2 magic/mask pairs instead of one - - aarch64_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00' - aarch64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - alpha_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90' - alpha_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - arm_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00' - arm_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - armeb_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28' - armeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - cris_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x4c\x00' - cris_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f' - hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - i386_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00' - i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - m68k_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04' - m68k_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - microblaze_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xba\xab' - microblaze_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - mips_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08' - mips_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - mipsel_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00' - mipsel_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - mips64_magic='\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08' - mips64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - mips64el_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00' - mips64el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - ppc_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14' - ppc_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - ppc64_magic='\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15' - ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - ppc64abi32_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15' - ppc64abi32_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - ppc64le_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00' - ppc64le_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00' - riscv32_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00' - riscv32_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - riscv64_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00' - riscv64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - s390x_magic='\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16' - s390x_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - sh4_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00' - sh4_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - sh4eb_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a' - sh4eb_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - sparc_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02' - sparc_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' -sparc32plus_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x12' - sparc32plus_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - sparc64_magic='\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2b' - sparc64_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - x86_64_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00' - x86_64_mask='\xff\xff\xff\xff\xff\xfe\xfe\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - xtensa_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e\x00' - xtensa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' - xtensaeb_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e' - xtensaeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - - -# find which fmts needs to be filtered out, which is arch-dependent. -# Drop support for emulating amd64 on i386, http://bugs.debian.org/604712 -case "$DPKG_MAINTSCRIPT_ARCH" in - amd64 | i386) omit="i386|x86_64" ;; - arm | armel | armhf | arm64) omit="arm|aarch64" ;; - mips | mipsel) omit="$DPKG_MAINTSCRIPT_ARCH" ;; - ppc64 | powerpc) omit="ppc|ppc64|ppc64abi32" ;; - ppc64el) omit="ppc64le" ;; - s390x) omit="s390x" ;; - sparc | sparc64) omit="sparc|sparc32plus|sparc64" ;; - *) omit="$DPKG_MAINTSCRIPT_ARCH" ;; -esac - -remove_binfmt() { - if [ -f /var/lib/binfmts/qemu-$1 ]; then - update-binfmts --package @PACKAGE@ --remove qemu-$1 /usr/bin/qemu-$1@SUFFIX@ - fi -} - -case "$DPKG_MAINTSCRIPT_NAME:$1" in - - postinst:configure) - for fmt in $fmts ; do - - eval "case $fmt in $omit) magic= ;; *) magic=\"\$${fmt}_magic\" mask=\"\$${fmt}_mask\" ;; esac" - if [ -n "$magic" ]; then - update-binfmts --package @PACKAGE@ --install qemu-$fmt /usr/bin/qemu-$fmt@SUFFIX@ \ - --magic "$magic" --mask "$mask" --offset 0 --credential yes @FIX_BINARY@ - else - remove_binfmt $fmt - fi - done - ;; - - prerm:remove) - for fmt in $fmts ; do - remove_binfmt $fmt - done - ;; - -esac - -fi -# == binfmt registration/deregistration == diff -Nru qemu-4.1/debian/binfmt-update-install qemu-4.1/debian/binfmt-update-install --- qemu-4.1/debian/binfmt-update-install 1970-01-01 01:00:00.000000000 +0100 +++ qemu-4.1/debian/binfmt-update-install 2019-11-18 12:25:40.000000000 +0100 @@ -0,0 +1,101 @@ +#!/bin/sh + +PACKAGE="$1" + +fmts="aarch64 alpha arm armeb cris hppa i386 m68k microblaze mips mipsel mipsn32 mipsn32el mips64 mips64el ppc ppc64 ppc64abi32 ppc64le riscv32 riscv64 s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64 xtensa xtensaeb" + +# linux ELF_OSABI(byte7) can be 0 (traditional,SYSV) or 3 (GNU/LINUX extensions) +# binfmt registration does not allow a enum, only value&mask. So we use broader mask +# to allow both 0 and 3 here, this also lets 1 (HPUX) and 2 (NETBSD) - 0xfc not 0xff +# alternative is to create 2 magic/mask pairs instead of one + + aarch64_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00' + aarch64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + alpha_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90' + alpha_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + arm_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00' + arm_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + armeb_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28' + armeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + cris_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x4c\x00' + cris_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f' + hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + i386_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00' + i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + m68k_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04' + m68k_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + microblaze_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xba\xab' + microblaze_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + mips_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08' + mips_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + mipsel_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00' + mipsel_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + mips64_magic='\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08' + mips64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + mips64el_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00' + mips64el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + ppc_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14' + ppc_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + ppc64_magic='\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15' + ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + ppc64abi32_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15' + ppc64abi32_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + ppc64le_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00' + ppc64le_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00' + riscv32_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00' + riscv32_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + riscv64_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00' + riscv64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + s390x_magic='\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16' + s390x_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + sh4_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00' + sh4_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + sh4eb_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a' + sh4eb_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + sparc_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02' + sparc_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' +sparc32plus_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x12' + sparc32plus_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + sparc64_magic='\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2b' + sparc64_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + x86_64_magic='\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00' + x86_64_mask='\xff\xff\xff\xff\xff\xfe\xfe\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + xtensa_magic='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e\x00' + xtensa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' + xtensaeb_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e' + xtensaeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + +DEB_HOST_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH) + +# find which fmts needs to be filtered out, which is arch-dependent. +# Drop support for emulating amd64 on i386, http://bugs.debian.org/604712 +case "$DEB_HOST_ARCH" in + amd64 | i386) omit="i386|x86_64" ;; + arm | armel | armhf | arm64) omit="arm|aarch64" ;; + ppc64 | powerpc) omit="ppc|ppc64|ppc64abi32" ;; + ppc64el) omit="ppc64le" ;; + s390x) omit="s390x" ;; + sparc | sparc64) omit="sparc|sparc32plus|sparc64" ;; + *) omit="$DEB_HOST_ARCH" ;; +esac + +case "$PACKAGE" in + qemu-user-static) SUFFIX=-static; FIX_BINARY=yes ;; + qemu-user-binfmt) SUFFIX=; FIX_BINARY=no ;; + *) echo "usage: $0 <qemu-user|qemu-user-static>"; exit 1 ;; +esac + +for fmt in $fmts ; do + eval "case $fmt in $omit) magic= ;; *) magic=\"\$${fmt}_magic\" mask=\"\$${fmt}_mask\" ;; esac" + [ -z "$magic" ] && continue + cat >>"debian/$PACKAGE/usr/share/binfmts/qemu-$fmt" <<EOF +package $PACKAGE +interpreter /usr/bin/qemu-$fmt$SUFFIX +magic $magic +offset 0 +mask $mask +credentials yes +fix_binary $FIX_BINARY +EOF +done diff -Nru qemu-4.1/debian/changelog qemu-4.1/debian/changelog --- qemu-4.1/debian/changelog 2019-08-27 11:43:43.000000000 +0200 +++ qemu-4.1/debian/changelog 2019-11-18 12:25:40.000000000 +0100 @@ -1,3 +1,11 @@ +qemu (1:4.1-1.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Use update-binfmts --import/--unimport in order to move to triggers + eventually. (Addresses: #866756) + + -- Helmut Grohne <helmut.gro...@intenta.de> Mon, 18 Nov 2019 12:25:40 +0100 + qemu (1:4.1-1) unstable; urgency=medium * new upstream release v4.1 diff -Nru qemu-4.1/debian/qemu-user-binfmt.dirs qemu-4.1/debian/qemu-user-binfmt.dirs --- qemu-4.1/debian/qemu-user-binfmt.dirs 1970-01-01 01:00:00.000000000 +0100 +++ qemu-4.1/debian/qemu-user-binfmt.dirs 2019-11-18 12:25:40.000000000 +0100 @@ -0,0 +1 @@ +/usr/share/binfmts diff -Nru qemu-4.1/debian/qemu-user-static.dirs qemu-4.1/debian/qemu-user-static.dirs --- qemu-4.1/debian/qemu-user-static.dirs 1970-01-01 01:00:00.000000000 +0100 +++ qemu-4.1/debian/qemu-user-static.dirs 2019-11-18 12:25:40.000000000 +0100 @@ -0,0 +1 @@ +/usr/share/binfmts diff -Nru qemu-4.1/debian/qemu-user-static.postinst qemu-4.1/debian/qemu-user-static.postinst --- qemu-4.1/debian/qemu-user-static.postinst 1970-01-01 01:00:00.000000000 +0100 +++ qemu-4.1/debian/qemu-user-static.postinst 2019-11-18 12:25:26.000000000 +0100 @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +# check if we're running inside an (lxc) container +# (we may copy or move this to the postinst script too, to skip installing it) +grep -zqs ^container= /proc/1/environ && exit 0 + +# == binfmt registration/deregistration == +if test "$1" = configure && command -v update-binfmts > /dev/null ; then + for fmt in /usr/share/binfmts/qemu-*; do + fmt="${fmt#/usr/share/binfmts/}" + if ! test -e "/var/lib/binfmts/$fmt"; then + update-binfmts --import "$fmt" + fi + done + +fi +# == binfmt registration/deregistration == diff -Nru qemu-4.1/debian/qemu-user-static.prerm qemu-4.1/debian/qemu-user-static.prerm --- qemu-4.1/debian/qemu-user-static.prerm 1970-01-01 01:00:00.000000000 +0100 +++ qemu-4.1/debian/qemu-user-static.prerm 2019-11-18 12:25:36.000000000 +0100 @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +# check if we're running inside an (lxc) container +# (we may copy or move this to the postinst script too, to skip installing it) +grep -zqs ^container= /proc/1/environ && exit 0 + +# == binfmt registration/deregistration == +if test "$1" = remove && command -v update-binfmts > /dev/null ; then + for fmt in /var/lib/binfmts/qemu-*; do + fmt="${fmt#/var/lib/binfmts/}" + update-binfmts --unimport "$fmt" + done + +fi +# == binfmt registration/deregistration == diff -Nru qemu-4.1/debian/qemu-user.postinst qemu-4.1/debian/qemu-user.postinst --- qemu-4.1/debian/qemu-user.postinst 1970-01-01 01:00:00.000000000 +0100 +++ qemu-4.1/debian/qemu-user.postinst 2019-11-18 12:25:01.000000000 +0100 @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +# check if we're running inside an (lxc) container +# (we may copy or move this to the postinst script too, to skip installing it) +grep -zqs ^container= /proc/1/environ && exit 0 + +# == binfmt registration/deregistration == +if test "$1" = configure && command -v update-binfmts > /dev/null ; then + for fmt in /usr/share/binfmts/qemu-*; do + fmt="${fmt#/usr/share/binfmts/}" + if ! test -e "/var/lib/binfmts/$fmt"; then + update-binfmts --import "$fmt" + fi + done + +fi +# == binfmt registration/deregistration == diff -Nru qemu-4.1/debian/qemu-user.prerm qemu-4.1/debian/qemu-user.prerm --- qemu-4.1/debian/qemu-user.prerm 1970-01-01 01:00:00.000000000 +0100 +++ qemu-4.1/debian/qemu-user.prerm 2019-11-18 12:24:58.000000000 +0100 @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +# check if we're running inside an (lxc) container +# (we may copy or move this to the postinst script too, to skip installing it) +grep -zqs ^container= /proc/1/environ && exit 0 + +# == binfmt registration/deregistration == +if test "$1" = remove && command -v update-binfmts > /dev/null ; then + for fmt in /var/lib/binfmts/qemu-*; do + fmt="${fmt#/var/lib/binfmts/}" + update-binfmts --unimport "$fmt" + done + +fi +# == binfmt registration/deregistration == diff -Nru qemu-4.1/debian/rules qemu-4.1/debian/rules --- qemu-4.1/debian/rules 2019-08-27 11:39:20.000000000 +0200 +++ qemu-4.1/debian/rules 2019-11-18 12:25:40.000000000 +0100 @@ -220,13 +220,8 @@ done # binfmt support - for x in postinst prerm; do \ - sed -e s/@SUFFIX@/-static/ -e s/@PACKAGE@/qemu-user-static/ -e "s/@FIX_BINARY@/--fix-binary yes/" \ - debian/binfmt-update-in >> debian/qemu-user-static.$$x.debhelper ; \ - sed -e s/@SUFFIX@// -e s/@PACKAGE@/qemu-user-binfmt/ -e s/@FIX_BINARY@// \ - debian/binfmt-update-in >> debian/qemu-user-binfmt.$$x.debhelper ; \ - done - + ./debian/binfmt-update-install qemu-user-static + ./debian/binfmt-update-install qemu-user-binfmt endif # enable_linux_user dh_install -a