From d4f408166b4d3ee274cdd3c291e1ece7334f69bc Mon Sep 17 00:00:00 2001 From: Animesh Sahu Date: Mon, 6 Jun 2022 08:57:00 +0530 Subject: [PATCH] qemu qemu-user-static: Provide binfmt services --- .../files/qemu-user-static-binfmt/finish | 5 +++++ .../files/qemu-user-static-binfmt/run | 9 +++++++++ srcpkgs/qemu-user-static/template | 5 ++++- srcpkgs/qemu/files/qemu-binfmt/finish | 5 +++++ srcpkgs/qemu/files/qemu-binfmt/run | 11 +++++++++++ srcpkgs/qemu/template | 5 ++++- 6 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/qemu-user-static/files/qemu-user-static-binfmt/finish create mode 100644 srcpkgs/qemu-user-static/files/qemu-user-static-binfmt/run create mode 100644 srcpkgs/qemu/files/qemu-binfmt/finish create mode 100644 srcpkgs/qemu/files/qemu-binfmt/run diff --git a/srcpkgs/qemu-user-static/files/qemu-user-static-binfmt/finish b/srcpkgs/qemu-user-static/files/qemu-user-static-binfmt/finish new file mode 100644 index 000000000000..0226413c0ed2 --- /dev/null +++ b/srcpkgs/qemu-user-static/files/qemu-user-static-binfmt/finish @@ -0,0 +1,5 @@ +#!/bin/sh + +for i in /proc/sys/fs/binfmt_misc/qemu-*; do + echo -1 > $i +done diff --git a/srcpkgs/qemu-user-static/files/qemu-user-static-binfmt/run b/srcpkgs/qemu-user-static/files/qemu-user-static-binfmt/run new file mode 100644 index 000000000000..98359ba22a52 --- /dev/null +++ b/srcpkgs/qemu-user-static/files/qemu-user-static-binfmt/run @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then + mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc +fi + +/usr/share/qemu-user-static/scripts/qemu-binfmt-conf.sh --qemu-suffix "-static" \ + --qemu-path /usr/bin -c yes -p yes +exec chpst -b qemu-user-static-binfmt pause diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template index cca001f8835b..a11e17fd49b3 100644 --- a/srcpkgs/qemu-user-static/template +++ b/srcpkgs/qemu-user-static/template @@ -2,7 +2,7 @@ # This package should be updated together with qemu pkgname=qemu-user-static version=6.2.0 -revision=2 +revision=3 wrksrc="qemu-${version}" build_style=configure configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec @@ -125,4 +125,7 @@ post_install() { for f in ${DESTDIR}/usr/bin/*; do mv ${f} ${f}-static done + + vmkdir "usr/share/${pkgname}/scripts" + vinstall scripts/qemu-binfmt-conf.sh 755 "usr/share/${pkgname}/scripts" } diff --git a/srcpkgs/qemu/files/qemu-binfmt/finish b/srcpkgs/qemu/files/qemu-binfmt/finish new file mode 100644 index 000000000000..0226413c0ed2 --- /dev/null +++ b/srcpkgs/qemu/files/qemu-binfmt/finish @@ -0,0 +1,5 @@ +#!/bin/sh + +for i in /proc/sys/fs/binfmt_misc/qemu-*; do + echo -1 > $i +done diff --git a/srcpkgs/qemu/files/qemu-binfmt/run b/srcpkgs/qemu/files/qemu-binfmt/run new file mode 100644 index 000000000000..bea4119538c2 --- /dev/null +++ b/srcpkgs/qemu/files/qemu-binfmt/run @@ -0,0 +1,11 @@ +#!/bin/sh + +# Prioritize static binaries service if present +sv check qemu-user-static-binfmt && exit 0 + +if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then + mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc +fi + +/usr/share/qemu/scripts/qemu-binfmt-conf.sh --qemu-path /usr/bin -c yes +exec chpst -b qemu-binfmt pause diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template index 17655fdbdda8..9adcc3df7a62 100644 --- a/srcpkgs/qemu/template +++ b/srcpkgs/qemu/template @@ -2,7 +2,7 @@ # This package should be updated together with qemu-user-static pkgname=qemu version=6.2.0 -revision=2 +revision=3 build_style=configure configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie @@ -79,6 +79,9 @@ post_install() { chmod u+s ${DESTDIR}/usr/libexec/qemu-bridge-helper vsv qemu-ga + + vmkdir "usr/share/${pkgname}/scripts" + vinstall scripts/qemu-binfmt-conf.sh 755 "usr/share/${pkgname}/scripts" } qemu-ga_package() {