From patchwork Mon Mar 11 20:17:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1054865 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ehu.eus Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44J8dj1J4wz9s5c for ; Tue, 12 Mar 2019 07:21:45 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RQd-0003dv-4B for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 16:21:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RPc-0003Iq-Jm for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:20:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3RMJ-00063D-8g for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:17:16 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:52062 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 1h3RMI-000610-UC for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:17:15 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 862DA91B8; Mon, 11 Mar 2019 21:17:13 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55F255A04F; Mon, 11 Mar 2019 21:17:13 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A9185A045; Mon, 11 Mar 2019 21:17:13 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 21:17:13 +0100 (CET) Received: from 59ca1d9b7985 (unknown [139.47.78.33]) by smtp2 (Postfix) with ESMTPSA id 0732D91B8; Mon, 11 Mar 2019 21:17:12 +0100 (CET) Date: Mon, 11 Mar 2019 20:17:10 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311201710.GA9@59ca1d9b7985> References: <20190311201532.GA6@59ca1d9b7985> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311201532.GA6@59ca1d9b7985> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 179 matched, not delayed by milter-greylist-4.4.3 (smtp2); Mon, 11 Mar 2019 21:17:13 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24484.002 X-TM-AS-Result: No-0.937-7.0-31-10 X-imss-scan-details: No-0.937-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24484.002 X-TMASE-Result: 10-0.937300-10.000000 X-TMASE-MatchedRID: hwtUKlde9zE8mRT0SYY6fkvrB8UvzFr4viRliDV2nyxLgo8+IIHbcKyJ SPZ1MHFJyQUI9mjBTGrMJYD0aRF0RSvslLrYzXFMoMfp2vHck9X54F/2i/DwjTqI/Q1zONHSo3u yF/fzkXbL7a7vhpw6CH8mA3sDDq0A5vGrSCzt19MV7NKYhc1lOfoLR4+zsDTtQh+ArmEemWXzI8 5BvSDQEnjU4PjpPPRsLP70QQn0w25js9mwfpYMG/kUxKdM2YBcxqaFumKRJvRZapFMt7EZ+/7Nb EwbVh/qW8Mo9oUVlaBTq+NyuVQu+IbhWbmaLtpNkm94VhWUY9vjdetbrmPKzVXK9tOD+u6c 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.4.3 (postfix.smtp2.imsva2); Mon, 11 Mar 2019 21:17:13 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 158.227.0.66 Subject: [Qemu-devel] [PATCH v5 1/9] qemu-binfmt-conf.sh: enforce safe style consistency X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Spaces are added 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: Unai Martinez-Corral Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index b5a16742a1..0009385be2 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -219,12 +219,12 @@ qemu_check_access() { qemu_check_bintfmt_misc() { # load the binfmt_misc module - if [ ! -d /proc/sys/fs/binfmt_misc ]; then + if [ ! -d /proc/sys/fs/binfmt_misc ] ; then if ! /sbin/modprobe binfmt_misc ; then exit 1 fi fi - if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then + if [ ! -f /proc/sys/fs/binfmt_misc/register ] ; then if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc ; then exit 1 fi @@ -255,10 +255,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 @@ -296,18 +296,18 @@ qemu_set_binfmts() { 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 From patchwork Mon Mar 11 20:18:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1054867 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ehu.eus Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44J8hw6PW4z9sBF for ; Tue, 12 Mar 2019 07:24:32 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RTK-0005oF-Qf for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 16:24:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RPR-0003Iq-K2 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:20:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3RNn-0000bf-J5 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:18:48 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:26109 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 1h3RNn-0000Y1-8e for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:18:47 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id E6A3C98FB; Mon, 11 Mar 2019 21:18:45 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B69CB5A045; Mon, 11 Mar 2019 21:18:45 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AAB725A050; Mon, 11 Mar 2019 21:18:45 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 21:18:45 +0100 (CET) Received: from 59ca1d9b7985 (unknown [139.47.78.33]) by smtp2 (Postfix) with ESMTPSA id 67AF1BFF4; Mon, 11 Mar 2019 21:18:45 +0100 (CET) Date: Mon, 11 Mar 2019 20:18:48 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311201848.GB9@59ca1d9b7985> References: <20190311201532.GA6@59ca1d9b7985> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311201532.GA6@59ca1d9b7985> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 179 matched, not delayed by milter-greylist-4.4.3 (smtp2); Mon, 11 Mar 2019 21:18:45 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24484.002 X-TM-AS-Result: No-0.353-7.0-31-10 X-imss-scan-details: No-0.353-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24484.002 X-TMASE-Result: 10-0.353200-10.000000 X-TMASE-MatchedRID: mafpUJSAc1A8mRT0SYY6fvYiLRVJ915DU+A7YkpDJ1g76cr3lZK7RGuk bF2FNZCX0pQhZpR72XZU4ZaPWnopPkwzknXXiTeeYl83W3jnFDD7At+An9uo83PBWZjlMys2Cf2 h9A2gFAVwudrQH6GMcmKwOsgOBYuApjLap8Pn2LsG1NkcAmdR4CseSAhqf1rRTDoylMQmcK9Tf9 uxAWVtFeLzNWBegCW2U/185JqDvmbaqT6lqWS9QsRB0bsfrpPInxMyeYT53Rl0k78Xi2V63XlBz UwUcAkvz652VKTYXo1q4rxahAyhGy3EfHwcgkVprCSGRotTrQn19oHAk+oUfQ/0eKxYdOkTReim 6QLH0Yvpn6fQaYYfBmEZXwGzbQsWLOeM/yNfYDnlrtxuq+PMxcPINhwTXBeZ 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.4.3 (postfix.smtp2.imsva2); Mon, 11 Mar 2019 21:18:45 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 158.227.0.66 Subject: [Qemu-devel] [PATCH v5 2/9] qemu-binfmt-conf.sh: make opts -p and -c boolean X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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+incoming=patchwork.ozlabs.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 reduntant. 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: Unai Martinez-Corral Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 0009385be2..ca15ff8092 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -168,8 +168,8 @@ qemu_get_family() { usage() { cat < X-Patchwork-Id: 1054863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ehu.eus Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44J8dP6D22z9s5c for ; Tue, 12 Mar 2019 07:21:29 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RQN-0003UF-Ns for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 16:21:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RPQ-0003Iq-4E for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:20:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3ROH-0001hp-8c for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:19:18 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:43847 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 1h3ROG-0001ek-TG for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:19:17 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id EA184721B; Mon, 11 Mar 2019 21:19:15 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4EFD5A04F; Mon, 11 Mar 2019 21:19:15 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9D0C5A045; Mon, 11 Mar 2019 21:19:15 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 21:19:15 +0100 (CET) Received: from 59ca1d9b7985 (unknown [139.47.78.33]) by smtp2 (Postfix) with ESMTPSA id 76860721B; Mon, 11 Mar 2019 21:19:15 +0100 (CET) Date: Mon, 11 Mar 2019 20:19:18 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311201918.GC9@59ca1d9b7985> References: <20190311201532.GA6@59ca1d9b7985> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311201532.GA6@59ca1d9b7985> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 179 matched, not delayed by milter-greylist-4.4.3 (smtp2); Mon, 11 Mar 2019 21:19:15 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24484.002 X-TM-AS-Result: No-1.120-7.0-31-10 X-imss-scan-details: No-1.120-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24484.002 X-TMASE-Result: 10-1.120100-10.000000 X-TMASE-MatchedRID: P7d3tDo+wQo8mRT0SYY6fo6MisxJraxHecvjbu/xDjowEhHW5KVAzzO+ sIxDA42K0pQhZpR72XZU4ZaPWnopPibhJjVR0U351yMJs9mBCcUr2PDgwMWbIoKwF4K/wIz9AxE 7O5AxMWucHepQtiMfOBTcMjpPwLpOetI/1G0ZlijJ1E/nrJFEDxny1I2tysbymyiLZetSf8mfYw IIcLjjbeGANVBCTxXNC24oEZ6SpSlR8RAUGq/SZ2SWUv9NGeIZ4a2FNkv7/SSZMZldyp3i92NQ/ ugow9TVFE+rSqK76FhLxAWur9nHVLlY4DWRtTxP9j0acPgOcNyLORRq70g+bTfRxNq5/jk8Z6j2 OO0xbkIzq0nucUGfkI5AUTt0AWgUSac++I+/Ls3AvpLE+mvX8g== 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.4.3 (postfix.smtp2.imsva2); Mon, 11 Mar 2019 21:19:15 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 158.227.0.66 Subject: [Qemu-devel] [PATCH v5 3/9] qemu-binfmt-conf.sh: add QEMU_CREDENTIAL and QEMU_PERSISTENT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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+incoming=patchwork.ozlabs.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: Unai Martinez-Corral Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index ca15ff8092..ad9ae731a0 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -186,9 +186,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 : @@ -255,10 +257,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 @@ -281,7 +283,7 @@ package qemu-$cpu interpreter $qemu magic $magic mask $mask -credential $CREDENTIAL +credential $QEMU_CREDENTIAL EOF } @@ -320,8 +322,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 -- "$@") @@ -373,10 +377,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 11 20:20:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1054862 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ehu.eus Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44J8dH5Xgcz9s5c for ; Tue, 12 Mar 2019 07:21:19 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RQ9-0003Iz-Dn for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 16:21:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RPI-0003Iq-RF for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:20:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3ROy-0003EE-NR for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:20:01 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:16725 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 1h3ROy-00039X-BO for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:20:00 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id F323E98FB; Mon, 11 Mar 2019 21:19:58 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C254A5A045; Mon, 11 Mar 2019 21:19:58 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B67395A050; Mon, 11 Mar 2019 21:19:58 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 21:19:58 +0100 (CET) Received: from 59ca1d9b7985 (unknown [139.47.78.33]) by smtp2 (Postfix) with ESMTPSA id 72E19721B; Mon, 11 Mar 2019 21:19:58 +0100 (CET) Date: Mon, 11 Mar 2019 20:20:01 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311202001.GD9@59ca1d9b7985> References: <20190311201532.GA6@59ca1d9b7985> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311201532.GA6@59ca1d9b7985> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 179 matched, not delayed by milter-greylist-4.4.3 (smtp2); Mon, 11 Mar 2019 21:19:58 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24484.002 X-TM-AS-Result: No--1.497-7.0-31-10 X-imss-scan-details: No--1.497-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24484.002 X-TMASE-Result: 10--1.497400-10.000000 X-TMASE-MatchedRID: mafpUJSAc1A8mRT0SYY6fgPZZctd3P4B+Gz435tISEGUdmT0Eka3cn4z 9jl2IgzvgML9UOgCBPexXMuu/NKBHrDyQVN2cGlR4bl1FkKDELfUqhJbkmLVezUsHjosUACSnFq TWUo/GE0z6xRyeDQUk9rR3zP0abjQZgDJ5bVJkeT/VoEOchXiKVObpRiWjuVrVI7KaIl9Nhfy+k xyAtKJyeLzNWBegCW2U/185JqDvmbaqT6lqWS9QsRB0bsfrpPInxMyeYT53RkmGvaRAGrhuKYqt 9qyZSa5+w2fX7gIuRakH9vXofQNFd4a6WiS7bAiCdi0Ds//xDh8Lo3w5Bhr1rC5HFyG/ypLkAXC 6wFtp/Dpn6fQaYYfBmEZXwGzbQsWLOeM/yNfYDnlrtxuq+PMxVZca9RSYo/b 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.4.3 (postfix.smtp2.imsva2); Mon, 11 Mar 2019 21:19:59 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 158.227.0.66 Subject: [Qemu-devel] [PATCH v5 4/9] qemu-binfmt-conf.sh: use the same presentation format as for qemu-* X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Unai Martinez-Corral --- scripts/qemu-binfmt-conf.sh | 63 +++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 31 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index ad9ae731a0..35f61d9a6c 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -167,47 +167,48 @@ qemu_get_family() { usage() { cat < X-Patchwork-Id: 1054869 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ehu.eus Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44J8kT715rz9ryj for ; Tue, 12 Mar 2019 07:25:53 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RUd-00076s-QV for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 16:25:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RPn-0003mP-JX for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:20:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3RPm-0004kf-Oj for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:20:51 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:9550 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 1h3RPm-0004hf-CJ for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:20:50 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 67045721B; Mon, 11 Mar 2019 21:20:49 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 428345A04F; Mon, 11 Mar 2019 21:20:49 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 372FE5A045; Mon, 11 Mar 2019 21:20:49 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 21:20:49 +0100 (CET) Received: from 59ca1d9b7985 (unknown [139.47.78.33]) by smtp2 (Postfix) with ESMTPSA id E86F9721B; Mon, 11 Mar 2019 21:20:48 +0100 (CET) Date: Mon, 11 Mar 2019 20:20:51 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311202051.GE9@59ca1d9b7985> References: <20190311201532.GA6@59ca1d9b7985> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311201532.GA6@59ca1d9b7985> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 179 matched, not delayed by milter-greylist-4.4.3 (smtp2); Mon, 11 Mar 2019 21:20:49 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24484.002 X-TM-AS-Result: No--0.374-7.0-31-10 X-imss-scan-details: No--0.374-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24484.002 X-TMASE-Result: 10--0.374300-10.000000 X-TMASE-MatchedRID: a3o/0593/lo8mRT0SYY6fvYiLRVJ915D+nvSwfDbaCX0HEAj+4yaX0/O fkh/+AL4Xr7NXg/pSgQkzmvdgzo8hjhhzU44NexTYl83W3jnFDATbU1KYGoQp/gnJH5vm2+gKjl bbAp2U/fArQXEdIyvR7Fcy6780oEemko3PpH7ZG7XIwmz2YEJxX0tCKdnhB58dQgf7bli9LzT6J DACkKf2wP5zT0d393cxlblqLlYqXJL3/a71gXE/CPJyM2EYGqxDG8wvWYfqt/5z4ofzAYwfg6eM Ama6EJ+JCXBRvFatb1TW5hqeRDgoVlgMY0en6eIQFSTSF+c2OXMHaTeAcZOWN3WrhGUSfC8TRiD dzyAzmNLF4fxrdZ0s9+yfB9xNB3E 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.4.3 (postfix.smtp2.imsva2); Mon, 11 Mar 2019 21:20:49 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 158.227.0.66 Subject: [Qemu-devel] [PATCH v5 5/9] qemu-binfmt-conf.sh: remove 'qemu' prefix from cli options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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+incoming=patchwork.ozlabs.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: Unai Martinez-Corral Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 35f61d9a6c..124866246f 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -167,6 +167,7 @@ qemu_get_family() { usage() { cat < X-Patchwork-Id: 1054871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ehu.eus Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44J8pQ1xt3z9ryj for ; Tue, 12 Mar 2019 07:29:18 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RXw-0001iw-77 for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 16:29:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RQU-0004JH-MT for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:21:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3RQT-0006eg-UO for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:21:34 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:39556 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 1h3RQQ-0006PM-Gj for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:21:32 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id D007498FB; Mon, 11 Mar 2019 21:21:27 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94DA35A04F; Mon, 11 Mar 2019 21:21:27 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A32F5A045; Mon, 11 Mar 2019 21:21:27 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 21:21:27 +0100 (CET) Received: from 59ca1d9b7985 (unknown [139.47.78.33]) by smtp2 (Postfix) with ESMTPSA id 461B998FB; Mon, 11 Mar 2019 21:21:27 +0100 (CET) Date: Mon, 11 Mar 2019 20:21:30 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311202130.GF9@59ca1d9b7985> References: <20190311201532.GA6@59ca1d9b7985> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311201532.GA6@59ca1d9b7985> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 179 matched, not delayed by milter-greylist-4.4.3 (smtp2); Mon, 11 Mar 2019 21:21:27 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24484.002 X-TM-AS-Result: No--0.390-7.0-31-10 X-imss-scan-details: No--0.390-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24484.002 X-TMASE-Result: 10--0.389800-10.000000 X-TMASE-MatchedRID: alNhoJufFSQ8mRT0SYY6fo6MisxJraxH6SXuwUgGH0jTF92ikMV2gYCu qghmtWfX4vfiP6+NS81oUJgKmvCzhtH/WqWljGhSbQ9aoPSmWJEk80hXoYXya5iHbfFxQ8Qro8W MkQWv6iXpKNrfYIUgLIcyJo642SRt3QfwsVk0UbvqwGfCk7KUs0b0igc6zA/7xDyaIUOPOeYaFl UE2UkYvhp80Fo5E0LX0JBK5Wbxs4rjuREhNu2vZWoqT7PmzKkIcoLd/ozIu+nEe5Gqb3PJUGx8S 0nxThalnBu72ovT2F/i8atvTQB42kzdPFq1gcIzftwZ3X11IV0= 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.4.3 (postfix.smtp2.imsva2); Mon, 11 Mar 2019 21:21:27 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 158.227.0.66 Subject: [Qemu-devel] [PATCH v5 6/9] qemu-binfmt-conf.sh: honour QEMU_PATH and/or QEMU_SUFFIX X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Allow to set 'path' or 'suffix' through environment variables, consistently with 'persistent' and 'credential'. Signed-off-by: Unai Martinez-Corral Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 124866246f..5616ac60ce 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -177,7 +177,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 @@ -191,6 +191,7 @@ Argument Env-variable Description Defaults: QEMU_PATH=$QEMU_PATH +QEMU_SUFFIX=$QEMU_SUFFIX QEMU_PERSISTENT=$QEMU_PERSISTENT QEMU_CREDENTIAL=$QEMU_CREDENTIAL @@ -323,13 +324,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 11 20:22:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1054870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ehu.eus Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44J8mF2B3mz9ryj for ; Tue, 12 Mar 2019 07:27:24 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RW6-0000Dk-Ds for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 16:27:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RRX-000568-Nt for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:22:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3RRW-0000r8-C7 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:22:39 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:42567 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 1h3RRV-0000nG-TL for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:22:38 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 8244B98FB; Mon, 11 Mar 2019 21:22:36 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5179C5A04F; Mon, 11 Mar 2019 21:22:36 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 466FE5A045; Mon, 11 Mar 2019 21:22:36 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 21:22:36 +0100 (CET) Received: from 59ca1d9b7985 (unknown [139.47.78.33]) by smtp2 (Postfix) with ESMTPSA id 01ED698FB; Mon, 11 Mar 2019 21:22:35 +0100 (CET) Date: Mon, 11 Mar 2019 20:22:38 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311202238.GG9@59ca1d9b7985> References: <20190311201532.GA6@59ca1d9b7985> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311201532.GA6@59ca1d9b7985> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 179 matched, not delayed by milter-greylist-4.4.3 (smtp2); Mon, 11 Mar 2019 21:22:36 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24484.002 X-TM-AS-Result: No--4.542-7.0-31-10 X-imss-scan-details: No--4.542-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24484.002 X-TMASE-Result: 10--4.542100-10.000000 X-TMASE-MatchedRID: RsPxVIkBekw8mRT0SYY6fggKAWhuC2ojb6bRSg4rpzvrKAwxOgrz3ZG4 TFKxKJcilB6IdnaWhV1343G9TapOGGJnITZQ7LgcvnSVh24OCE6+JGWINXafLNchlMhSt6Fev4d GcGTuw1dfll+ZbVibhYAvT09hxhi7zO35OKTxh+U2zdLf3NqhdtGuPHzXu+/6c8FZmOUzKzZWFs MQfbcNE+L34j+vjUvNoxDjGqq9g0nPlrFA9QLlUlz+axQLnAVBK9jw4MDFmyJFDR0AKGX+XH/sD LdkieHySFvD9DvvV0KpWL1QDKxiuJH0YXYnbGoz/sToY2qzpx5eu6llOoM7BnnDQRq5CiZHjocz muoPCq2TeJ+HpGvTydHjjlQV3ftqe7CcuEm5BI4xZl64tW3wUk6QS6mKxcr3t7ek0mvcFcp8+Q2 ccBoP5A9h8wTVBgOca+Ba0gJyjb+d3SaL0pUZ0TIs/pHfy5KvymBsSxwng4cev0UmjjsZI564GT p+lG2X 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.4.3 (postfix.smtp2.imsva2); Mon, 11 Mar 2019 21:22:36 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 158.227.0.66 Subject: [Qemu-devel] [PATCH v5 7/9] qemu-binfmt-conf.sh: generalize to positional TARGETS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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+incoming=patchwork.ozlabs.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: Unai Martinez-Corral --- scripts/qemu-binfmt-conf.sh | 80 +++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 34 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 5616ac60ce..2be9867727 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -6,6 +6,28 @@ 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 @@ -167,14 +189,16 @@ qemu_get_family() { usage() { cat <&2 - usage - exit 1 - fi - fi ;; -Q|--path) shift @@ -390,5 +400,7 @@ while true ; do shift done +shift + $CHECK -qemu_set_binfmts +qemu_set_binfmts "$@" From patchwork Mon Mar 11 20:23:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1054873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ehu.eus Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44J8rq5k79z9s0W for ; Tue, 12 Mar 2019 07:31:23 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39906 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RZx-0004AZ-7w for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 16:31:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RSD-0005dp-EP for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:23:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3RSB-0002FL-V6 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:23:21 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:42098 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 1h3RS9-00029z-Vl for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:23:19 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 862DB11FE9; Mon, 11 Mar 2019 21:23:16 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60B205A04F; Mon, 11 Mar 2019 21:23:16 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55BFC5A045; Mon, 11 Mar 2019 21:23:16 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 21:23:16 +0100 (CET) Received: from 59ca1d9b7985 (unknown [139.47.78.33]) by smtp2 (Postfix) with ESMTPSA id 11C6111FE9; Mon, 11 Mar 2019 21:23:16 +0100 (CET) Date: Mon, 11 Mar 2019 20:23:19 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311202319.GH9@59ca1d9b7985> References: <20190311201532.GA6@59ca1d9b7985> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311201532.GA6@59ca1d9b7985> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 179 matched, not delayed by milter-greylist-4.4.3 (smtp2); Mon, 11 Mar 2019 21:23:16 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24484.002 X-TM-AS-Result: No--3.663-7.0-31-10 X-imss-scan-details: No--3.663-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24484.002 X-TMASE-Result: 10--3.662800-10.000000 X-TMASE-MatchedRID: x/EPlNU2vY08mRT0SYY6fguB7zdAMUjAbYZQU1whlX9UjspoiX02F0R7 kF2MEpMASIkcopeTUu6Of30LOspw9AjZsijeXMGW2MZGQuKc8UhaNaxZBRbNWiAWlErg1VlPShc oFt7Iuk8Zw5ucm3NLWkZb9TVWKMA5HKicLVBy7TlbF+jvJlkOpkyQ5fRSh265DgB6l2o8FRhCcg 190NG0LjElClGessEfhZoMPmZo0JT7zsWX+owtEwbU2RwCZ1Hgu56wFPSkMVGtj24Xqh0yXDvd4 jBDU8JFTJZ7Yn5FNw9lk+8lAsWWM+tFrKm0WeV6ydRP56yRRA9LxPtqS8Bm55soi2XrUn/Jn2MC CHC4423hgDVQQk8VzQtuKBGekqUpnH7sbImOEBQi9eA+aj/7MuKzQ5jWjjPhHfvBoD7eCf4I4bv 6ViQKNQQf8XBSe9tTorpKYENGnVAUHp6imQt5xfTiEA7KQPbeRkXwgWHvVes30cTauf45PGeo9j jtMW5CM6tJ7nFBn5COQFE7dAFoFLAUyUg9ogFt 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.4.3 (postfix.smtp2.imsva2); Mon, 11 Mar 2019 21:23:16 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 158.227.0.66 Subject: [Qemu-devel] [PATCH v5 8/9] qemu-binfmt-conf.sh: add option --clear X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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+incoming=patchwork.ozlabs.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: Unai Martinez-Corral --- scripts/qemu-binfmt-conf.sh | 39 +++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 2be9867727..382bdaabfe 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -197,7 +197,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) @@ -206,6 +206,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 DEBIANDIR define where to write configuration files SYSTEMDDIR -s|--systemd don't write into /proc, generate file(s) for @@ -218,6 +220,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 : @@ -344,8 +347,28 @@ 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() { + names='qemu-*' + if [ $# -ne 0 ] ; then + qemu_check_target_list $1 + unset names pre + for t in $checked_target_list ; do + names="${names}${pre}qemu-$t" + pre=' -o -name ' + done + fi + find /proc/sys/fs/binfmt_misc/ -type f -name "$names" -exec sh -c 'printf %s -1 > {}' \; +} + CHECK=qemu_check_bintfmt_misc BINFMT_SET=qemu_register_interpreter +BINFMT_CLEAR=qemu_clear_interpreter SYSTEMDDIR="/etc/binfmt.d" DEBIANDIR="/usr/share/binfmts" @@ -355,20 +378,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) @@ -403,4 +432,10 @@ done shift $CHECK + +if [ "x$QEMU_CLEAR" = "xyes" ] ; then + $BINFMT_CLEAR "$@" + exit +fi + qemu_set_binfmts "$@" From patchwork Mon Mar 11 20:24:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1054874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ehu.eus Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44J8xY5SgVz9s0W for ; Tue, 12 Mar 2019 07:35:29 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3Rdv-0006sf-NR for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 16:35:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3RT9-0006P4-68 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:24:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3RT8-0003n6-Bs for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:24:19 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:34367 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 1h3RT8-0003ld-0K for qemu-devel@nongnu.org; Mon, 11 Mar 2019 16:24:18 -0400 Received: from imsva2.lgp.ehu.es (imsva2.lgp.ehu.es [10.0.3.246]) by postfix.smtp2.imsva2 (Postfix) with ESMTPS id 8E8058A44; Mon, 11 Mar 2019 21:24:16 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5DAF75A04F; Mon, 11 Mar 2019 21:24:16 +0100 (CET) Received: from imsva2.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5267C5A045; Mon, 11 Mar 2019 21:24:16 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.76]) by imsva2.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 21:24:16 +0100 (CET) Received: from 59ca1d9b7985 (unknown [139.47.78.33]) by smtp2 (Postfix) with ESMTPSA id C727C8A44; Mon, 11 Mar 2019 21:24:15 +0100 (CET) Date: Mon, 11 Mar 2019 20:24:18 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311202418.GI9@59ca1d9b7985> References: <20190311201532.GA6@59ca1d9b7985> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311201532.GA6@59ca1d9b7985> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 179 matched, not delayed by milter-greylist-4.4.3 (smtp2); Mon, 11 Mar 2019 21:24:16 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24484.002 X-TM-AS-Result: No--2.766-7.0-31-10 X-imss-scan-details: No--2.766-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24484.002 X-TMASE-Result: 10--2.765700-10.000000 X-TMASE-MatchedRID: ehvrJQ9m4PA8mRT0SYY6fguB7zdAMUjATJDl9FKHbrkOAHqXajwVGEJy DX3Q0bQuRZ3bsJ5dhK9sy3DPX9Umyv2E4cGVTliSEe5D10MltLYxmbT6wQT2a/HFoBcOsKez02b 9SFcwxUmVdYejSz2J/mFP3OsrR0xZlYSFi/RRLjcXKqR+w9a7UCtovaaHxlUrnQqircTOm4dZhL w6sxHoN/uBAQFQ9xUB363fb6EBgcmPaFHMfVTC4P7E6GNqs6ceXrupZTqDOwZ5w0EauQomR46HM 5rqDwqtBnrdw1SE2qxVDK1mm+OWKdkQ1WjNbCSjz/WAB0+SaPOzqoifw1Bb94Uh4yiqrcBRSdJI RO62K6NnzZWha9O/FajMSNJI9C6Cnd0mi9KVGdEyLP6R38uSr8pgbEscJ4OHHr9FJo47GSOeuBk 6fpRtlw== 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.4.3 (postfix.smtp2.imsva2); Mon, 11 Mar 2019 21:24:16 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 158.227.0.66 Subject: [Qemu-devel] [PATCH v5 9/9] qemu-binfmt-conf.sh: add --test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Unai Martinez-Corral --- scripts/qemu-binfmt-conf.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 382bdaabfe..b750f60ef5 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -197,8 +197,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 @@ -208,6 +207,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 DEBIANDIR define where to write configuration files SYSTEMDDIR -s|--systemd don't write into /proc, generate file(s) for @@ -221,6 +222,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 : @@ -319,9 +321,6 @@ qemu_set_binfmts() { # reduce the list of target interpreters to those given in the CLI [ $# -eq 0 ] && targets="${QEMU_TARGETS:-}" || targets="$@" - if [ "x$targets" = "xNONE" ] ; then - return - fi qemu_check_target_list $targets # register the interpreter for each target except for the native one @@ -379,12 +378,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" ;; @@ -438,4 +441,8 @@ if [ "x$QEMU_CLEAR" = "xyes" ] ; then exit fi +if [ "x$QEMU_TEST" = "xyes" ] ; then + BINFMT_SET=: +fi + qemu_set_binfmts "$@"