From patchwork Mon Mar 11 10:22:59 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: 1054334 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 44HvXy662kz9s47 for ; Mon, 11 Mar 2019 21:31:46 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IDg-00007q-81 for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:31:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3I9w-0005rF-BW for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:27:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3I5H-0005X3-6Q for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:23:03 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:31206 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 1h3I5G-0005Wd-Qs for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:23:03 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 7DF503FA1B; Mon, 11 Mar 2019 11:23:01 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 366B2110054; Mon, 11 Mar 2019 11:23:01 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 29A15110050; Mon, 11 Mar 2019 11:23:01 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:23:01 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id DBDDD3FA61; Mon, 11 Mar 2019 11:23:00 +0100 (CET) Date: Mon, 11 Mar 2019 10:22:59 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311102224.GA14@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:23:01 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 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-24482.007 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.smtp1.imsva1); Mon, 11 Mar 2019 11:23:01 +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 v4 1/10] 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 10:25:43 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: 1054336 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 44HvdC5kWhz9s6w for ; Mon, 11 Mar 2019 21:35:27 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IHF-0002vC-0A for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:35:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3I9a-0005rG-PK for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:27:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3I7y-00078q-DI for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:25:51 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:40481 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 1h3I7y-00076M-1U for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:25:50 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 88EA83FA93; Mon, 11 Mar 2019 11:25:47 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4BDA411004A; Mon, 11 Mar 2019 11:25:47 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3CA58110045; Mon, 11 Mar 2019 11:25:47 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:25:47 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id EAB453FA93; Mon, 11 Mar 2019 11:25:46 +0100 (CET) Date: Mon, 11 Mar 2019 10:25:43 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311102543.GA16@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:25:47 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 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-24482.007 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.smtp1.imsva1); Mon, 11 Mar 2019 11:25:47 +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 v4 2/10] 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: 1054330 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 44HvTF38fjz9s00 for ; Mon, 11 Mar 2019 21:28:33 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IAZ-0005z8-BH for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:28:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3I9U-0005rF-KU for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:27:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3I97-00085c-3G for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:27:01 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:59273 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 1h3I96-00084v-OM for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:27:01 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 92B7F3FAC6; Mon, 11 Mar 2019 11:26:58 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B7BB110052; Mon, 11 Mar 2019 11:26:58 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F5E5110050; Mon, 11 Mar 2019 11:26:58 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:26:58 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id 0EF613FAC6; Mon, 11 Mar 2019 11:26:58 +0100 (CET) Date: Mon, 11 Mar 2019 10:26:59 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311102659.GB16@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:26:58 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 X-TM-AS-Result: No--0.060-7.0-31-10 X-imss-scan-details: No--0.060-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24482.007 X-TMASE-Result: 10--0.059800-10.000000 X-TMASE-MatchedRID: GnNqJBi8oAc8mRT0SYY6fo6MisxJraxHecvjbu/xDjowEhHW5KVAzw/x 9pUv0o6LF8NKa4AxCmABe2S13w4YFs2Ew69EJjc0QpxiLlDD9FUIjen4m7yaqsWkDW4kV3WaZZZ 3VUEj3odNWTyNFwAkqdK1oiVNECWQK0GqbXFQeoWeAiCmPx4NwMidYBYDjITpGbCHby04y9gAGD UCklbGIlgXepbcl7r7csg6rcZR6lLRRGaiS/NwoT+llDELVgC7LCtacb4d5JSZEULfrsEHixtU8 vNHTv3eLjcHoXODJAVLZibw1Yw/eu8rgcf2XkSrLWMT4l2Yv4L6S1goyPJfkO7ndySSzunRAoRc Cc2ivEW7YFLPLPA5S37cGd19dSFd 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.smtp1.imsva1); Mon, 11 Mar 2019 11:26:58 +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 v4 3/10] 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..e7a714e22c 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_CREDENTIAL="${QEMU_CREDENTIAL:-no}" +QEMU_PERSISTENT="${QEMU_PERSISTENT:-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 10:27:33 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: 1054335 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 44HvYG0k8xz9s4Y for ; Mon, 11 Mar 2019 21:32:02 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IDv-0000Mu-V9 for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:32:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3I9v-0006Bs-4I for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:27:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3I9u-0008UG-4r for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:27:51 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:44920 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 1h3I9t-0008Kt-Nu for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:27:50 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 427143FACD; Mon, 11 Mar 2019 11:27:32 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15C2D11004A; Mon, 11 Mar 2019 11:27:32 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0994D110045; Mon, 11 Mar 2019 11:27:32 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:27:31 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id BAE8D3FAC6; Mon, 11 Mar 2019 11:27:31 +0100 (CET) Date: Mon, 11 Mar 2019 10:27:33 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311102733.GC16@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:27:31 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 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-24482.007 X-TMASE-Result: 10--1.497400-10.000000 X-TMASE-MatchedRID: mafpUJSAc1A8mRT0SYY6fgPZZctd3P4B+Gz435tISEGUdmT0Eka3cn4z 9jl2IgzvgML9UOgCBPexXMuu/NKBHrDyQVN2cGlR4bl1FkKDELfUqhJbkmLVezUsHjosUACSnFq TWUo/GE0z6xRyeDQUk9rR3zP0abjQZgDJ5bVJkeT/VoEOchXiKVObpRiWjuVrVI7KaIl9Nhfy+k xyAtKJyeLzNWBegCW2U/185JqDvmbaqT6lqWS9QsRB0bsfrpPInxMyeYT53RnurJlshkwY2Oec4 ommC4w5UOSJgt23slu2+8pP/4Jsj1t/3HU4Zd7MY5GWUV0mgWVM/AJeIqldVC5YLypVFTshJEuJ vvr/nM3pn6fQaYYfBmEZXwGzbQsWLOeM/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.smtp1.imsva1); Mon, 11 Mar 2019 11:27:32 +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 v4 4/10] 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 | 58 +++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 31 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index e7a714e22c..489d7d2326 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -167,47 +167,43 @@ qemu_get_family() { usage() { cat < X-Patchwork-Id: 1054338 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 44Hvf63cvlz9s00 for ; Mon, 11 Mar 2019 21:36:14 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IHe-0003Gh-Et for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:35:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IAl-0006pq-4R for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:28:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3IAk-0000cI-Aj for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:28:43 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:33712 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 1h3IAj-0000bj-Sk for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:28:42 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 4B38E2720C; Mon, 11 Mar 2019 11:28:40 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFC30110052; Mon, 11 Mar 2019 11:28:39 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED4DB110045; Mon, 11 Mar 2019 11:28:39 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:28:39 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id A67942720C; Mon, 11 Mar 2019 11:28:39 +0100 (CET) Date: Mon, 11 Mar 2019 10:28:41 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311102841.GD16@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:28:39 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 X-TM-AS-Result: No-0.596-7.0-31-10 X-imss-scan-details: No-0.596-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24482.007 X-TMASE-Result: 10-0.596500-10.000000 X-TMASE-MatchedRID: a3o/0593/lo8mRT0SYY6fvYiLRVJ915D+nvSwfDbaCX0HEAj+4yaX0/O fkh/+AL4Xr7NXg/pSgQkzmvdgzo8hjhhzU44NexTYl83W3jnFDATbU1KYGoQp/gnJH5vm2+gKjl bbAp2U/fArQXEdIyvR7Fcy6780oEesPJBU3ZwaVHhuXUWQoMQt30tCKdnhB58dQgf7bli9LzT6J DACkKf2wP5zT0d393cro1URZJFbJvDPz6XY5EXgJ5SZihXfx+3KcDwXXFn4NwZc3XxgYc/fJJEx mmuvzjAYSe0v9WPCiu2TAELa2b2No+uQMNExgZsDIbLhlZ38jbMHaTeAcZOWN3WrhGUSfC8TRiD dzyAzmNLF4fxrdZ0swVK+1KNobup 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.smtp1.imsva1); Mon, 11 Mar 2019 11:28:40 +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 v4 5/10] 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 489d7d2326..0918f7fba6 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: 1054361 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 44Hw3j3qSTz9s00 for ; Mon, 11 Mar 2019 21:54:56 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3Ia4-0002Xp-Fv for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:54:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IBo-0007t1-9e for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:29:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3IBj-00012v-Ic for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:29:48 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:42193 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 1h3IBj-00012N-3m for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:29:43 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 5B0D93F8D0; Mon, 11 Mar 2019 11:29:41 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 249B211004A; Mon, 11 Mar 2019 11:29:41 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 187DD110045; Mon, 11 Mar 2019 11:29:41 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:29:41 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id CAB313F8D0; Mon, 11 Mar 2019 11:29:40 +0100 (CET) Date: Mon, 11 Mar 2019 10:29:42 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311102942.GE16@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:29:41 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 X-TM-AS-Result: No--0.599-7.0-31-10 X-imss-scan-details: No--0.599-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24482.007 X-TMASE-Result: 10--0.598900-10.000000 X-TMASE-MatchedRID: wjdoQEOKyrY8mRT0SYY6fo6MisxJraxHTJDl9FKHbrkOAHqXajwVGLh0 OUlkSqv98/nBmhGQ+G6/keBZOvHAsTvsSwE6Lz76ydRP56yRRA99LQinZ4QefHUIH+25YvS80+i QwApCn9sD+c09Hd/d3MZW5ai5WKlyDl0VN9oaBDlKnZA/IKbI90w2Xy7qeFgB2FfuaVY12UVEuY H2lOWVlPkiL0dxx+ssCpgDvhqwl9JWAYkIdEDEp8+URU5VEeHpzB2k3gHGTljd1q4RlEnwvE0Yg 3c8gM5jSxeH8a3WdLPfsnwfcTQdxA== 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.smtp1.imsva1); Mon, 11 Mar 2019 11:29:41 +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 v4 6/10] 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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 0918f7fba6..13e619794c 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 -d|--debian: don't write into /proc, generate update-binfmts templates -s|--systemd CPU: don't write into /proc, generate file for systemd-binfmt.service for the given CPU; if CPU is "ALL", @@ -318,13 +318,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_CREDENTIAL="${QEMU_CREDENTIAL:-no}" QEMU_PERSISTENT="${QEMU_PERSISTENT:-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 10:30:29 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: 1054355 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 44HvzC6FMlz9s4Y for ; Mon, 11 Mar 2019 21:51:03 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IWL-0007jo-Og for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:51:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3ICV-000061-3g for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:30:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3ICT-0001Sa-In for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:30:31 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:25199 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 1h3ICT-0001QF-5G for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:30:29 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 2724A3F9E4; Mon, 11 Mar 2019 11:30:28 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3B7D110053; Mon, 11 Mar 2019 11:30:27 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1DC9110052; Mon, 11 Mar 2019 11:30:27 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:30:27 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id 9C0003F955; Mon, 11 Mar 2019 11:30:27 +0100 (CET) Date: Mon, 11 Mar 2019 10:30:29 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311103029.GF16@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:30:27 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 X-TM-AS-Result: No--2.043-7.0-31-10 X-imss-scan-details: No--2.043-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24482.007 X-TMASE-Result: 10--2.042900-10.000000 X-TMASE-MatchedRID: 4y9/ylYYqyY8mRT0SYY6fvYiLRVJ915DveCbyZ3xax5HZg0gWH5yUQfo RwTLQ8VIpHvdAjbW539ieltWxtWjGy3RaVbWzsRp9Jn/ZrGuc8EaJoVUL0MaNzdlsYL2g/87n9u 6ZDHvy7cknFdUfZfRaaXPYx1TI3qZTs+YhD8Ns1FN3UUbIf4eslAI6wCVrE3vDgB6l2o8FRhCcg 190NG0Ljalfx8z8PtAYXgS1C6OPWxvH7GZAcw0g+G5dRZCgxC31KoSW5Ji1Xs1LB46LFAAkgam/ 9j16xv9P+TN275v+89/JgN7Aw6tAObxq0gs7dfTFezSmIXNZTn6C0ePs7A07QkL5VmLaBAR4rbn YvSx/QbdwHkrHpFenZ+EBM+RyoQK1AdGu2SqQpgSQ3Bwr7YSsqQ18RnnV6NJSLiCLHBuCM6UNTR WRrobw/1GdNhzqrZ+U6vjcrlULviG4Vm5mi7aTZJveFYVlGPb5X9ayHVcJYs= 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.smtp1.imsva1); Mon, 11 Mar 2019 11:30:28 +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 v4 7/10] qemu-binfmt-conf.sh: generalize CPU 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, 45 insertions(+), 35 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 13e619794c..fde78517ff 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -6,6 +6,27 @@ 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 + 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 [ "$unknown_target" = "true" ] ; 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,21 +188,25 @@ qemu_get_family() { usage() { cat <&2 - usage - exit 1 - fi - fi ;; -Q|--path) shift @@ -384,5 +392,7 @@ while true ; do shift done +shift + $CHECK -qemu_set_binfmts +qemu_set_binfmts "$@" From patchwork Mon Mar 11 10:31:06 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: 1054360 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 44Hw2Z0NFgz9s4Y for ; Mon, 11 Mar 2019 21:53:58 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IZA-0001lr-2c for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:53:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3ID6-0000V0-UI for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:31:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3ID5-0001ox-Pm for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:31:08 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:4199 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 1h3ID5-0001ng-Dr for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:31:07 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 087B43F9EF; Mon, 11 Mar 2019 11:31:06 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C0D6711004A; Mon, 11 Mar 2019 11:31:05 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B23AF110045; Mon, 11 Mar 2019 11:31:05 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:31:05 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id 17D6F3F371; Mon, 11 Mar 2019 11:31:05 +0100 (CET) Date: Mon, 11 Mar 2019 10:31:06 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311103106.GG16@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:31:05 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 X-TM-AS-Result: No--3.745-7.0-31-10 X-imss-scan-details: No--3.745-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24482.007 X-TMASE-Result: 10--3.744600-10.000000 X-TMASE-MatchedRID: 5U6uFEJz7+o8mRT0SYY6fguB7zdAMUjAbYZQU1whlX9UjspoiX02F0R7 kF2MEpMASIkcopeTUu6Of30LOspw9AjZsijeXMGW2MZGQuKc8UhaNaxZBRbNWiAWlErg1VlPShc oFt7Iuk8Zw5ucm3NLWkZb9TVWKMA5HKicLVBy7TlbF+jvJlkOpkyQ5fRSh265DgB6l2o8FRhCcg 190NG0LjElClGessEfhZoMPmZo0JQCA8tJOje6Zx+WEMjoO9WWu56wFPSkMVFrMbakJN8OeXA+T B/xXV3gy/xu2cEdn2J+XHMTeEdcYW7vEKjEI8LyHcQQBuf4ZFt9LQinZ4QefHUIH+25YvS80+iQ wApCn9sD+c09Hd/d3MZW5ai5WKlyTLmRaGarDUvAFXoAkXr3Uks/0VIgvWdMwiZha5jCqzUSTUc fU1S1Q7JO/KintjrdNbQAedbmAsA24yhjDGqlNYVEIkZQYOeQzB2k3gHGTljd1q4RlEnwvE0Yg3 c8gM5jSxeH8a3WdLPfsnwfcTQdxA== 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.smtp1.imsva1); Mon, 11 Mar 2019 11:31:06 +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 v4 8/10] 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: alex.bennee@linaro.org, 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 | 41 ++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index fde78517ff..07d1ee1f04 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -196,7 +196,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,9 +206,10 @@ TARGETS QEMU_TARGETS A single arch name or a list of them (see systemd-binfmt.service; environment variable HOST_ARCH allows to override 'uname' to generate configuration files for a different architecture than the current one. - -e|--exportdir PATH: DEBIANDIR define where to write configuration files SYSTEMDDIR +-c|--clear: QEMU_CLEAR (yes) remove registered interpreters for target TARGETS; + then exit. -c|--credential: QEMU_CREDENTIAL (yes) credential and security tokens are calculated according to the binary to interpret -p|--persistent: QEMU_PERSISTENT (yes) load the interpreter and keep it in memory; all future @@ -336,6 +337,25 @@ 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 @@ -347,12 +367,16 @@ QEMU_PATH="${QEMU_PATH:-/usr/local/bin}" QEMU_SUFFIX="${QEMU_SUFFIX:-}" QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" QEMU_PERSISTENT="${QEMU_PERSISTENT:-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 cdsQ:S:e:hcp -l clear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") eval set -- "$options" while true ; do case "$1" in + -c|--clear) + QEMU_CLEAR="yes" + ;; -d|--debian) CHECK=qemu_check_debian BINFMT_SET=qemu_generate_debian @@ -395,4 +419,15 @@ done shift $CHECK + +if [ "x$QEMU_CLEAR" = "xyes" ] ; then + case "$BINFMT_SET" in + *debian) BINFMT_CLEAR=qemu_clear_notimplemented ;; + *systemd) BINFMT_CLEAR=qemu_clear_notimplemented ;; + *) BINFMT_CLEAR=qemu_clear_interpreter + esac + $BINFMT_CLEAR "$@" + exit +fi + qemu_set_binfmts "$@" From patchwork Mon Mar 11 10:31:40 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: 1054362 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 44Hw6S1RFjz9s00 for ; Mon, 11 Mar 2019 21:57:20 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IcQ-0004rh-4e for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:57:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IDh-0000sj-HN for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:31:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3IDf-00029x-J5 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:31:45 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:2981 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 1h3IDd-00025A-Jj for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:31:43 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 616833543B; Mon, 11 Mar 2019 11:31:39 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3369F11004A; Mon, 11 Mar 2019 11:31:39 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27888110045; Mon, 11 Mar 2019 11:31:39 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:31:39 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id D00023F371; Mon, 11 Mar 2019 11:31:38 +0100 (CET) Date: Mon, 11 Mar 2019 10:31:40 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311103140.GH16@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:31:39 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 X-TM-AS-Result: No--0.515-7.0-31-10 X-imss-scan-details: No--0.515-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24482.007 X-TMASE-Result: 10--0.514600-10.000000 X-TMASE-MatchedRID: AvuQOGDihJo8mRT0SYY6fvGSfx66m+aMYu7s3QSSN+QAIXlMppp3X9j3 ZmXrgmMgZTpRzmI1jSY+cd7QtHST5EEXheUXJvLH3fn7n/ZHGqZhBfGxmdHCgq2PbheqHTJcaVh esZ7vVuWWEuuopHrw3tA0BAkvqUqCW4r09uGjIu0SEYfcJF0pRbI1wQlMokYmoN1ZeaPfSbijxY yRBa/qJeko2t9ghSAshzImjrjZJG3dB/CxWTRRu+rAZ8KTspSzxuRUMxKXGY6vx96pKLncYEA6w j8PD0Fp3x/L6V87NEyHba3QFZrbgLZ3wh/cn41O9sksA03v4xJ0BOCtADI2rw5s7nHxQ/wZbHxL SfFOFqWcG7vai9PYX+Lxq29NAHjaTN08WrWBwjN+3BndfXUhXQ== 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.smtp1.imsva1); Mon, 11 Mar 2019 11:31:39 +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 v4 9/10] qemu-binfmt-conf.sh: update usage() 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: alex.bennee@linaro.org, riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reorder how the options are presented to the user. Move 'systemd' and 'debian' to the end, so that the latter is close to the additional comments and example commands about it. Add list of default values for environment variables. Signed-off-by: Unai Martinez-Corral --- scripts/qemu-binfmt-conf.sh | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 07d1ee1f04..a516181a3a 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -201,19 +201,27 @@ TARGETS QEMU_TARGETS A single arch name or a list of them (see -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 --d|--debian: don't write into /proc, generate update-binfmts templates --s|--systemd: don't write into /proc, generate file(s) for - systemd-binfmt.service; environment variable HOST_ARCH - allows to override 'uname' to generate configuration files - for a different architecture than the current one. +-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 + to the binary to interpret -e|--exportdir PATH: DEBIANDIR define where to write configuration files SYSTEMDDIR -c|--clear: QEMU_CLEAR (yes) remove registered interpreters for target TARGETS; then exit. --c|--credential: QEMU_CREDENTIAL (yes) credential and security tokens are calculated according - to the binary to interpret --p|--persistent: QEMU_PERSISTENT (yes) load the interpreter and keep it in memory; all future - uses are cloned from the open file. +-s|--systemd: don't write into /proc, generate file(s) for + systemd-binfmt.service; environment variable HOST_ARCH + allows to override 'uname' to generate configuration files + for a different architecture than the current one. +-d|--debian: don't write into /proc, generate update-binfmts templates + +Defaults: +QEMU_TARGETS=$QEMU_TARGETS +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 : @@ -365,8 +373,8 @@ DEBIANDIR="/usr/share/binfmts" QEMU_TARGETS="${QEMU_TARGETS:-}" QEMU_PATH="${QEMU_PATH:-/usr/local/bin}" QEMU_SUFFIX="${QEMU_SUFFIX:-}" -QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}" +QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" QEMU_CLEAR="${QEMU_CLEAR:-no}" options=$(getopt -o cdsQ:S:e:hcp -l clear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") From patchwork Mon Mar 11 10:32:07 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: 1054350 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 44HvvN18tHz9s47 for ; Mon, 11 Mar 2019 21:47:44 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59388 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IT8-0004sE-4A for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2019 06:47:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IE4-0001EG-UK for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:32:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3IE3-0002Uq-WE for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:32:08 -0400 Received: from smtp.lg.ehu.es ([158.227.0.66]:39728 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 1h3IE3-0002U6-Jx for qemu-devel@nongnu.org; Mon, 11 Mar 2019 06:32:07 -0400 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id A92AB3543B; Mon, 11 Mar 2019 11:32:06 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 72BF711004A; Mon, 11 Mar 2019 11:32:06 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6680E110045; Mon, 11 Mar 2019 11:32:06 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Mon, 11 Mar 2019 11:32:06 +0100 (CET) Received: from 765644dd90e5 (unknown [139.47.78.33]) by smtp1 (Postfix) with ESMTPSA id 23CF83543B; Mon, 11 Mar 2019 11:32:06 +0100 (CET) Date: Mon, 11 Mar 2019 10:32:07 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Message-ID: <20190311103207.GI16@765644dd90e5> References: <20190311101428.GA11@765644dd90e5> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190311101428.GA11@765644dd90e5> User-Agent: Mutt/1.11.2 (2019-01-07) X-Greylist: ACL 177 matched, not delayed by milter-greylist-4.4.3 (smtp1); Mon, 11 Mar 2019 11:32:06 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.2.0.1013-24482.007 X-TM-AS-Result: No--3.777-7.0-31-10 X-imss-scan-details: No--3.777-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.2.1013-24482.007 X-TMASE-Result: 10--3.776600-10.000000 X-TMASE-MatchedRID: mZljRXDwq+48mRT0SYY6fguB7zdAMUjATJDl9FKHbrkOAHqXajwVGEJy DX3Q0bQuRZ3bsJ5dhK9sy3DPX9Umyv2E4cGVTliSEe5D10MltLYxmbT6wQT2a0GXVUrSf9og0Bh ZSjgdIiQl96awcRp/H9Y8C3fBtGbSsPJBU3ZwaVEXKqR+w9a7UCtovaaHxlUrnQqircTOm4dZhL w6sxHoN/uBAQFQ9xUB363fb6EBgck3w8RYxvfC2J4CIKY/Hg3AyJ1gFgOMhOkZsIdvLTjL2AAYN QKSVsYiJ0RPnyOnrZJO1lExTtIe4mrToSQbfcN0eJYx8nRhkgu4KwrMqw1KloGZ8SOkEIrDY2Tj sCvm+QfI6gZwDVY5w4PdoJ+Ed4XtagK3F3j+A3MtYxPiXZi/gvpLWCjI8l+Q7ud3JJLO6dEChFw JzaK8RcV/c5PoaFg8 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.smtp1.imsva1); Mon, 11 Mar 2019 11:32:06 +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 v4 10/10] qemu-binfmt-conf.sh: add --test|--dry-run 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 | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) -- 2.21.0 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index a516181a3a..db85798e76 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -196,8 +196,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 @@ -209,6 +208,8 @@ TARGETS QEMU_TARGETS A single arch name or a list of them (see SYSTEMDDIR -c|--clear: QEMU_CLEAR (yes) remove registered interpreters for target TARGETS; then exit. +-t|--test|--dry-run: QEMU_TEST (yes) test the setup with the provided arguments, but do not + configure any of the interpreters. -s|--systemd: don't write into /proc, generate file(s) for systemd-binfmt.service; environment variable HOST_ARCH allows to override 'uname' to generate configuration files @@ -222,6 +223,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 : @@ -317,9 +319,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 @@ -376,12 +375,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 cdsQ:S:e:hcp -l clear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") +options=$(getopt -o tcdsQ:S:e:hcp -l test,dry-runclear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") eval set -- "$options" while true ; do case "$1" in + -t|--test|--dry-run) + QEMU_TEST="yes" + ;; -c|--clear) QEMU_CLEAR="yes" ;; @@ -438,4 +441,10 @@ if [ "x$QEMU_CLEAR" = "xyes" ] ; then exit fi +if [ "x$QEMU_TEST" = "xyes" ] ; then + skip(){ + :;} + BINFMT_SET=skip +fi + qemu_set_binfmts "$@"