summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Rheinsberg2019-03-28 08:25:44 +0100
committerDavid Rheinsberg2019-03-28 08:25:44 +0100
commit2bd64ab2184ce60ce50773285062cc14488f0e2b (patch)
tree0fdcc4210d0f76f159175a353af8154d7a5a9a55
parentc1535c6ae5cc70eaedaf666e3623617c0f5fdd2e (diff)
downloadaur-2bd64ab2184ce60ce50773285062cc14488f0e2b.tar.gz
binfmt: make parser more robust
Make sure we no longer match on the emulation binary, but rather on the entry-name. The emulation binary might be a different one (see i386 and i486 for instance). Furthermore, make sure to skip empty entries. Lastly, note that upstream qemu now has a script to do the exact same thing. We should switch some day.. Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
-rw-r--r--PKGBUILD18
1 files changed, 12 insertions, 6 deletions
diff --git a/PKGBUILD b/PKGBUILD
index ddb1d3259610..0eb580c810fa 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -65,6 +65,11 @@ create_binfmts() {
rm -Rf usr/lib/binfmt.d
mkdir -p usr/lib/binfmt.d
+ # Qemu upstream now has a script to create the binfmt
+ # configurations, in ./scripts/qemu-binfmt-conf.sh. We
+ # should switch to it, rather than parsing the old
+ # Fedora configuration manually.
+
for i in \
aarch64 \
alpha \
@@ -109,12 +114,13 @@ create_binfmts() {
fi
fi
- grep "/qemu-$i:\$" "${srcdir}/qemu.binfmt" \
- | tr -d '\n' \
- >"usr/lib/binfmt.d/qemu-$i-static.conf"
- echo "F" \
- >>"usr/lib/binfmt.d/qemu-$i-static.conf"
- perl -i -p -e "s/qemu-$i:F/qemu-$i-static:F/" \
+ CFG=$(grep "^:qemu-$i:" "${srcdir}/qemu.binfmt" | tr -d '\n')
+ if [ -z "$CFG" ] ; then
+ continue
+ fi
+
+ echo -E -n "$CFG" >"usr/lib/binfmt.d/qemu-$i-static.conf"
+ perl -i -p -e "s/bin\/qemu-([^:]+):\$/bin\/qemu-\1-static:F/" \
"usr/lib/binfmt.d/qemu-$i-static.conf"
done
}