From patchwork Mon Mar 9 18:36:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 11427753 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C47F814B7 for ; Mon, 9 Mar 2020 18:38:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A54C920873 for ; Mon, 9 Mar 2020 18:38:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A54C920873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ehu.eus Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNHw-0003zl-QB for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Mar 2020 14:38:04 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 } 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() { } 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" } 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() { qemu_generate_register() { flags="" - if [ "$CREDENTIAL" = "yes" ] ; then + if [ "x$CREDENTIAL" = "xyes" ]; then flags="OC" fi - if [ "$PERSISTENT" = "yes" ] ; then + if [ "x$PERSISTENT" = "xyes" ]; then flags="${flags}F" fi @@ -295,23 +295,23 @@ qemu_set_binfmts() { # register the interpreter for each cpu except for the native one - for cpu in ${qemu_target_list} ; do + for cpu in ${qemu_target_list}; do magic=$(eval echo \$${cpu}_magic) mask=$(eval echo \$${cpu}_mask) family=$(eval echo \$${cpu}_family) - if [ "$magic" = "" ] || [ "$mask" = "" ] || [ "$family" = "" ] ; then + if [ "x$magic" = "x" ] || [ "x$mask" = "x" ] || [ "x$family" = "x" ]; then echo "INTERNAL ERROR: unknown cpu $cpu" 1>&2 continue fi qemu="$QEMU_PATH/qemu-$cpu" - if [ "$cpu" = "i486" ] ; then + if [ "x$cpu" = "xi486" ]; then qemu="$QEMU_PATH/qemu-i386" fi qemu="$qemu$QEMU_SUFFIX" - if [ "$host_family" != "$family" ] ; then + if [ "x$host_family" != "x$family" ]; then $BINFMT_SET fi done @@ -331,7 +331,7 @@ QEMU_SUFFIX="" options=$(getopt -o ds:Q:S:e:hc:p: -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential:,persistent: -- "$@") eval set -- "$options" -while true ; do +while true; do case "$1" in -d|--debian) CHECK=qemu_check_debian @@ -344,14 +344,14 @@ while true ; do EXPORTDIR=${EXPORTDIR:-$SYSTEMDDIR} shift # check given cpu is in the supported CPU list - if [ "$1" != "ALL" ] ; then - for cpu in ${qemu_target_list} ; do - if [ "$cpu" = "$1" ] ; then + if [ "$1" != "ALL" ]; then + for cpu in ${qemu_target_list}; do + if [ "$cpu" = "$1" ]; then break fi done - if [ "$cpu" = "$1" ] ; then + if [ "$cpu" = "$1" ]; then qemu_target_list="$1" else echo "ERROR: unknown CPU \"$1\"" 1>&2 From patchwork Mon Mar 9 18:37:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 11427755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3144114B7 for ; Mon, 9 Mar 2020 18:38:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11C0E20873 for ; Mon, 9 Mar 2020 18:38:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11C0E20873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ehu.eus Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNIV-0005Cj-84 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Mar 2020 14:38:39 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 < X-Patchwork-Id: 11427757 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 918F692A for ; Mon, 9 Mar 2020 18:39:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7228F20873 for ; Mon, 9 Mar 2020 18:39:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7228F20873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ehu.eus Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNJ0-000636-IZ for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Mar 2020 14:39:10 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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=yes) --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=yes) To import templates with update-binfmts, use : @@ -259,10 +261,10 @@ qemu_check_systemd() { qemu_generate_register() { flags="" - if [ "x$CREDENTIAL" = "xyes" ]; then + if [ "x$QEMU_CREDENTIAL" = "xyes" ]; then flags="OC" fi - if [ "x$PERSISTENT" = "xyes" ]; then + if [ "x$QEMU_PERSISTENT" = "xyes" ]; then flags="${flags}F" fi @@ -285,7 +287,7 @@ package qemu-$cpu interpreter $qemu magic $magic mask $mask -credential $CREDENTIAL +credential $QEMU_CREDENTIAL EOF } @@ -324,8 +326,10 @@ SYSTEMDDIR="/etc/binfmt.d" DEBIANDIR="/usr/share/binfmts" QEMU_PATH=/usr/local/bin -CREDENTIAL=no -PERSISTENT=no + +QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}" +QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" + QEMU_SUFFIX="" options=$(getopt -o ds:Q:S:e:hcp -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential,persistent -- "$@") @@ -377,10 +381,10 @@ while true; do exit 1 ;; -c|--credential) - CREDENTIAL="yes" + QEMU_CREDENTIAL="yes" ;; -p|--persistent) - PERSISTENT="yes" + QEMU_PERSISTENT="yes" ;; *) break From patchwork Mon Mar 9 18:38:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 11427761 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DCC2F921 for ; Mon, 9 Mar 2020 18:42:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD00520873 for ; Mon, 9 Mar 2020 18:42:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD00520873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ehu.eus Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNLw-0002dD-Sx for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Mar 2020 14:42:12 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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() { usage() { cat < X-Patchwork-Id: 11427767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB2D892A for ; Mon, 9 Mar 2020 18:42:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C0DE20873 for ; Mon, 9 Mar 2020 18:42:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C0DE20873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ehu.eus Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNMS-0003dE-Od for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Mar 2020 14:42:44 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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() { usage() { cat < X-Patchwork-Id: 11427765 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 08C9E921 for ; Mon, 9 Mar 2020 18:42:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD6C620873 for ; Mon, 9 Mar 2020 18:42:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD6C620873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ehu.eus Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNMD-00035b-1z for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Mar 2020 14:42:29 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 interpreter name +-F|--suffix SUFFIX QEMU_SUFFIX add a suffix to the default interpreter 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 Defaults: QEMU_PATH=$QEMU_PATH +QEMU_SUFFIX=$QEMU_SUFFIX QEMU_PERSISTENT=$QEMU_PERSISTENT QEMU_CREDENTIAL=$QEMU_CREDENTIAL @@ -327,13 +328,11 @@ BINFMT_SET=qemu_register_interpreter SYSTEMDDIR="/etc/binfmt.d" DEBIANDIR="/usr/share/binfmts" -QEMU_PATH=/usr/local/bin - +QEMU_PATH="${QEMU_PATH:-/usr/local/bin}" +QEMU_SUFFIX="${QEMU_SUFFIX:-}" QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}" QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" -QEMU_SUFFIX="" - options=$(getopt -o ds:Q:S:e:hcp -l debian,systemd:,path:,suffix:,exportdir:,help,credential,persistent -- "$@") eval set -- "$options" From patchwork Mon Mar 9 18:40:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 11427759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB88492A for ; Mon, 9 Mar 2020 18:42:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB69F20873 for ; Mon, 9 Mar 2020 18:42:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB69F20873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ehu.eus Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNLo-0002Ht-TN for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Mar 2020 14:42:04 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 mips64 mips64el \ sh4 sh4eb s390x aarch64 aarch64_be hppa riscv32 riscv64 xtensa xtensaeb \ microblaze microblazeel or1k x86_64" +# check if given TARGETS is/are in the supported target list +qemu_check_target_list() { + if [ $# -eq 0 ]; then + checked_target_list="$qemu_target_list" + return + fi + unset checked_target_list + for target; do + for cpu in $qemu_target_list; do + if [ "x$cpu" = "x$target" ]; then + checked_target_list="$checked_target_list $target" + break + fi + done + if [ "x$cpu" != "x$target" ]; then + echo "ERROR: unknown CPU \"$target\"" 1>&2 + usage + exit 1 + fi + done +} + i386_magic='\x7fELF\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\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' i386_family=i386 @@ -171,14 +193,16 @@ qemu_get_family() { usage() { cat <&2 - usage - exit 1 - fi - fi ;; -Q|--path) shift @@ -394,5 +404,7 @@ while true; do shift done +shift + $CHECK -qemu_set_binfmts +qemu_set_binfmts "$@" From patchwork Mon Mar 9 18:41:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 11427771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28AAA92A for ; Mon, 9 Mar 2020 18:43:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0971B20873 for ; Mon, 9 Mar 2020 18:43:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0971B20873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ehu.eus Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNNe-0005o9-80 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Mar 2020 14:43:58 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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: 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 targets; + if empty, configure/clear all known targets; if 'NONE', no interpreter is configured. -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 name 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 file(s) for @@ -222,6 +224,7 @@ QEMU_PATH=$QEMU_PATH QEMU_SUFFIX=$QEMU_SUFFIX QEMU_PERSISTENT=$QEMU_PERSISTENT QEMU_CREDENTIAL=$QEMU_CREDENTIAL +QEMU_CLEAR=$QEMU_CLEAR To import templates with update-binfmts, use : @@ -348,8 +351,22 @@ qemu_set_binfmts() { done } +qemu_clear_notimplemented() { + echo "ERROR: option clear not implemented for this mode yet" 1>&2 + usage + exit 1 +} + +qemu_clear_interpreter() { + p="/proc/sys/fs/binfmt_misc/$1" + if [ -f "$p" ]; then + printf %s -1 > "$p" + fi +} + CHECK=qemu_check_bintfmt_misc BINFMT_SET=qemu_register_interpreter +BINFMT_CLEAR=qemu_clear_interpreter SYSTEMDDIR="/etc/binfmt.d" DEBIANDIR="/usr/share/binfmts" @@ -359,20 +376,26 @@ QEMU_PATH="${QEMU_PATH:-/usr/local/bin}" QEMU_SUFFIX="${QEMU_SUFFIX:-}" QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}" QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" +QEMU_CLEAR="${QEMU_CLEAR:-no}" -options=$(getopt -o dsQ:S:e:hcp -l debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") +options=$(getopt -o rdsQ:S:e:hcp -l clear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") eval set -- "$options" while true; do case "$1" in + -r|--clear) + QEMU_CLEAR="yes" + ;; -d|--debian) CHECK=qemu_check_debian BINFMT_SET=qemu_generate_debian + BINFMT_CLEAR=qemu_clear_notimplemented EXPORTDIR=${EXPORTDIR:-$DEBIANDIR} ;; -s|--systemd) CHECK=qemu_check_systemd BINFMT_SET=qemu_generate_systemd + BINFMT_CLEAR=qemu_clear_notimplemented EXPORTDIR=${EXPORTDIR:-$SYSTEMDDIR} ;; -Q|--path) @@ -407,4 +430,13 @@ done shift $CHECK + +if [ "x$QEMU_CLEAR" = "xyes" ]; then + qemu_check_target_list "$@" + for t in $checked_target_list; do + $BINFMT_CLEAR "qemu-$t" + done + exit +fi + qemu_set_binfmts "$@" From patchwork Mon Mar 9 18:41:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 11427775 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8484A14E3 for ; Mon, 9 Mar 2020 18:45:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 64C8920873 for ; Mon, 9 Mar 2020 18:45:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64C8920873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ehu.eus Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBNPY-0008KV-Ic for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Mar 2020 14:45:56 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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: 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 configured. + 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 interpreter name @@ -212,6 +211,8 @@ TARGETS QEMU_TARGETS A single arch name 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 provided 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 file(s) for @@ -225,6 +226,7 @@ QEMU_SUFFIX=$QEMU_SUFFIX QEMU_PERSISTENT=$QEMU_PERSISTENT QEMU_CREDENTIAL=$QEMU_CREDENTIAL QEMU_CLEAR=$QEMU_CLEAR +QEMU_TEST=$QEMU_TEST To import templates with update-binfmts, use : @@ -323,9 +325,6 @@ qemu_set_binfmts() { # reduce the list of target interpreters to those given in the CLI targets=${@:-$QEMU_TARGET} - if [ "x$targets" = "xNONE" ]; then - return - fi qemu_check_target_list $targets # register the interpreter for each target except for the native one @@ -377,12 +376,16 @@ QEMU_SUFFIX="${QEMU_SUFFIX:-}" QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}" QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" QEMU_CLEAR="${QEMU_CLEAR:-no}" +QEMU_TEST="${QEMU_TEST:-no}" -options=$(getopt -o rdsQ:S:e:hcp -l clear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") +options=$(getopt -o trdsQ:S:e:hcp -l test,clear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") eval set -- "$options" while true; do case "$1" in + -t|--test) + QEMU_TEST="yes" + ;; -r|--clear) QEMU_CLEAR="yes" ;; @@ -431,6 +434,11 @@ shift $CHECK +if [ "x$QEMU_TEST" = "xyes" ]; then + BINFMT_SET=: + BINFMT_CLEAR=: +fi + if [ "x$QEMU_CLEAR" = "xyes" ]; then qemu_check_target_list "$@" for t in $checked_target_list; do