From patchwork Sat Mar 7 18:38:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1250936 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZYCq0ZD2z9sRR for ; Sun, 8 Mar 2020 05:38:41 +1100 (AEDT) Received: from localhost ([::1]:51674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeLH-00034W-D3 for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2020 13:38:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34101) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeL0-00034B-8L for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:38:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAeKx-0006ER-N3 for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:38:12 -0500 Received: from smtp.lg.ehu.es ([158.227.0.66]:13235 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 1jAeKx-0006DS-BN for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:38:11 -0500 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 75A322D904; Sat, 7 Mar 2020 19:38:09 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 32782110050; Sat, 7 Mar 2020 19:38:09 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2589A11004D; Sat, 7 Mar 2020 19:38:09 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Sat, 7 Mar 2020 19:38:09 +0100 (CET) Received: from afee69d503a7 (unknown [81.0.0.187]) by smtp1 (Postfix) with ESMTPSA id D1BD736F95; Sat, 7 Mar 2020 19:38:08 +0100 (CET) Date: Sat, 7 Mar 2020 18:38:03 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v8 1/9] qemu-binfmt-conf.sh: enforce safe style consistency Message-ID: <20200307183803.GA29@afee69d503a7> References: <20200307170251.GA7@dd5f6ec33fb0> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200307170251.GA7@dd5f6ec33fb0> X-Greylist: ACL 184 matched, not delayed by milter-greylist-4.6.2 (smtp1 [10.0.100.73]); Sat, 07 Mar 2020 19:38:09 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25276.002 X-TM-AS-Result: No-0.108-7.0-31-10 X-imss-scan-details: No-0.108-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25276.002 X-TMASE-Result: 10-0.108400-10.000000 X-TMASE-MatchedRID: AvuQOGDihJo8mRT0SYY6frBZAi3nrnzbopGQY5bbP3KQsRqSXMRkV//v RwcN6CxcWk3vlkEkcgdqAxBaFFZ85HTKrg3nLjv1A9lly13c/gEEa8g1x8eqFzL/GHoao0dVgm7 WCykPm9Q9E3MQ72s42pG96/hbJzFNSulibHZJx6EvLP1C8DIeOuuLFZZYlisfQ6tklRJO9ij9bM g3kSk56LG0WsdjH6wrKrauXd3MZDX371moSn0VOMz/CtjUqsbyxz9rP9TWxuBvW+kI3v1nLJi+R f9itKUQlDqYxZzV3eDCaeyUt/P3/ctZSdlP7Xii9SPW45P4yzatXkfeF49j3hKGdgr8x4f4BBSv +oarUQsKtuXWKSlXVpNHmClQkxEB+rL5VW+ofZc= X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp1.imsva1 [10.0.100.73]); Sat, 07 Mar 2020 19:38:09 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+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(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 9f1580a91c..672ce716b6 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -223,12 +223,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 @@ -259,10 +259,10 @@ qemu_check_systemd() { qemu_generate_register() { flags="" - if [ "$CREDENTIAL" = "yes" ] ; then + if [ "x$CREDENTIAL" = "xyes" ] ; then flags="OC" fi - if [ "$PERSISTENT" = "yes" ] ; then + if [ "x$PERSISTENT" = "xyes" ] ; then flags="${flags}F" fi @@ -300,18 +300,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 Sat Mar 7 18:42:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1250937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZYJt2r3kz9sNg for ; Sun, 8 Mar 2020 05:43:10 +1100 (AEDT) Received: from localhost ([::1]:51702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAePk-0004pq-3W for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2020 13:43:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34656) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAePM-0004pi-GH for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:42:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAePK-0004yn-Td for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:42:43 -0500 Received: from smtp.lg.ehu.es ([158.227.0.66]:31342 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 1jAePK-0004wA-J7 for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:42:42 -0500 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 7DD012D904; Sat, 7 Mar 2020 19:42:40 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4492611004A; Sat, 7 Mar 2020 19:42:40 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 387EF110045; Sat, 7 Mar 2020 19:42:40 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Sat, 7 Mar 2020 19:42:40 +0100 (CET) Received: from afee69d503a7 (unknown [81.0.0.187]) by smtp1 (Postfix) with ESMTPSA id E86F62D904; Sat, 7 Mar 2020 19:42:39 +0100 (CET) Date: Sat, 7 Mar 2020 18:42:34 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v8 2/9] qemu-binfmt-conf.sh: make opts -p and -c boolean Message-ID: <20200307184234.GA37@afee69d503a7> References: <20200307170251.GA7@dd5f6ec33fb0> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200307170251.GA7@dd5f6ec33fb0> X-Greylist: ACL 184 matched, not delayed by milter-greylist-4.6.2 (smtp1 [10.0.100.73]); Sat, 07 Mar 2020 19:42:40 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25276.002 X-TM-AS-Result: No--0.283-7.0-31-10 X-imss-scan-details: No--0.283-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25276.002 X-TMASE-Result: 10--0.282600-10.000000 X-TMASE-MatchedRID: U43YD7H1Lvw8mRT0SYY6fn4neC0h7SADM0wEwxpnA/68YDH/UBNnm9IS YzBUt2RaPNUcTj3KnwYYtU40WMXvIYG80L1SbJgHPwKTD1v8YV5MkOX0UoduuUp12IXZajx5isV L6tesfykTxXC00El2lhakbZdr8IRbe4rShPdcdTacVWc2a+/ju3MewI65KqfWA1njkhEhkqD1Ze b7KEkrKJ++W6npokaOY8uDPjNciyEZhPwmib0kjeLzNWBegCW2U/185JqDvmbaqT6lqWS9QsRB0 bsfrpPI34T9cYMsdwwOJox114k7L4utkPfYpmAOoHq+Hs/zrWEhua9uUgMKZ1axhI27yKUYa37u +lQw2jslgZqICCEoWYmUFS1V970DoMDl4vNmLhBQ8Ijyfb7R1NaR6eevSLMI3+Sfk+YbswR/XNh OvrwWA7UAzM040TIQ X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp1.imsva1 [10.0.100.73]); Sat, 07 Mar 2020 19:42:40 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+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 redundant. Overall, accepting an argument might be misleading because options are, indeed, boolean. This patch makes both options boolean in getopt, so if any of them is provided the corresponding variable is set to true. Signed-off-by: Unai Martinez-Corral Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 672ce716b6..75eb19c3bf 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -172,8 +172,8 @@ qemu_get_family() { usage() { cat < X-Patchwork-Id: 1250938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZYNV4TLxz9sNg for ; Sun, 8 Mar 2020 05:46:18 +1100 (AEDT) Received: from localhost ([::1]:51748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeSl-0006B7-Bj for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2020 13:46:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35102) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeSN-0006Ao-Iu for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:45:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAeSM-0001ME-2F for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:45:51 -0500 Received: from smtp.lg.ehu.es ([158.227.0.66]:29240 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 1jAeSL-0001Ij-NZ for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:45:50 -0500 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 864CB2D904; Sat, 7 Mar 2020 19:45:47 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 43DEE11004A; Sat, 7 Mar 2020 19:45:47 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3802F110045; Sat, 7 Mar 2020 19:45:47 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Sat, 7 Mar 2020 19:45:47 +0100 (CET) Received: from afee69d503a7 (unknown [81.0.0.187]) by smtp1 (Postfix) with ESMTPSA id E5BDB2D904; Sat, 7 Mar 2020 19:45:46 +0100 (CET) Date: Sat, 7 Mar 2020 18:45:45 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v8 3/9] qemu-binfmt-conf.sh: add QEMU_CREDENTIAL and QEMU_PERSISTENT Message-ID: <20200307184545.GB37@afee69d503a7> References: <20200307170251.GA7@dd5f6ec33fb0> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200307170251.GA7@dd5f6ec33fb0> X-Greylist: ACL 184 matched, not delayed by milter-greylist-4.6.2 (smtp1 [10.0.100.73]); Sat, 07 Mar 2020 19:45:47 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25276.002 X-TM-AS-Result: No-1.919-7.0-31-10 X-imss-scan-details: No-1.919-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25276.002 X-TMASE-Result: 10-1.919100-10.000000 X-TMASE-MatchedRID: ehvrJQ9m4PA8mRT0SYY6fo6MisxJraxH9e5am3m57X1irg8tJChsdOp9 RpeIFYR4f+3yqvQrlggtpxclXgLOJWJZXQNDzktSKrDHzH6zmUVzHsCOuSqn1gNZ45IRIZKg9WX m+yhJKyifvlup6aJGjuGJ0uaQ7XfxDvX2Sk47fs+VyEX4i+SWU+wlOGZoQVV0DpCUEeEFm7A8HP DFMN8fIiE3155ICPJPmyiLZetSf8mfYwIIcLjjbeGANVBCTxXNC24oEZ6SpSk6XEE7Yhw4FjYhL YVN7agli63pxu/S4xQSFXeoRq3xmaeqmMHxXeINQHHENQU9/NzPbq/ALUNTOmZgCXkOZpTlzpuq aZzc8oIUzt6CYykYPCtxJPipEDOM5s49x043aLlHPwBafde3Eazr0/cAC14wuP7sWlKY/sdnIxZ yJs78kg== X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp1.imsva1 [10.0.100.73]); Sat, 07 Mar 2020 19:45:47 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+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(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 75eb19c3bf..347cddf698 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -190,9 +190,11 @@ Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU] (default: $SYSTEMDDIR or $DEBIANDIR) --credential: if present, credential and security tokens are calculated according to the binary to interpret + (QEMU_CREDENTIAL=yes) --persistent: if present, the interpreter is loaded when binfmt is configured and remains in memory. All future uses are cloned from the open file. + (QEMU_PERSISTENT=yes) To import templates with update-binfmts, use : @@ -259,10 +261,10 @@ qemu_check_systemd() { qemu_generate_register() { flags="" - if [ "x$CREDENTIAL" = "xyes" ] ; then + if [ "x$QEMU_CREDENTIAL" = "xyes" ] ; then flags="OC" fi - if [ "x$PERSISTENT" = "xyes" ] ; then + if [ "x$QEMU_PERSISTENT" = "xyes" ] ; then flags="${flags}F" fi @@ -285,7 +287,7 @@ package qemu-$cpu interpreter $qemu magic $magic mask $mask -credential $CREDENTIAL +credential $QEMU_CREDENTIAL EOF } @@ -324,8 +326,10 @@ SYSTEMDDIR="/etc/binfmt.d" DEBIANDIR="/usr/share/binfmts" QEMU_PATH=/usr/local/bin -CREDENTIAL=no -PERSISTENT=no + +QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}" +QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" + QEMU_SUFFIX="" options=$(getopt -o ds:Q:S:e:hcp -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential,persistent -- "$@") @@ -377,10 +381,10 @@ while true ; do exit 1 ;; -c|--credential) - CREDENTIAL="yes" + QEMU_CREDENTIAL="yes" ;; -p|--persistent) - PERSISTENT="yes" + QEMU_PERSISTENT="yes" ;; *) break From patchwork Sat Mar 7 18:51:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1250939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZYVv2sjmz9sNg for ; Sun, 8 Mar 2020 05:51:49 +1100 (AEDT) Received: from localhost ([::1]:51802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeY5-0000z5-8w for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2020 13:51:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35866) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeXn-0000xg-UB for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:51:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAeXk-0000yY-Un for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:51:26 -0500 Received: from smtp.lg.ehu.es ([158.227.0.66]:53920 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 1jAeXk-0000vP-Jj for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:51:24 -0500 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 5B73C35A74; Sat, 7 Mar 2020 19:51:22 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 241F911004A; Sat, 7 Mar 2020 19:51:22 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1825C110045; Sat, 7 Mar 2020 19:51:22 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Sat, 7 Mar 2020 19:51:22 +0100 (CET) Received: from afee69d503a7 (unknown [81.0.0.187]) by smtp1 (Postfix) with ESMTPSA id B9C8635A74; Sat, 7 Mar 2020 19:51:21 +0100 (CET) Date: Sat, 7 Mar 2020 18:51:12 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v8 4/9] qemu-binfmt-conf.sh: use the same presentation format as for qemu-* Message-ID: <20200307185102.GA45@afee69d503a7> References: <20200307170251.GA7@dd5f6ec33fb0> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200307170251.GA7@dd5f6ec33fb0> X-Greylist: ACL 184 matched, not delayed by milter-greylist-4.6.2 (smtp1 [10.0.100.73]); Sat, 07 Mar 2020 19:51:22 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25276.002 X-TM-AS-Result: No--0.153-7.0-31-10 X-imss-scan-details: No--0.153-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25276.002 X-TMASE-Result: 10--0.153400-10.000000 X-TMASE-MatchedRID: mZljRXDwq+48mRT0SYY6fi2416nc3bQlcZ9gNqdc/asHZBaLwEXlKICu qghmtWfX+r4YfSxMB0mGCVFYpEZ7FAkGWAZ8v6JzKrDHzH6zmUWnZS/aYgjrzgv1OPvvDLzsOnR FDX9soFzPtGnU3UildrOtkFKj8cABpkvVukmlwd0TF1LtYW9la0yEf8qljHK7XZgp9Jjp/MxwVH Awn53NJxZ2QD7FoT3F+KEI6rMuUUejxYyRBa/qJeko2t9ghSAshzImjrjZJG3dB/CxWTRRuzBqY ATSOgWjXp68uB9g9w5Ak2OXbmWy8vRKUOTQ6F24JTDiHyftODLmtAxcgxB46nazG8o2/SGPePyn A/gwmid2V2KfpNeookiaomPdRb00G4nK6yQeDgDMzYUE7uLiElFhbmF/OERbQIuZkMO8x92xAqs tPEP3B37cGd19dSFd X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp1.imsva1 [10.0.100.73]); Sat, 07 Mar 2020 19:51:22 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Unai Martinez-Corral Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 63 +++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 347cddf698..251a78a2ce 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -171,47 +171,48 @@ qemu_get_family() { usage() { cat < X-Patchwork-Id: 1250940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZYXn6NSFz9sNg for ; Sun, 8 Mar 2020 05:53:29 +1100 (AEDT) Received: from localhost ([::1]:51812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeZj-0001r1-Ry for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2020 13:53:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36010) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeZS-0001qu-Tx for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:53:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAeZR-00031y-Rk for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:53:10 -0500 Received: from smtp.lg.ehu.es ([158.227.0.66]:11870 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 1jAeZR-000312-HF for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:53:09 -0500 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 2AB9835A74; Sat, 7 Mar 2020 19:53:08 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE819110050; Sat, 7 Mar 2020 19:53:07 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D26C111004D; Sat, 7 Mar 2020 19:53:07 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Sat, 7 Mar 2020 19:53:07 +0100 (CET) Received: from afee69d503a7 (unknown [81.0.0.187]) by smtp1 (Postfix) with ESMTPSA id 8E18535A74; Sat, 7 Mar 2020 19:53:07 +0100 (CET) Date: Sat, 7 Mar 2020 18:53:06 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v8 5/9] qemu-binfmt-conf.sh: remove 'qemu' prefix from cli options Message-ID: <20200307185306.GB45@afee69d503a7> References: <20200307170251.GA7@dd5f6ec33fb0> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200307170251.GA7@dd5f6ec33fb0> X-Greylist: ACL 184 matched, not delayed by milter-greylist-4.6.2 (smtp1 [10.0.100.73]); Sat, 07 Mar 2020 19:53:07 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25276.002 X-TM-AS-Result: No-0.609-7.0-31-10 X-imss-scan-details: No-0.609-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25276.002 X-TMASE-Result: 10-0.609300-10.000000 X-TMASE-MatchedRID: mafpUJSAc1A8mRT0SYY6fqS9pC14MC3CUHV7v8X++rndQ2cXpbDqBU/O fkh/+AL4f9zrAY3MatNqAxBaFFZ85HTKrg3nLjv1If0TE1VduNsmOLJFRlRlklezEE205dNv5sc /I6vXY93xhWafZnqM5YhJUX5c5pgUkJIJE4kX5BSK2+RZ4/fWSVJtXEGMtLPHlwV2iaAfSWf+xO hjarOnHl67qWU6gzsGecNBGrkKJkf3FLeZXNZS4IzHo47z5Aa+gJvqVR3z499a6iv/OQVyBg6Nc S54sl2E0KaT92v5dkgc65uI/oOh8X18wnYDXeXioLRvhTZkSBeFkTLqA1tMMYopQVbJ8EMLCehC vRokedzR6A9/75PVP9h1s6Q8V93dpazx64v3JfnDyDYcE1wXmQ== X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp1.imsva1 [10.0.100.73]); Sat, 07 Mar 2020 19:53:08 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+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(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 251a78a2ce..2a035394e0 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -171,6 +171,7 @@ qemu_get_family() { usage() { cat < X-Patchwork-Id: 1250941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZYYc1TwSz9sNg for ; Sun, 8 Mar 2020 05:54:12 +1100 (AEDT) Received: from localhost ([::1]:51822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeaP-0002cF-Sy for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2020 13:54:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36064) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAea6-0002ZP-MQ for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:53:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAea3-0003R3-7e for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:53:50 -0500 Received: from smtp.lg.ehu.es ([158.227.0.66]:53008 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 1jAea2-0003PG-SU for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:53:47 -0500 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id BA4A135A74; Sat, 7 Mar 2020 19:53:45 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9257011004A; Sat, 7 Mar 2020 19:53:45 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 869CB110045; Sat, 7 Mar 2020 19:53:45 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Sat, 7 Mar 2020 19:53:45 +0100 (CET) Received: from afee69d503a7 (unknown [81.0.0.187]) by smtp1 (Postfix) with ESMTPSA id 418FD35A74; Sat, 7 Mar 2020 19:53:45 +0100 (CET) Date: Sat, 7 Mar 2020 18:53:44 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v8 6/9] qemu-binfmt-conf.sh: honour QEMU_PATH and/or QEMU_SUFFIX Message-ID: <20200307185344.GC45@afee69d503a7> References: <20200307170251.GA7@dd5f6ec33fb0> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200307170251.GA7@dd5f6ec33fb0> X-Greylist: ACL 184 matched, not delayed by milter-greylist-4.6.2 (smtp1 [10.0.100.73]); Sat, 07 Mar 2020 19:53:45 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25276.002 X-TM-AS-Result: No-1.584-7.0-31-10 X-imss-scan-details: No-1.584-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25276.002 X-TMASE-Result: 10-1.583800-10.000000 X-TMASE-MatchedRID: GnNqJBi8oAc8mRT0SYY6fo6MisxJraxHnVQTrXdqB1rGkE1bT11zTEAc 6DyoS2rIKnoLoDc7CX1BeUNELByi+Zuzp0H1hWRJKrDHzH6zmUVMhH/KpYxyu2i2BhDPfjxnlMa 9Q0Vx5vSl0s9gTN4+NVzc1M3vHBo4o8WMkQWv6iXpKNrfYIUgLIcyJo642SRt3QfwsVk0Ubswam AE0joFo3v7tGjo/RCgb27SfOf4chGXqLgVQe62XbcuIVRx+i5Y8+54JDPVpgFglVq98kHkwPOk6 4IdZi+jGkBNuNp9w/i1B3ioICg1fxuJyuskHg4AzM2FBO7i4hJRYW5hfzhEW0CLmZDDvMfd0hli /KDwoy1+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.6.2 (postfix.smtp1.imsva1 [10.0.100.73]); Sat, 07 Mar 2020 19:53:45 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+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(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 2a035394e0..80ec164eab 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -181,7 +181,7 @@ Options and associated environment variables: Argument Env-variable Description -h|--help display this usage -Q|--path PATH QEMU_PATH set path to qemu interpreter(s) --F|--suffix SUFFIX add a suffix to the default interpreter name +-F|--suffix SUFFIX QEMU_SUFFIX add a suffix to the default interpreter name -p|--persistent QEMU_PERSISTENT (yes) load the interpreter and keep it in memory; all future uses are cloned from the open file. -c|--credential QEMU_CREDENTIAL (yes) credential and security tokens are calculated according @@ -195,6 +195,7 @@ Argument Env-variable Description Defaults: QEMU_PATH=$QEMU_PATH +QEMU_SUFFIX=$QEMU_SUFFIX QEMU_PERSISTENT=$QEMU_PERSISTENT QEMU_CREDENTIAL=$QEMU_CREDENTIAL @@ -327,13 +328,11 @@ BINFMT_SET=qemu_register_interpreter SYSTEMDDIR="/etc/binfmt.d" DEBIANDIR="/usr/share/binfmts" -QEMU_PATH=/usr/local/bin - +QEMU_PATH="${QEMU_PATH:-/usr/local/bin}" +QEMU_SUFFIX="${QEMU_SUFFIX:-}" QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}" QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" -QEMU_SUFFIX="" - options=$(getopt -o ds:Q:S:e:hcp -l debian,systemd:,path:,suffix:,exportdir:,help,credential,persistent -- "$@") eval set -- "$options" From patchwork Sat Mar 7 18:54:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1250942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZYZv4Vn8z9sNg for ; Sun, 8 Mar 2020 05:55:19 +1100 (AEDT) Received: from localhost ([::1]:51844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAebV-0003xZ-Cw for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2020 13:55:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36221) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAeb9-0003wu-W7 for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:54:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAeb8-0004iR-IJ for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:54:55 -0500 Received: from smtp.lg.ehu.es ([158.227.0.66]:20909 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 1jAeb8-0004h3-7H for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:54:54 -0500 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id E629535A74; Sat, 7 Mar 2020 19:54:52 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C60C611004A; Sat, 7 Mar 2020 19:54:52 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BA985110045; Sat, 7 Mar 2020 19:54:52 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Sat, 7 Mar 2020 19:54:52 +0100 (CET) Received: from afee69d503a7 (unknown [81.0.0.187]) by smtp1 (Postfix) with ESMTPSA id 750AF35A74; Sat, 7 Mar 2020 19:54:52 +0100 (CET) Date: Sat, 7 Mar 2020 18:54:51 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v8 7/9] qemu-binfmt-conf.sh: generalize to positional [TARGETS] Message-ID: <20200307185451.GD45@afee69d503a7> References: <20200307170251.GA7@dd5f6ec33fb0> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200307170251.GA7@dd5f6ec33fb0> X-Greylist: ACL 184 matched, not delayed by milter-greylist-4.6.2 (smtp1 [10.0.100.73]); Sat, 07 Mar 2020 19:54:52 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25276.002 X-TM-AS-Result: No--6.998-7.0-31-10 X-imss-scan-details: No--6.998-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25276.002 X-TMASE-Result: 10--6.998000-10.000000 X-TMASE-MatchedRID: nrHYWZvpVHs8mRT0SYY6fggKAWhuC2ojb6bRSg4rpzvnCThanP/ghHPB OaeKbK/+oLBWQm3Xk4ruUwVp7PnaAt6mdwOBRvHdweku330t3msk970gYOLoHXqm3WhT4L+kMrJ 18VCI8ftc9zRCuEq6hBseEDo3eR11BeNKlUefbYOSbFkwrmkQ4ktc8DbogbSEN2WxgvaD/zvwVK uSbLr8UjTz5aD5P/nAfEtOTuUcA9bRQdw4XFGJY2Fzg+No/uuNp1Pjcaldww1dmCn0mOn8zNY8Z /9YK9FIHZltZHq3316JylXyVqjzn3P1PdPbavOpbWsCUkrA4EnKIqAq0jIHigaYevV4zG3ZhOta jKU/o8zXTlm90lXFO7qojq4R9iDw/3sP+ok2e+YoSebb2328i+uLFZZYlisfQ6tklRJO9ij9bMg 3kSk56LG0WsdjH6wrKrauXd3MZDWXf5sC39gVVJFVR9JrQm2XD61E1PCtdJD/ZxLWCRuw8s++cy dLfhbO66XHIc5w+gc= X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp1.imsva1 [10.0.100.73]); Sat, 07 Mar 2020 19:54:52 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+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 Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 80 +++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 80ec164eab..d5d3484b58 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -6,6 +6,28 @@ ppc ppc64 ppc64le m68k mips mipsel mipsn32 mipsn32el mips64 mips64el \ sh4 sh4eb s390x aarch64 aarch64_be hppa riscv32 riscv64 xtensa xtensaeb \ microblaze microblazeel or1k x86_64" +# check if given TARGETS is/are in the supported target list +qemu_check_target_list() { + if [ $# -eq 0 ] ; then + checked_target_list="$qemu_target_list" + return + fi + unset checked_target_list + for target ; do + for cpu in $qemu_target_list ; do + if [ "x$cpu" = "x$target" ] ; then + checked_target_list="$checked_target_list $target" + break + fi + done + if [ "x$cpu" != "x$target" ] ; then + echo "ERROR: unknown CPU \"$target\"" 1>&2 + usage + exit 1 + fi + done +} + i386_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00' i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' i386_family=i386 @@ -171,14 +193,16 @@ qemu_get_family() { usage() { cat <&2 - usage - exit 1 - fi - fi ;; -Q|--path) shift @@ -394,5 +404,7 @@ while true ; do shift done +shift + $CHECK -qemu_set_binfmts +qemu_set_binfmts "$@" From patchwork Sat Mar 7 18:55:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1250944 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZYh00T0Lz9sNg for ; Sun, 8 Mar 2020 05:59:43 +1100 (AEDT) Received: from localhost ([::1]:51896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAefl-000714-GD for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2020 13:59:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36369) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAebr-0004ta-PS for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:55:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAebq-0005oB-9J for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:55:39 -0500 Received: from smtp.lg.ehu.es ([158.227.0.66]:52137 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 1jAebp-0005kn-Tj for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:55:38 -0500 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id BFD7536F95; Sat, 7 Mar 2020 19:55:36 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 82D3711004A; Sat, 7 Mar 2020 19:55:36 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7689A110045; Sat, 7 Mar 2020 19:55:36 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Sat, 7 Mar 2020 19:55:36 +0100 (CET) Received: from afee69d503a7 (unknown [81.0.0.187]) by smtp1 (Postfix) with ESMTPSA id 1E63636F95; Sat, 7 Mar 2020 19:55:36 +0100 (CET) Date: Sat, 7 Mar 2020 18:55:35 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v8 8/9] qemu-binfmt-conf.sh: add option --clear Message-ID: <20200307185535.GE45@afee69d503a7> References: <20200307170251.GA7@dd5f6ec33fb0> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200307170251.GA7@dd5f6ec33fb0> X-Greylist: ACL 184 matched, not delayed by milter-greylist-4.6.2 (smtp1 [10.0.100.73]); Sat, 07 Mar 2020 19:55:36 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25276.002 X-TM-AS-Result: No-1.776-7.0-31-10 X-imss-scan-details: No-1.776-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25276.002 X-TMASE-Result: 10-1.775800-10.000000 X-TMASE-MatchedRID: nrHYWZvpVHs8mRT0SYY6fguB7zdAMUjAFTFJRL+t8UtUjspoiX02FwjJ M0WLRMJtiG9EhTRb6MgfqXaEwlcZyzMn84YoJAVUuoibJpHRrFny++SyyVe4t1eIuu+Gkot8loz PjvqwUQi9tSdZWvLKQKlaEvVRnyvLTIunQAI8qaIH9dSeYYY46tuO3HY6rheDLnnqtQwNeTZIak Kc12XuNGDQNB2SPBIhj0IvV7jlqDi2Kkcom9iYSIvqrlGw2G/kxEksT8U2vYNXsxBNtOXTb9nN+ wKqGAutUGOMO6MZ7Hcdcyf+46K2mXuK0oT3XHU2nFVnNmvv47vqobkz1A0A7atNdpFrZXd80A45 IAXRxM2oa9MPKG95wkC9kO2OSfgdBmjPEm4v5DMoSebb2328i+uLFZZYlisfQ6tklRJO9ij9bMg 3kSk56LG0WsdjH6wrKrauXd3MZDX371moSn0VOPVA6VtlTC888T1pEKV3C+bkEi3bCDx0UbYAPx 8FmtswEwR6GGfJ/2/NbMYCLmNDGnvq3yTFwiBxis4GCuL1lOQ0M/zQmBURphKGdgr8x4f4BBSv+ oarUQsKtuXWKSlXVpNHmClQkxEB+rL5VW+ofZc= X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp1.imsva1 [10.0.100.73]); Sat, 07 Mar 2020 19:55:36 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 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 Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index d5d3484b58..9685456747 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -201,7 +201,7 @@ Options and associated environment variables: Argument Env-variable Description TARGETS QEMU_TARGETS A single arch name or a list of them (see all names below); - if empty, configure all known targets; + if empty, configure/clear all known targets; if 'NONE', no interpreter is configured. -h|--help display this usage -Q|--path PATH QEMU_PATH set path to qemu interpreter(s) @@ -210,6 +210,8 @@ TARGETS QEMU_TARGETS A single arch name or a list of them (see uses are cloned from the open file. -c|--credential QEMU_CREDENTIAL (yes) credential and security tokens are calculated according to the binary to interpret +-r|--clear QEMU_CLEAR (yes) remove registered interpreters for target TARGETS; + then exit. -e|--exportdir PATH define where to write configuration files (default: $SYSTEMDDIR or $DEBIANDIR) -s|--systemd don't write into /proc, generate file(s) for @@ -222,6 +224,7 @@ QEMU_PATH=$QEMU_PATH QEMU_SUFFIX=$QEMU_SUFFIX QEMU_PERSISTENT=$QEMU_PERSISTENT QEMU_CREDENTIAL=$QEMU_CREDENTIAL +QEMU_CLEAR=$QEMU_CLEAR To import templates with update-binfmts, use : @@ -348,8 +351,22 @@ qemu_set_binfmts() { done } +qemu_clear_notimplemented() { + echo "ERROR: option clear not implemented for this mode yet" 1>&2 + usage + exit 1 +} + +qemu_clear_interpreter() { + p="/proc/sys/fs/binfmt_misc/$1" + if [ -f "$p" ] ; then + printf %s -1 > "$p" + fi +} + CHECK=qemu_check_bintfmt_misc BINFMT_SET=qemu_register_interpreter +BINFMT_CLEAR=qemu_clear_interpreter SYSTEMDDIR="/etc/binfmt.d" DEBIANDIR="/usr/share/binfmts" @@ -359,20 +376,26 @@ QEMU_PATH="${QEMU_PATH:-/usr/local/bin}" QEMU_SUFFIX="${QEMU_SUFFIX:-}" QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}" QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" +QEMU_CLEAR="${QEMU_CLEAR:-no}" -options=$(getopt -o dsQ:S:e:hcp -l debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") +options=$(getopt -o rdsQ:S:e:hcp -l clear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") eval set -- "$options" while true ; do case "$1" in + -r|--clear) + QEMU_CLEAR="yes" + ;; -d|--debian) CHECK=qemu_check_debian BINFMT_SET=qemu_generate_debian + BINFMT_CLEAR=qemu_clear_notimplemented EXPORTDIR=${EXPORTDIR:-$DEBIANDIR} ;; -s|--systemd) CHECK=qemu_check_systemd BINFMT_SET=qemu_generate_systemd + BINFMT_CLEAR=qemu_clear_notimplemented EXPORTDIR=${EXPORTDIR:-$SYSTEMDDIR} ;; -Q|--path) @@ -407,4 +430,13 @@ done shift $CHECK + +if [ "x$QEMU_CLEAR" = "xyes" ] ; then + qemu_check_target_list "$@" + for t in $checked_target_list ; do + $BINFMT_CLEAR "qemu-$t" + done + exit +fi + qemu_set_binfmts "$@" From patchwork Sat Mar 7 18:56:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Unai Martinez Corral X-Patchwork-Id: 1250943 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZYcK122Nz9sNg for ; Sun, 8 Mar 2020 05:56:33 +1100 (AEDT) Received: from localhost ([::1]:51876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAech-0005RQ-2L for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2020 13:56:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36447) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAecP-0005Qf-U8 for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:56:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAecO-0006jE-Pr for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:56:13 -0500 Received: from smtp.lg.ehu.es ([158.227.0.66]:37479 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 1jAecO-0006gD-Eg for qemu-devel@nongnu.org; Sat, 07 Mar 2020 13:56:12 -0500 Received: from imsva1.lgp.ehu.es (imsva1.lgp.ehu.es [10.0.3.245]) by postfix.smtp1.imsva1 (Postfix) with ESMTPS id 0811E36F95; Sat, 7 Mar 2020 19:56:11 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D150211004A; Sat, 7 Mar 2020 19:56:10 +0100 (CET) Received: from imsva1.lgp.ehu.es (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5648110045; Sat, 7 Mar 2020 19:56:10 +0100 (CET) Received: from smtp.ehu.eus (unknown [10.0.100.73]) by imsva1.lgp.ehu.es (Postfix) with ESMTPS; Sat, 7 Mar 2020 19:56:10 +0100 (CET) Received: from afee69d503a7 (unknown [81.0.0.187]) by smtp1 (Postfix) with ESMTPSA id 7FB7336F95; Sat, 7 Mar 2020 19:56:10 +0100 (CET) Date: Sat, 7 Mar 2020 18:56:09 +0000 From: Unai Martinez-Corral To: qemu-devel@nongnu.org Subject: [PATCH v8 9/9] qemu-binfmt-conf.sh: add --test Message-ID: <20200307185609.GF45@afee69d503a7> References: <20200307170251.GA7@dd5f6ec33fb0> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200307170251.GA7@dd5f6ec33fb0> X-Greylist: ACL 184 matched, not delayed by milter-greylist-4.6.2 (smtp1 [10.0.100.73]); Sat, 07 Mar 2020 19:56:10 +0100 (CET) X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSVA-9.1.0.1631-8.5.0.1020-25276.002 X-TM-AS-Result: No--2.997-7.0-31-10 X-imss-scan-details: No--2.997-7.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1631-8.5.1020-25276.002 X-TMASE-Result: 10--2.997200-10.000000 X-TMASE-MatchedRID: 4y9/ylYYqyY8mRT0SYY6fguB7zdAMUjAnVQTrXdqB1rGkE1bT11zTEAc 6DyoS2rIKnoLoDc7CX1BeUNELByi+f217Ks8q26/amOGWbsSIFenU+NxqV3DDUYza41dGqxSCn+ QUnj5ZKiuQih3+HqEP/uCK8CpbZE5P0RMDgPThrXagiRcLo6XQOHCwRwMNQUW4ZmC0TPZtojHK3 DBP8Kop+0+/68r4mWd+5zC6D5RoqsO9fZKTjt+z5XIRfiL5JZTAp+UH372RZUjNNPmQPqs4J4CI KY/Hg3AyJ1gFgOMhOkZsIdvLTjL2AAYNQKSVsYiwrbXMGDYqV8HTT+SR4FPABjtt0x+lU92LFiG Ovf3yPPkPGGaxXXHxV54s+vj71IOm6C1NINufeRSR6Juxne78syT8f6LnvnzUJR1Jh/1hk5coWw 5/2ERXzQw5IQ87EEy6fuXT+JI9EvhYXsqMOmRhhqQohjffj3k X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 X-Greylist: Sender IP whitelisted, Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (postfix.smtp1.imsva1 [10.0.100.73]); Sat, 07 Mar 2020 19:56:11 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 158.227.0.66 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, laurent@vivier.eu Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Unai Martinez-Corral Reviewed-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 9685456747..4635871e6d 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -201,8 +201,7 @@ Options and associated environment variables: Argument Env-variable Description TARGETS QEMU_TARGETS A single arch name or a list of them (see all names below); - if empty, configure/clear all known targets; - if 'NONE', no interpreter is configured. + if empty, configure/clear all known targets. -h|--help display this usage -Q|--path PATH QEMU_PATH set path to qemu interpreter(s) -F|--suffix SUFFIX QEMU_SUFFIX add a suffix to the default interpreter name @@ -212,6 +211,8 @@ TARGETS QEMU_TARGETS A single arch name or a list of them (see to the binary to interpret -r|--clear QEMU_CLEAR (yes) remove registered interpreters for target TARGETS; then exit. +-t|--test QEMU_TEST (yes) test the setup with the provided arguments, but do not + configure any of the interpreters. -e|--exportdir PATH define where to write configuration files (default: $SYSTEMDDIR or $DEBIANDIR) -s|--systemd don't write into /proc, generate file(s) for @@ -225,6 +226,7 @@ QEMU_SUFFIX=$QEMU_SUFFIX QEMU_PERSISTENT=$QEMU_PERSISTENT QEMU_CREDENTIAL=$QEMU_CREDENTIAL QEMU_CLEAR=$QEMU_CLEAR +QEMU_TEST=$QEMU_TEST To import templates with update-binfmts, use : @@ -323,9 +325,6 @@ qemu_set_binfmts() { # reduce the list of target interpreters to those given in the CLI targets=${@:-$QEMU_TARGET} - if [ "x$targets" = "xNONE" ] ; then - return - fi qemu_check_target_list $targets # register the interpreter for each target except for the native one @@ -377,12 +376,16 @@ QEMU_SUFFIX="${QEMU_SUFFIX:-}" QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}" QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}" QEMU_CLEAR="${QEMU_CLEAR:-no}" +QEMU_TEST="${QEMU_TEST:-no}" -options=$(getopt -o rdsQ:S:e:hcp -l clear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") +options=$(getopt -o trdsQ:S:e:hcp -l test,clear,debian,systemd,path:,suffix:,exportdir:,help,credential,persistent -- "$@") eval set -- "$options" while true ; do case "$1" in + -t|--test) + QEMU_TEST="yes" + ;; -r|--clear) QEMU_CLEAR="yes" ;; @@ -431,6 +434,11 @@ shift $CHECK +if [ "x$QEMU_TEST" = "xyes" ] ; then + BINFMT_SET=: + BINFMT_CLEAR=: +fi + if [ "x$QEMU_CLEAR" = "xyes" ] ; then qemu_check_target_list "$@" for t in $checked_target_list ; do