From nobody Mon Mar 31 20:30:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583779103; cv=none; d=zohomail.com; s=zohoarc; b=W37/D5ohDQ591juwcMh2yPQfh06TxXWMiTOgCAGPsXQdOUGafrYeLVG6ni43mc0WDjGrUEdI6xwYWsAv8aY6ipUwa6KyZtFMDSUzTHVcltcWxSHn+iDiS5xqmCPCRBtcVckLtIU6DvLnH3+W3nPuGFdX8b0yImJhngHVZNFisQk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583779103; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+vUdtYjW+V2uKWreEpjkekgMSsCk4f8SmRtos6+ARb0=; b=ae8wgEMdrmMTtnVwssEYcP/sLwpNYCB//VOUFiX5UX4hx43dkrcTuPVXD382y9NTLOcin5PdwkK9wntJQ/cWIhjOHfHD4rCSI74QhmeRowkEBnoBk7mn8sCAuE/0wsvH2wa+Ir/gBEQQP1NRffnvNKGkQfoH/G0w7dE2dc0i/i8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583779103167571.8781619705398; Mon, 9 Mar 2020 11:38:23 -0700 (PDT) Received: from localhost ([::1]:47908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNID-0003zl-3Z for importer@patchew.org; Mon, 09 Mar 2020 14:38:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41912) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNGu-0002iL-Ie for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:37:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBNGt-0003RX-BR for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:37:00 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:59873 helo=smtp.ehu.eus) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBNGs-0003Qv-VD for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:36:59 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 8C98C61E1; Mon, 9 Mar 2020 19:36:57 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 599075A04F; Mon, 9 Mar 2020 19:36:57 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E4765A045; Mon, 9 Mar 2020 19:36:57 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 9 Mar 2020 19:36:57 +0100 (CET) Received: from 669c1c222ef4 (static.187.0.0.81.ibercom.com [81.0.0.187]) by smtp2 (Postfix) with ESMTPSA id 0C3B061E1; Mon, 9 Mar 2020 19:36:57 +0100 (CET) Date: Mon, 9 Mar 2020 18:36:51 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v9 1/9] qemu-binfmt-conf.sh: enforce safe style consistency Message-ID: <20200309183651.GA14@669c1c222ef4> References: <20200309183521.GA9@669c1c222ef4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200309183521.GA9@669c1c222ef4> X-Greylist: ACL 191 matched, not delayed by milter-greylist-4.6.2 (smtp2 [10.0.100.76]); Mon, 09 Mar 2020 19:36:57 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25280.001 X-TM-AS-Result: No-1.203-7.0-31-10 X-imss-scan-details: No-1.203-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25280.001 X-TMASE-Result: 10-1.202800-10.000000 X-TMASE-MatchedRID: C2Ox2wkr63jeG4FwcWqAS1IWq0PbCp4xsaFafeSZpcbCtB5AXGRY27H9 y3BGSBuXf+3yqvQrlggtpxclXgLOJWJZXQNDzktSSHCU59h5KrHOoAXTAVKONZ+4ziUPq4Lxgm7 WCykPm9QLZPDLz2fappsT5uP6xQz0dTtVF1QIQ4RLIfps09VJ24IXoaQH2H4P9G/iyJjj8J/e/8 mzpz6Tltg9dKgWHMAdkb3r+FsnMU2iexRwf5KEhMzSKGx9g8xhZlQDEANheHGbKItl61J/yX2PY bDNMTe9KrauXd3MZDVQ9tfhA5AeJqu3XGY3i0vm8h0Vtd5gEqOYKIZboSNYJW3znmbWciqGRO/I D/JEVE6RElks2VoueCPYYEP1kqJR5fiqzvLgTYnU0QfJ7oMD81i7FP9SiiauF1qISuK4qVqjyqn hL+I3r3T5gPkpDQEZQwymtxuJ6y0= X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp2.imsva2 [10.0.100.76]); Mon, 09 Mar 2020 19:36:57 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Spaces are removed before '; then', for consistency. All the tests are prefixed with 'x', in order to avoid risky comparisons (i.e. a user deliberately trying to provoke a syntax error). Signed-off-by: umarcor Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 9f1580a91c..98401f4e7c 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -215,7 +215,7 @@ EOF } =20 qemu_check_access() { - if [ ! -w "$1" ] ; then + if [ ! -w "$1" ]; then echo "ERROR: cannot write to $1" 1>&2 exit 1 fi @@ -224,12 +224,12 @@ qemu_check_access() { qemu_check_bintfmt_misc() { # load the binfmt_misc module if [ ! -d /proc/sys/fs/binfmt_misc ]; then - if ! /sbin/modprobe binfmt_misc ; then + if ! /sbin/modprobe binfmt_misc; then exit 1 fi fi if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then - if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc ; then + if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc; then exit 1 fi fi @@ -242,16 +242,16 @@ installed_dpkg() { } =20 qemu_check_debian() { - if [ ! -e /etc/debian_version ] ; then + if [ ! -e /etc/debian_version ]; then echo "WARNING: your system is not a Debian based distro" 1>&2 - elif ! installed_dpkg binfmt-support ; then + elif ! installed_dpkg binfmt-support; then echo "WARNING: package binfmt-support is needed" 1>&2 fi qemu_check_access "$EXPORTDIR" } =20 qemu_check_systemd() { - if ! systemctl -q is-enabled systemd-binfmt.service ; then + if ! systemctl -q is-enabled systemd-binfmt.service; then echo "WARNING: systemd-binfmt.service is missing or disabled" 1>&2 fi qemu_check_access "$EXPORTDIR" @@ -259,10 +259,10 @@ qemu_check_systemd() { =20 qemu_generate_register() { flags=3D"" - if [ "$CREDENTIAL" =3D "yes" ] ; then + if [ "x$CREDENTIAL" =3D "xyes" ]; then flags=3D"OC" fi - if [ "$PERSISTENT" =3D "yes" ] ; then + if [ "x$PERSISTENT" =3D "xyes" ]; then flags=3D"${flags}F" fi =20 @@ -295,23 +295,23 @@ qemu_set_binfmts() { =20 # register the interpreter for each cpu except for the native one =20 - for cpu in ${qemu_target_list} ; do + for cpu in ${qemu_target_list}; do magic=3D$(eval echo \$${cpu}_magic) mask=3D$(eval echo \$${cpu}_mask) family=3D$(eval echo \$${cpu}_family) =20 - if [ "$magic" =3D "" ] || [ "$mask" =3D "" ] || [ "$family" =3D ""= ] ; then + if [ "x$magic" =3D "x" ] || [ "x$mask" =3D "x" ] || [ "x$family" = =3D "x" ]; then echo "INTERNAL ERROR: unknown cpu $cpu" 1>&2 continue fi =20 qemu=3D"$QEMU_PATH/qemu-$cpu" - if [ "$cpu" =3D "i486" ] ; then + if [ "x$cpu" =3D "xi486" ]; then qemu=3D"$QEMU_PATH/qemu-i386" fi =20 qemu=3D"$qemu$QEMU_SUFFIX" - if [ "$host_family" !=3D "$family" ] ; then + if [ "x$host_family" !=3D "x$family" ]; then $BINFMT_SET fi done @@ -331,7 +331,7 @@ QEMU_SUFFIX=3D"" options=3D$(getopt -o ds:Q:S:e:hc:p: -l debian,systemd:,qemu-path:,qemu-su= ffix:,exportdir:,help,credential:,persistent: -- "$@") eval set -- "$options" =20 -while true ; do +while true; do case "$1" in -d|--debian) CHECK=3Dqemu_check_debian @@ -344,14 +344,14 @@ while true ; do EXPORTDIR=3D${EXPORTDIR:-$SYSTEMDDIR} shift # check given cpu is in the supported CPU list - if [ "$1" !=3D "ALL" ] ; then - for cpu in ${qemu_target_list} ; do - if [ "$cpu" =3D "$1" ] ; then + if [ "$1" !=3D "ALL" ]; then + for cpu in ${qemu_target_list}; do + if [ "$cpu" =3D "$1" ]; then break fi done =20 - if [ "$cpu" =3D "$1" ] ; then + if [ "$cpu" =3D "$1" ]; then qemu_target_list=3D"$1" else echo "ERROR: unknown CPU \"$1\"" 1>&2 --=20 2.25.1 From nobody Mon Mar 31 20:30:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583779148; cv=none; d=zohomail.com; s=zohoarc; b=FlXOdnLlo6nOKdJfztvlNt8kEvPJJDvwvNEHwEJDJIUNQBxC0cbpLmYvOytwru4XGg41/HtN84BY66FNBXdt6OMcvjzRha1pw4vDt6fuZZPQGIYLmfCv9tm7qZweZv0ClsARQRyNuJzCWL7vIvHPXQ0RdHSf+BJla+Hh+oZqfVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583779148; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FJ3Nt0B4fXC6VERSiPh6YIpJPf1K8y6SiVxcaJK9xbI=; b=nGCOh/wixbzTF4yk57Eh1dOXjgcdh9mB4yQ0ZodAp9D4VMy4/izGgujWiqcqg966xGe2thXaVXidEbqA8KapcH4oAGTsARKNGoIbBOyMCW28Epu0PVq/IX/XVAKfpjKt3eFEQLOD+l7QWT5itHTHFQwRZqtmMbNJ6KeXHecaRHw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583779148886916.2290721312997; Mon, 9 Mar 2020 11:39:08 -0700 (PDT) Received: from localhost ([::1]:47914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNIx-0005Cj-N9 for importer@patchew.org; Mon, 09 Mar 2020 14:39:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41958) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNHc-0003jC-UL for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:37:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBNHb-0003pK-3e for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:37:44 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:1935 helo=smtp.ehu.eus) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBNHa-0003oa-MX for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:37:43 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 9295C61E1; Mon, 9 Mar 2020 19:37:41 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 668AC5A053; Mon, 9 Mar 2020 19:37:41 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AFE35A050; Mon, 9 Mar 2020 19:37:41 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 9 Mar 2020 19:37:41 +0100 (CET) Received: from 669c1c222ef4 (static.187.0.0.81.ibercom.com [81.0.0.187]) by smtp2 (Postfix) with ESMTPSA id 182FB64BB; Mon, 9 Mar 2020 19:37:41 +0100 (CET) Date: Mon, 9 Mar 2020 18:37:39 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v9 2/9] qemu-binfmt-conf.sh: make opts -p and -c boolean Message-ID: <20200309183739.GB14@669c1c222ef4> References: <20200309183521.GA9@669c1c222ef4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200309183521.GA9@669c1c222ef4> X-Greylist: ACL 191 matched, not delayed by milter-greylist-4.6.2 (smtp2 [10.0.100.76]); Mon, 09 Mar 2020 19:37:41 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25280.001 X-TM-AS-Result: No--0.283-7.0-31-10 X-imss-scan-details: No--0.283-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25280.001 X-TMASE-Result: 10--0.282600-10.000000 X-TMASE-MatchedRID: 5MYN72agt7osSx1KHZomlKS9pC14MC3C6qG5M9QNAO1CannV/b7f2cEI kNzFiDxLvdz+hjQlBqVqAxBaFFZ85HTKrg3nLjv1A9lly13c/gGOz/LLJUcaHoXfDl+KHKjY2NR c0Z/xVW0vrwXOPzQMJ1WGfFaWlqBcrSKKfw/QqNWK2+RZ4/fWST8ZO44VTPmzabJxhiIFjJnUA8 lgylnZvvJAhJwgr+u9bOUsBbIsdlNDq2SVEk72KAtuKBGekqUpnH7sbImOEBSciU1ODUUyRTfl7 Ff3TqMK5enQWdHaRl/9H2Gw8F1Vpbklb8tz0hiTf4mxPus7+W6GRsdpOfkZDT8q79yO2w3QcYvE RdEDpu5KU2XuQZXDAUznMHeShSu0p/GSAIsG8Of0jt4HSLaYh18I4oUq5Vga X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp2.imsva2 [10.0.100.76]); Mon, 09 Mar 2020 19:37:41 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This patch breaks backward compatibility. Both '--persistent' and '--credential' default to 'no'. Hence, '-p no' or '-c no' are redundant. Overall, accepting an argument might be misleading because options are, indeed, boolean. This patch makes both options boolean in getopt, so if any of them is provided the corresponding variable is set to true. Signed-off-by: umarcor Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 98401f4e7c..285ce528d1 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -172,8 +172,8 @@ qemu_get_family() { usage() { cat < Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583779184374212.71949642229345; Mon, 9 Mar 2020 11:39:44 -0700 (PDT) Received: from localhost ([::1]:47926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNJX-000636-6X for importer@patchew.org; Mon, 09 Mar 2020 14:39:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42020) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNI7-0004La-CI for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:38:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBNI6-000440-7b for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:38:15 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:37958 helo=smtp.ehu.eus) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBNI5-00043D-S7 for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:38:14 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 6C5E96BB0; Mon, 9 Mar 2020 19:38:12 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 365825A04F; Mon, 9 Mar 2020 19:38:12 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B1745A045; Mon, 9 Mar 2020 19:38:12 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 9 Mar 2020 19:38:12 +0100 (CET) Received: from 669c1c222ef4 (static.187.0.0.81.ibercom.com [81.0.0.187]) by smtp2 (Postfix) with ESMTPSA id DC80161E1; Mon, 9 Mar 2020 19:38:11 +0100 (CET) Date: Mon, 9 Mar 2020 18:38:10 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v9 3/9] qemu-binfmt-conf.sh: add QEMU_CREDENTIAL and QEMU_PERSISTENT Message-ID: <20200309183810.GC14@669c1c222ef4> References: <20200309183521.GA9@669c1c222ef4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200309183521.GA9@669c1c222ef4> X-Greylist: ACL 191 matched, not delayed by milter-greylist-4.6.2 (smtp2 [10.0.100.76]); Mon, 09 Mar 2020 19:38:12 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25280.001 X-TM-AS-Result: No-1.919-7.0-31-10 X-imss-scan-details: No-1.919-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25280.001 X-TMASE-Result: 10-1.919100-10.000000 X-TMASE-MatchedRID: /rjjNR0fZCoNdWPTMyGlNn41AgV24XnfVFeUPAjsd8bhmYLRM9m2iEhq QpzXZe40YNA0HZI8EiGPQi9XuOWoOIG9V0kqQ2uQitvkWeP31kk/GTuOFUz5s2mycYYiBYyZ1AP JYMpZ2b45ekiuCWp2reHQaFidrFj3/N0WsxWI4QdDbiUnjRcCmJnaxzJFBx6vrP7fIroeSfN6Ho OzBHN0E+LzNWBegCW2OubYLCVnBVEqyYS0oyUVZkwTwivyT1ud2BXbYhYhDeH0xIv3+bUafxYcN zOZk65ZVfu5ZE5C3KFuYlQ+vSplhDNdCmCxbgQiN5oZKOwjr7nvoBsTlWZiLhuJyuskHg4AzM2F BO7i4hJRYW5hfzhEW0CLmZDDvMfd0hli/KDwoy2eqD9WtJkSIw== X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp2.imsva2 [10.0.100.76]); Mon, 09 Mar 2020 19:38:12 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Allow to set options '--persistent' and/or '--credential' through environment variables. If not defined, defaults are used ('no'). Anyway, command-line arguments have priority over environment variables. Signed-off-by: umarcor Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 285ce528d1..0c28db5ca4 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -190,9 +190,11 @@ Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian= ][--systemd CPU] (default: $SYSTEMDDIR or $DEBIANDIR) --credential: if present, credential and security tokens are calculated according to the binary to interpret + (QEMU_CREDENTIAL=3Dyes) --persistent: if present, the interpreter is loaded when binfmt is configured and remains in memory. All future uses are cloned from the open file. + (QEMU_PERSISTENT=3Dyes) =20 To import templates with update-binfmts, use : =20 @@ -259,10 +261,10 @@ qemu_check_systemd() { =20 qemu_generate_register() { flags=3D"" - if [ "x$CREDENTIAL" =3D "xyes" ]; then + if [ "x$QEMU_CREDENTIAL" =3D "xyes" ]; then flags=3D"OC" fi - if [ "x$PERSISTENT" =3D "xyes" ]; then + if [ "x$QEMU_PERSISTENT" =3D "xyes" ]; then flags=3D"${flags}F" fi =20 @@ -285,7 +287,7 @@ package qemu-$cpu interpreter $qemu magic $magic mask $mask -credential $CREDENTIAL +credential $QEMU_CREDENTIAL EOF } =20 @@ -324,8 +326,10 @@ SYSTEMDDIR=3D"/etc/binfmt.d" DEBIANDIR=3D"/usr/share/binfmts" =20 QEMU_PATH=3D/usr/local/bin -CREDENTIAL=3Dno -PERSISTENT=3Dno + +QEMU_PERSISTENT=3D"${QEMU_PERSISTENT:-no}" +QEMU_CREDENTIAL=3D"${QEMU_CREDENTIAL:-no}" + QEMU_SUFFIX=3D"" =20 options=3D$(getopt -o ds:Q:S:e:hcp -l debian,systemd:,qemu-path:,qemu-suff= ix:,exportdir:,help,credential,persistent -- "$@") @@ -377,10 +381,10 @@ while true; do exit 1 ;; -c|--credential) - CREDENTIAL=3D"yes" + QEMU_CREDENTIAL=3D"yes" ;; -p|--persistent) - PERSISTENT=3D"yes" + QEMU_PERSISTENT=3D"yes" ;; *) break --=20 2.25.1 From nobody Mon Mar 31 20:30:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583779358; cv=none; d=zohomail.com; s=zohoarc; b=GSaYL6uvbXF26KQ8ecre+wxuwd36q7ppswGkYRKbULczpg4igcUAs3kPSoPuj15QKZ/vRLIxAMkLjrs5JitF/Nya4ILQSnDYCUYlny/RZYr6J4i3RggFFctLPOe2E2wLQ0no+W3LWBdVD23HnNQs7xZWJ38qxn/6PYyXoGt+rkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583779358; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1adWUo55xislgewvbW1cWC/tFvS02K2/z6kgxq7pDAA=; b=akPU00tgRVngpBifpz9wCY+YKlstWc1GxXqIGMOgV5cuN+eNBBKSc6PTJ/r8g1dZWoeTL1v9cDmb5BJ0UUcXHizCuoErFMMUDlbaopn9gDPpm7R+CQScEVkE4cby177xnO5GXbwBefaMI+AmOlsVSRDdOzcefXhAKMb+Ye9RdMc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583779358567289.5829860754145; Mon, 9 Mar 2020 11:42:38 -0700 (PDT) Received: from localhost ([::1]:48000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNML-0002dD-Cy for importer@patchew.org; Mon, 09 Mar 2020 14:42:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42177) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNIi-0005Ut-LV for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:38:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBNIh-0004Rl-3X for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:38:52 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:52095 helo=smtp.ehu.eus) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBNIg-0004Qv-IG for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:38:50 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 7783E64BB; Mon, 9 Mar 2020 19:38:49 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F54F5A04F; Mon, 9 Mar 2020 19:38:49 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 43FCE5A045; Mon, 9 Mar 2020 19:38:49 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 9 Mar 2020 19:38:49 +0100 (CET) Received: from 669c1c222ef4 (static.187.0.0.81.ibercom.com [81.0.0.187]) by smtp2 (Postfix) with ESMTPSA id F3EB061E1; Mon, 9 Mar 2020 19:38:48 +0100 (CET) Date: Mon, 9 Mar 2020 18:38:47 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v9 4/9] qemu-binfmt-conf.sh: use the same presentation format as for qemu-* Message-ID: <20200309183847.GD14@669c1c222ef4> References: <20200309183521.GA9@669c1c222ef4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200309183521.GA9@669c1c222ef4> X-Greylist: ACL 191 matched, not delayed by milter-greylist-4.6.2 (smtp2 [10.0.100.76]); Mon, 09 Mar 2020 19:38:49 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25280.001 X-TM-AS-Result: No--0.153-7.0-31-10 X-imss-scan-details: No--0.153-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25280.001 X-TMASE-Result: 10--0.153400-10.000000 X-TMASE-MatchedRID: 8TN2djYOGuT9T2Lkmecl6ZJsWTCuaRDiS1zwNuiBtITfUZT83lbkENcP Az195hI2GSFUsm29mSFhPO8j3auvUoG9V0kqQ2uQbWsCUkrA4Em7xmCZDXruteZYcdJgScjxdg1 +34sLG7ZQY4w7oxnsdyNhKgIJyVjTKkPeqGW0ZSPZulfZck3CoStTx/ehjzxgrSZr8U2Z6jx576 my5IxjuqzXIr1dtYg7fyYDewMOrQDkwjHXXC/4I66NVEWSRWybiqm7B70NuZJ9Z7hyAFJY9jESk h5cnZPz9M/qVkhwHg4h7eRfVadpKdYdycLRSQDdH8ObHSuXbim7MLwPLbnnjAjE5VHLyndBUPCI 8n2+0dTWkennr0izCN/kn5PmG7MEf1zYTr68FgO5XBEMs6Idug== X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp2.imsva2 [10.0.100.76]); Mon, 09 Mar 2020 19:38:49 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: umarcor Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 63 +++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 0c28db5ca4..870815fb22 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -171,47 +171,48 @@ qemu_get_family() { =20 usage() { cat < Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583779382306713.7204582582896; Mon, 9 Mar 2020 11:43:02 -0700 (PDT) Received: from localhost ([::1]:48004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNMj-0003dE-6f for importer@patchew.org; Mon, 09 Mar 2020 14:43:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42296) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNJI-0006Pk-Ct for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:39:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBNJG-0004jO-Vh for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:39:28 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:25912 helo=smtp.ehu.eus) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBNJF-0004iX-Tn for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:39:26 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 8F95E61E1; Mon, 9 Mar 2020 19:39:24 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5BC375A050; Mon, 9 Mar 2020 19:39:24 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 509FB5A045; Mon, 9 Mar 2020 19:39:24 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 9 Mar 2020 19:39:24 +0100 (CET) Received: from 669c1c222ef4 (static.187.0.0.81.ibercom.com [81.0.0.187]) by smtp2 (Postfix) with ESMTPSA id 0F5DF61E1; Mon, 9 Mar 2020 19:39:24 +0100 (CET) Date: Mon, 9 Mar 2020 18:39:22 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v9 5/9] qemu-binfmt-conf.sh: remove 'qemu' prefix from cli options Message-ID: <20200309183922.GE14@669c1c222ef4> References: <20200309183521.GA9@669c1c222ef4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200309183521.GA9@669c1c222ef4> X-Greylist: ACL 191 matched, not delayed by milter-greylist-4.6.2 (smtp2 [10.0.100.76]); Mon, 09 Mar 2020 19:39:24 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25280.001 X-TM-AS-Result: No-0.609-7.0-31-10 X-imss-scan-details: No-0.609-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25280.001 X-TMASE-Result: 10-0.609300-10.000000 X-TMASE-MatchedRID: zi/SDN/U4yNXxVT6/C14BeFgDmzNVVKokRkcrpA9poA3ZbGC9oP/OzB9 ccde3hbUf+3yqvQrlggtpxclXgLOJWQZ31TQwyj3YXOD42j+642nU+NxqV3DDV2YKfSY6fzM1jx n/1gr0UiuQih3+HqEP1e9QrNgNMNku1aOOerCaCkoSebb2328i30tCKdnhB58HOI0tZ7A+B36C0 ePs7A07a10/0DMlNjcB1hkAxSn3qp3MbLx3aiXjk2voIlyWME6hpvJ/Pu+aTTw8vXnqhGMsTQTy YRgKtFXL47a7Z8JkyLUdaAWhRon8GjV5YOxSYvMNDDkhDzsQTLp+5dP4kj0S+Fheyow6ZGG0vzW LJp2OfpVyvbTg/runA== X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp2.imsva2 [10.0.100.76]); Mon, 09 Mar 2020 19:39:24 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This breaks backward compatibility. Options 'qemu-path' and 'qemu-suffix' have the 'qemu-' prefix, which is not present in other option names ('debian', 'systemd', 'persistent', 'credential'...). In order to keep consistency, the prefix is removed. Signed-off-by: umarcor Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 870815fb22..5cc6db6aed 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -171,6 +171,7 @@ qemu_get_family() { =20 usage() { cat < Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15837793682051008.1406022226973; Mon, 9 Mar 2020 11:42:48 -0700 (PDT) Received: from localhost ([::1]:48002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNMV-00035b-1q for importer@patchew.org; Mon, 09 Mar 2020 14:42:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42382) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNJn-0007Fj-IZ for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:40:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBNJm-0004wc-Hj for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:39:59 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:9015 helo=smtp.ehu.eus) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBNJm-0004vs-0E for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:39:58 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id DFF1B61E1; Mon, 9 Mar 2020 19:39:56 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B909C5A04F; Mon, 9 Mar 2020 19:39:56 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE09A5A045; Mon, 9 Mar 2020 19:39:56 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 9 Mar 2020 19:39:56 +0100 (CET) Received: from 669c1c222ef4 (static.187.0.0.81.ibercom.com [81.0.0.187]) by smtp2 (Postfix) with ESMTPSA id 6CE9061E1; Mon, 9 Mar 2020 19:39:56 +0100 (CET) Date: Mon, 9 Mar 2020 18:39:55 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v9 6/9] qemu-binfmt-conf.sh: honour QEMU_PATH and/or QEMU_SUFFIX Message-ID: <20200309183955.GF14@669c1c222ef4> References: <20200309183521.GA9@669c1c222ef4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200309183521.GA9@669c1c222ef4> X-Greylist: ACL 191 matched, not delayed by milter-greylist-4.6.2 (smtp2 [10.0.100.76]); Mon, 09 Mar 2020 19:39:56 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25280.001 X-TM-AS-Result: No-1.584-7.0-31-10 X-imss-scan-details: No-1.584-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25280.001 X-TMASE-Result: 10-1.583800-10.000000 X-TMASE-MatchedRID: SUQ+NPRnbh0NdWPTMyGlNi2416nc3bQlcZ9gNqdc/asHZBaLwEXlKGb6 PphVtfZgqZ4KncYE2LPA1r83Ndy7E4G9V0kqQ2uQ2bpX2XJNwqFzHsCOuSqn1gMADm5EdqKWPBz wxTDfHyKE97yr4g+GPn8mA3sDDq0A5MIx11wv+COujVRFkkVsm5lbg85Qoqr7qPB2BBBxYn3K9n YVQjNmI3yJptyboWthoGvE/INvR30PSm0AYxpVY2Wiqxq9mSVNq7iRe3Rb7GFKbn3u4dm3w1Dwi PJ9vtHU1pHp569Iswjf5J+T5huzBH9c2E6+vBYDhCWCIvLE6iA= X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp2.imsva2 [10.0.100.76]); Mon, 09 Mar 2020 19:39:56 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Allow to set 'path' or 'suffix' through environment variables, consistently with 'persistent' and 'credential'. Signed-off-by: umarcor Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 5cc6db6aed..b1a54aa470 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -181,7 +181,7 @@ Options and associated environment variables: Argument Env-variable Description -h|--help display this usage -Q|--path PATH QEMU_PATH set path to qemu interpreter(s) --F|--suffix SUFFIX add a suffix to the default interpre= ter name +-F|--suffix SUFFIX QEMU_SUFFIX add a suffix to the default interpre= ter name -p|--persistent QEMU_PERSISTENT (yes) load the interpreter and keep = it in memory; all future uses are cloned from the open file. -c|--credential QEMU_CREDENTIAL (yes) credential and security tokens= are calculated according @@ -195,6 +195,7 @@ Argument Env-variable Description =20 Defaults: QEMU_PATH=3D$QEMU_PATH +QEMU_SUFFIX=3D$QEMU_SUFFIX QEMU_PERSISTENT=3D$QEMU_PERSISTENT QEMU_CREDENTIAL=3D$QEMU_CREDENTIAL =20 @@ -327,13 +328,11 @@ BINFMT_SET=3Dqemu_register_interpreter SYSTEMDDIR=3D"/etc/binfmt.d" DEBIANDIR=3D"/usr/share/binfmts" =20 -QEMU_PATH=3D/usr/local/bin - +QEMU_PATH=3D"${QEMU_PATH:-/usr/local/bin}" +QEMU_SUFFIX=3D"${QEMU_SUFFIX:-}" QEMU_PERSISTENT=3D"${QEMU_PERSISTENT:-no}" QEMU_CREDENTIAL=3D"${QEMU_CREDENTIAL:-no}" =20 -QEMU_SUFFIX=3D"" - options=3D$(getopt -o ds:Q:S:e:hcp -l debian,systemd:,path:,suffix:,export= dir:,help,credential,persistent -- "$@") eval set -- "$options" =20 --=20 2.25.1 From nobody Mon Mar 31 20:30:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583779342; cv=none; d=zohomail.com; s=zohoarc; b=KDEoMkmS9eAK8bWTXCsblgzTLkbfk54gOjD4DitI/OSwWzR9kvWVQGzR6Fmz/tCw4rsZcMOXiqrR01Yd3x8fG2I+v6gk8WFGe23Q5dQwyVKnum7vEVFf1JLzJLCJs9aRUVdqqK929sjEkfZ6haovqs1rXIgqF0sD0lLXqeMNwcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583779342; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JBGPIdW1mCaCTuy+nGmt9LwWNgA6zFtIgyYx9pyjngM=; b=nFEHskDCjWJQSmpOajf9j5XKOakPbWpuegrokF/IPejEfp6FmYrUugn4xi+d8B0r0H/V2yb6eAKGak3OE4gmWVV4HTtFxir5eN0POt4tFGQyfkpveJZ1fbkzku0i444yeA3T/MzApQHUoqzloAS0xZOrVjItE236ZXe7AEwQMJU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583779342404132.0998215815431; Mon, 9 Mar 2020 11:42:22 -0700 (PDT) Received: from localhost ([::1]:47998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNM4-0002Ht-RX for importer@patchew.org; Mon, 09 Mar 2020 14:42:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42537) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNKn-0000a4-JS for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:41:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBNKl-0005Oc-Tm for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:41:01 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:58514 helo=smtp.ehu.eus) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBNKl-0005OC-Gh for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:40:59 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id E27F861E1; Mon, 9 Mar 2020 19:40:57 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C75DE5A04F; Mon, 9 Mar 2020 19:40:57 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BC7595A045; Mon, 9 Mar 2020 19:40:57 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 9 Mar 2020 19:40:57 +0100 (CET) Received: from 669c1c222ef4 (static.187.0.0.81.ibercom.com [81.0.0.187]) by smtp2 (Postfix) with ESMTPSA id 788B461E1; Mon, 9 Mar 2020 19:40:57 +0100 (CET) Date: Mon, 9 Mar 2020 18:40:56 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v9 7/9] qemu-binfmt-conf.sh: generalize to positional [TARGETS] Message-ID: <20200309184056.GG14@669c1c222ef4> References: <20200309183521.GA9@669c1c222ef4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200309183521.GA9@669c1c222ef4> X-Greylist: ACL 191 matched, not delayed by milter-greylist-4.6.2 (smtp2 [10.0.100.76]); Mon, 09 Mar 2020 19:40:57 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25280.001 X-TM-AS-Result: No--6.998-7.0-31-10 X-imss-scan-details: No--6.998-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25280.001 X-TMASE-Result: 10--6.998000-10.000000 X-TMASE-MatchedRID: YJG9ytXm/s6u1FVcbKqeS31zro62qhdCM0wEwxpnA/6+fWK8N2kAhz7s j+R9FMn6w9YhgVtZ5FSWFZNqBtigagJ5EJtQroRi/Tc2iq45CnupZoxavGZhju9FCyScBaYaxM9 DM4OIRzZQ6yZ033EzWvVjmIj0I4/bgbzQvVJsmAc/ApMPW/xhXlQQ0EgzIoPR33Nl3elSfsq6o5 pOE3X0ptg9dKgWHMAdkb3r+FsnMU10J8anK3Imuujl+xhc/R9QK1PH96GPPGAN+F513KGyq4eEz yqa7HdJl+J1cqvNn071m0jxLTibTlsMX+cJfRDxxi///JpaHQM/pOSL72dTf6tNdpFrZXd82VC1 QWKKKPprZ54ynQshcEC9kO2OSfgdwL+8p4iyg3yeAiCmPx4NwNivpTdmVCR2xEHRux+uk8h+ICq uNi0WJK2FpudmaBRapozoynBulkA6SaTgETYDvyN596N4GzCeftwZ3X11IV0= X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp2.imsva2 [10.0.100.76]); Mon, 09 Mar 2020 19:40:57 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This breaks brackward compatibility. Option '--systemd CPU' allows to register binfmt interpreters for a single target architecture or for 'ALL' (of them). This patch generalizes the approach to support it in any mode (default, '--debian' or '--systemd'). To do so, option 'systemd' is changed to be boolean (no args). Then, all the positional arguments are considered to be a list of target architectures. If no positional arguments are provided, all of the architectures in qemu_target_list are registered. Conversely, argument value 'NONE' allows to make a 'dry run' of the script. I.e., checks are executed according to the mode, but no interpreter is registered. Support QEMU_TARGETS environment variable, consistently with 'path', 'suffix', 'persistent' and 'credential', The supported formats are the same as for positional arguments, which have priority. If both the variable and the list of positional arguments are empty, defaults to qemu_target_list. Signed-off-by: umarcor Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 80 +++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index b1a54aa470..538ef4aec0 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -6,6 +6,28 @@ ppc ppc64 ppc64le m68k mips mipsel mipsn32 mipsn32el mips6= 4 mips64el \ sh4 sh4eb s390x aarch64 aarch64_be hppa riscv32 riscv64 xtensa xtensaeb \ microblaze microblazeel or1k x86_64" =20 +# check if given TARGETS is/are in the supported target list +qemu_check_target_list() { + if [ $# -eq 0 ]; then + checked_target_list=3D"$qemu_target_list" + return + fi + unset checked_target_list + for target; do + for cpu in $qemu_target_list; do + if [ "x$cpu" =3D "x$target" ]; then + checked_target_list=3D"$checked_target_list $target" + break + fi + done + if [ "x$cpu" !=3D "x$target" ]; then + echo "ERROR: unknown CPU \"$target\"" 1>&2 + usage + exit 1 + fi + done +} + i386_magic=3D'\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\= x00\x03\x00' i386_mask=3D'\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\= xff\xfe\xff\xff\xff' i386_family=3Di386 @@ -171,14 +193,16 @@ qemu_get_family() { =20 usage() { cat <&2 - usage - exit 1 - fi - fi ;; -Q|--path) shift @@ -394,5 +404,7 @@ while true; do shift done =20 +shift + $CHECK -qemu_set_binfmts +qemu_set_binfmts "$@" --=20 2.25.1 From nobody Mon Mar 31 20:30:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583779452; cv=none; d=zohomail.com; s=zohoarc; b=mtwolOTyGI8oMHIztug9rQscQeY0NoI8V+EC0Q0WJRmSxPuT29Qx75bZTZ+RqD1FrKas26q2NNCVpLClWYI8vfzFAisadxVVma/8zHBSWzoRm/jRx0i2q8Fhd/EdvnhdPmhzAaIptcHLXHbpBqmQDU18Uqedg3UXWBqlsX5dr1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583779452; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6kWQuu3Sh/C0x3o2OT0RJUBHCCJGxYFdbSEPBzrrcSY=; b=C297p81hwxar7OrrlZHr0JIdib7t5FtmBX991a4p0KOG75zRKB9RgLV8QUGfCzLD2F8RTqmW8t9tTnmL/ah8TP/E0jdaXt4cX+o9wceGLBl3YMPeZUTEhxEVTPD1aeo+HT7ei8P0LPAIUVB/Jjg+giYBDj26S5u+TXz4oDncH6c= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583779452715218.2369460799847; Mon, 9 Mar 2020 11:44:12 -0700 (PDT) Received: from localhost ([::1]:48026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNNr-0005o9-LJ for importer@patchew.org; Mon, 09 Mar 2020 14:44:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42632) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNLH-0001G3-Ek for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:41:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBNLG-0005av-1F for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:41:31 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:63012 helo=smtp.ehu.eus) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBNLF-0005aR-LM for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:41:29 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 913DA61E1; Mon, 9 Mar 2020 19:41:28 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 57BBD5A053; Mon, 9 Mar 2020 19:41:28 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C8BC5A050; Mon, 9 Mar 2020 19:41:28 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 9 Mar 2020 19:41:28 +0100 (CET) Received: from 669c1c222ef4 (static.187.0.0.81.ibercom.com [81.0.0.187]) by smtp2 (Postfix) with ESMTPSA id 0A39764BB; Mon, 9 Mar 2020 19:41:28 +0100 (CET) Date: Mon, 9 Mar 2020 18:41:26 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v9 8/9] qemu-binfmt-conf.sh: add option --clear Message-ID: <20200309184126.GH14@669c1c222ef4> References: <20200309183521.GA9@669c1c222ef4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200309183521.GA9@669c1c222ef4> X-Greylist: ACL 191 matched, not delayed by milter-greylist-4.6.2 (smtp2 [10.0.100.76]); Mon, 09 Mar 2020 19:41:28 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25280.001 X-TM-AS-Result: No-1.776-7.0-31-10 X-imss-scan-details: No-1.776-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25280.001 X-TMASE-Result: 10-1.775800-10.000000 X-TMASE-MatchedRID: YJG9ytXm/s5nuEpLNqEJsme0F1HB9i2hMVx/3ZYby796pt1oU+C/pOwX ofcWCzMeR5VEg2WHb7e6w0blN6o1l/MNTbjUKZM+20204SCJw/rLvfc3C6SWwnO0TctWrlA9dfu huqa4A1AZw5ucm3NLWhvYV6pkN/jgOLzSBOk91M5bF+jvJlkOptxs0lj1L8rvaUoLEaPNsPSl+9 Tl6lXp3K3aC25avUuauxliYAiybD/AHXRKkXCmPIIK2tjTqNotp1Pjcaldww0aVuuTY4OGgweWZ DV/J9uBGHD/KNtC9kNVhnxWlpagXK0iin8P0KjVKrDHzH6zmUXf+zJsO3bf/t9zZd3pUn7KlMa9 Q0Vx5vSl0s9gTN4+NZpBpHnW+wt+Wb1kI9uGZd+eAiCmPx4NwNivpTdmVCR2xEHRux+uk8ifEzJ 5hPndGXxqZoGIPX8Y+Lg+FkJw5Mx6KDeJ828D58CmQW6Xs5JoX8ngXjbQD/6R6RBq0m416KjYwA elybSOx9GG6tJ5RTDW65fiNexYGwnoQr0aJHnc0egPf++T1T/YdbOkPFfd3aWs8euL9yX5w8g2H BNcF5k= X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp2.imsva2 [10.0.100.76]); Mon, 09 Mar 2020 19:41:28 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is a partial implementation. Allows to remove a single or a list of already registered binfmt interpreters. Valid values are those in qemu_target_list. If TARGETS is empty, all the existing 'qemu-*' interpreters are removed. This is partial because 'debian' and 'systemd' configurations are not supported. The script will exit with error 'option clear not implemented for this mode yet'. Removal is done by printing '-1' as explained at: https://www.kernel.org/doc/Documentation/admin-guide/binfmt-misc.rst Signed-off-by: umarcor Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 538ef4aec0..55224a68e1 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -201,7 +201,7 @@ Options and associated environment variables: =20 Argument Env-variable Description TARGETS QEMU_TARGETS A single arch name or a list of them= (see all names below); - if empty, configure all known target= s; + if empty, configure/clear all known = targets; if 'NONE', no interpreter is configu= red. -h|--help display this usage -Q|--path PATH QEMU_PATH set path to qemu interpreter(s) @@ -210,6 +210,8 @@ TARGETS QEMU_TARGETS A single arch nam= e or a list of them (see uses are cloned from the open file. -c|--credential QEMU_CREDENTIAL (yes) credential and security tokens= are calculated according to the binary to interpret +-r|--clear QEMU_CLEAR (yes) remove registered interpreters= for target TARGETS; + then exit. -e|--exportdir PATH define where to write configuration = files (default: $SYSTEMDDIR or $DEBIANDIR) -s|--systemd don't write into /proc, generate fil= e(s) for @@ -222,6 +224,7 @@ QEMU_PATH=3D$QEMU_PATH QEMU_SUFFIX=3D$QEMU_SUFFIX QEMU_PERSISTENT=3D$QEMU_PERSISTENT QEMU_CREDENTIAL=3D$QEMU_CREDENTIAL +QEMU_CLEAR=3D$QEMU_CLEAR =20 To import templates with update-binfmts, use : =20 @@ -348,8 +351,22 @@ qemu_set_binfmts() { done } =20 +qemu_clear_notimplemented() { + echo "ERROR: option clear not implemented for this mode yet" 1>&2 + usage + exit 1 +} + +qemu_clear_interpreter() { + p=3D"/proc/sys/fs/binfmt_misc/$1" + if [ -f "$p" ]; then + printf %s -1 > "$p" + fi +} + CHECK=3Dqemu_check_bintfmt_misc BINFMT_SET=3Dqemu_register_interpreter +BINFMT_CLEAR=3Dqemu_clear_interpreter =20 SYSTEMDDIR=3D"/etc/binfmt.d" DEBIANDIR=3D"/usr/share/binfmts" @@ -359,20 +376,26 @@ QEMU_PATH=3D"${QEMU_PATH:-/usr/local/bin}" QEMU_SUFFIX=3D"${QEMU_SUFFIX:-}" QEMU_PERSISTENT=3D"${QEMU_PERSISTENT:-no}" QEMU_CREDENTIAL=3D"${QEMU_CREDENTIAL:-no}" +QEMU_CLEAR=3D"${QEMU_CLEAR:-no}" =20 -options=3D$(getopt -o dsQ:S:e:hcp -l debian,systemd,path:,suffix:,exportdi= r:,help,credential,persistent -- "$@") +options=3D$(getopt -o rdsQ:S:e:hcp -l clear,debian,systemd,path:,suffix:,e= xportdir:,help,credential,persistent -- "$@") eval set -- "$options" =20 while true; do case "$1" in + -r|--clear) + QEMU_CLEAR=3D"yes" + ;; -d|--debian) CHECK=3Dqemu_check_debian BINFMT_SET=3Dqemu_generate_debian + BINFMT_CLEAR=3Dqemu_clear_notimplemented EXPORTDIR=3D${EXPORTDIR:-$DEBIANDIR} ;; -s|--systemd) CHECK=3Dqemu_check_systemd BINFMT_SET=3Dqemu_generate_systemd + BINFMT_CLEAR=3Dqemu_clear_notimplemented EXPORTDIR=3D${EXPORTDIR:-$SYSTEMDDIR} ;; -Q|--path) @@ -407,4 +430,13 @@ done shift =20 $CHECK + +if [ "x$QEMU_CLEAR" =3D "xyes" ]; then + qemu_check_target_list "$@" + for t in $checked_target_list; do + $BINFMT_CLEAR "qemu-$t" + done + exit +fi + qemu_set_binfmts "$@" --=20 2.25.1 From nobody Mon Mar 31 20:30:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583779570; cv=none; d=zohomail.com; s=zohoarc; b=lry0uiv5IVmEeEEwB3T9dSxjuDoiJ85dKmCHCtHSf9LcRzk+lAjn/q+0vIU32TVptQCS/iR3E60t/9JwTvZmR3mER69TVUdpaN34k1r2r7koGIZt5HYb/lgSANsNx20+C5uSS06JJZcVPlf/eD29NfOAvVIzGArvGhCJPTIWcOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583779570; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=olB21qyffskmH7y/+M9PvtCfCM3aFSdldHckuPiI08o=; b=P9uL9T6NnZbVwGbcpBiLNgM2xHN5IL6mTz51waT4yxbdWnZ3G3t9qTC7rRInuIAn2MZsRLQi2PyT7gtEGqy3HBMAT8PD86qgHMScv3Y+XBPCqHS2VAgh6jLaDSrs1XyvrZIlRQQxQDyHQIIqg/pfe2g1Oi6MeFV6bb3AUKCCu5Y= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583779570901702.111534951611; Mon, 9 Mar 2020 11:46:10 -0700 (PDT) Received: from localhost ([::1]:48068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNPl-0008KV-HF for importer@patchew.org; Mon, 09 Mar 2020 14:46:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42732) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNLh-00025e-BB for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:41:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBNLg-0005k8-58 for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:41:57 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:4074 helo=smtp.ehu.eus) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBNLf-0005jk-PO for qemu-devel@nongnu.org; Mon, 09 Mar 2020 14:41:56 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id BB9A861E1; Mon, 9 Mar 2020 19:41:54 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 84B285A04F; Mon, 9 Mar 2020 19:41:54 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 795655A045; Mon, 9 Mar 2020 19:41:54 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 9 Mar 2020 19:41:54 +0100 (CET) Received: from 669c1c222ef4 (static.187.0.0.81.ibercom.com [81.0.0.187]) by smtp2 (Postfix) with ESMTPSA id 3778464BB; Mon, 9 Mar 2020 19:41:54 +0100 (CET) Date: Mon, 9 Mar 2020 18:41:53 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v9 9/9] qemu-binfmt-conf.sh: add --test Message-ID: <20200309184153.GI14@669c1c222ef4> References: <20200309183521.GA9@669c1c222ef4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200309183521.GA9@669c1c222ef4> X-Greylist: ACL 191 matched, not delayed by milter-greylist-4.6.2 (smtp2 [10.0.100.76]); Mon, 09 Mar 2020 19:41:54 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25280.001 X-TM-AS-Result: No--2.997-7.0-31-10 X-imss-scan-details: No--2.997-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25280.001 X-TMASE-Result: 10--2.997200-10.000000 X-TMASE-MatchedRID: C2Ox2wkr63hnuEpLNqEJsi2416nc3bQlcZ9gNqdc/asHZBaLwEXlKGb6 PphVtfZgqZ4KncYE2LNLKA6O53vFEgcVh2A5MTJF6OX7GFz9H1DnaaW2UTafyBpW65Njg4aDrr5 TE4GLzk3aw+TzluSPBbpxDH0YWH+IrjwZVDJcDJ81VHP4fCovgg4fD/I06RGBn7jOJQ+rgvE6dE UNf2ygXDTG16mgO0fW4dBoWJ2sWPf83RazFYjhB8zSKGx9g8xhZlQDEANheHGbKItl61J/yX2PY bDNMTe9KrauXd3MZDVXdESAFhjsvKGsykM7wjSj7n4g7rh/SbFraIOpF3W1qoRBvsjJDU2Dg6RB ZjtwN4DldfJG5GZZuA1MDj3rRxcUYAg4cU+zyHqXQcmMSwV+f1i7FP9SiiauF1qISuK4qVqjyqn hL+I3r7JQSBWmvqaR X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp2.imsva2 [10.0.100.76]); Mon, 09 Mar 2020 19:41:54 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: umarcor Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 55224a68e1..21c8f63916 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -201,8 +201,7 @@ Options and associated environment variables: =20 Argument Env-variable Description TARGETS QEMU_TARGETS A single arch name or a list of them= (see all names below); - if empty, configure/clear all known = targets; - if 'NONE', no interpreter is configu= red. + if empty, configure/clear all known = targets. -h|--help display this usage -Q|--path PATH QEMU_PATH set path to qemu interpreter(s) -F|--suffix SUFFIX QEMU_SUFFIX add a suffix to the default interpre= ter name @@ -212,6 +211,8 @@ TARGETS QEMU_TARGETS A single arch nam= e or a list of them (see to the binary to interpret -r|--clear QEMU_CLEAR (yes) remove registered interpreters= for target TARGETS; then exit. +-t|--test QEMU_TEST (yes) test the setup with the provid= ed arguments, but do not + configure any of the interpreters. -e|--exportdir PATH define where to write configuration = files (default: $SYSTEMDDIR or $DEBIANDIR) -s|--systemd don't write into /proc, generate fil= e(s) for @@ -225,6 +226,7 @@ QEMU_SUFFIX=3D$QEMU_SUFFIX QEMU_PERSISTENT=3D$QEMU_PERSISTENT QEMU_CREDENTIAL=3D$QEMU_CREDENTIAL QEMU_CLEAR=3D$QEMU_CLEAR +QEMU_TEST=3D$QEMU_TEST =20 To import templates with update-binfmts, use : =20 @@ -323,9 +325,6 @@ qemu_set_binfmts() { =20 # reduce the list of target interpreters to those given in the CLI targets=3D${@:-$QEMU_TARGET} - if [ "x$targets" =3D "xNONE" ]; then - return - fi qemu_check_target_list $targets =20 # register the interpreter for each target except for the native one @@ -377,12 +376,16 @@ QEMU_SUFFIX=3D"${QEMU_SUFFIX:-}" QEMU_PERSISTENT=3D"${QEMU_PERSISTENT:-no}" QEMU_CREDENTIAL=3D"${QEMU_CREDENTIAL:-no}" QEMU_CLEAR=3D"${QEMU_CLEAR:-no}" +QEMU_TEST=3D"${QEMU_TEST:-no}" =20 -options=3D$(getopt -o rdsQ:S:e:hcp -l clear,debian,systemd,path:,suffix:,e= xportdir:,help,credential,persistent -- "$@") +options=3D$(getopt -o trdsQ:S:e:hcp -l test,clear,debian,systemd,path:,suf= fix:,exportdir:,help,credential,persistent -- "$@") eval set -- "$options" =20 while true; do case "$1" in + -t|--test) + QEMU_TEST=3D"yes" + ;; -r|--clear) QEMU_CLEAR=3D"yes" ;; @@ -431,6 +434,11 @@ shift =20 $CHECK =20 +if [ "x$QEMU_TEST" =3D "xyes" ]; then + BINFMT_SET=3D: + BINFMT_CLEAR=3D: +fi + if [ "x$QEMU_CLEAR" =3D "xyes" ]; then qemu_check_target_list "$@" for t in $checked_target_list; do --=20 2.25.1