From patchwork Mon Jul 24 18:27:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 792983 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=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qeJYMYjv"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xGVk81nMKz9s78 for ; Tue, 25 Jul 2017 04:48:00 +1000 (AEST) Received: from localhost ([::1]:56423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZiOc-0007mC-3q for incoming@patchwork.ozlabs.org; Mon, 24 Jul 2017 14:47:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZi76-0001SG-Ca for qemu-devel@nongnu.org; Mon, 24 Jul 2017 14:29:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZi75-000662-KC for qemu-devel@nongnu.org; Mon, 24 Jul 2017 14:29:52 -0400 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:36323) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZi75-00065o-GC; Mon, 24 Jul 2017 14:29:51 -0400 Received: by mail-qt0-x244.google.com with SMTP id l55so12887791qtl.3; Mon, 24 Jul 2017 11:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AfCcZSJYqRZF6Ur+KvtsZ+H8mfSHGJUablw83XGMtwE=; b=qeJYMYjv8gBz/6lD5HmHKL8rV7bgDgzhWE5JpnfAvzz4Ov4xwBnm8CGs5yrg5MsIFZ LM2143JKKNo0YTMUgqspdBtd/xCrEP7xguIhDx8mS+919aVgOuxfPpXQGCNPmKWLjG8X pT3ioHug/vjL9NqErNhmyxSMl8yS+yYsFUnpcE4Psf177pDOgdH1FbLY0vKtkK4RaKcQ 8Vli74GfzV5b7GZmU2F9uRKlPkDrYOsfSlIRZ6prh5FSi94DsGeB+Jbv9CHqsTFFdmvL FDXUyl+Fpi/NizMq2aGB0JjnaLMs2s5eiCd6AjDxQttBIqYecf8bd78COZ1QjE8zKMvb UJMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=AfCcZSJYqRZF6Ur+KvtsZ+H8mfSHGJUablw83XGMtwE=; b=H2BplDxLLYEc5lbEyBXRbG3II0UVHKYR4I+B51GixRp2JpVwh9cVfNigGpzZc/gNSo howxTM9y7lWOrKf4SyJbluBYsZ837oe3l71p3O2gmeFKF9ei7SLVlICQOHC/KKc1dD9D XNmuRPJXZZE1K1cxZmpJsahJ5nfvdZVuAZg055jc6Bx9Wr/7H6xEdBpZ4/FP3XJf6f4G iMepvv7FvGWZxLDJwK/7QZYfxlN/gv9HnHF0fx6UNomf5tyGOUu1+ki2vfxnrDy2prKl DBpfrJ6+b4uWC2WxEtDilrrO+27RtAnj2qq2wGJ1B2Wy7D08QYCE8QYi9SYO3W6mYG+k agmw== X-Gm-Message-State: AIVw1132y3lsdwMYDtUgreRktzyX3TMsivE5z4JSylrwa+4MGYtM7UN0 pWBBVHBd72VCGg== X-Received: by 10.200.9.27 with SMTP id t27mr21058235qth.107.1500920991061; Mon, 24 Jul 2017 11:29:51 -0700 (PDT) Received: from yoga.offpageads.com ([138.117.48.223]) by smtp.gmail.com with ESMTPSA id t57sm9033799qtt.18.2017.07.24.11.29.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jul 2017 11:29:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Eric Blake , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Fam Zheng Date: Mon, 24 Jul 2017 15:27:51 -0300 Message-Id: <20170724182751.18261-36-f4bug@amsat.org> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170724182751.18261-1-f4bug@amsat.org> References: <20170724182751.18261-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::244 Subject: [Qemu-devel] [RFC PATCH for 2.10 35/35] script to run docker image 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: qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- scripts/dockershell | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 scripts/dockershell diff --git a/scripts/dockershell b/scripts/dockershell new file mode 100755 index 0000000000..f6a2276172 --- /dev/null +++ b/scripts/dockershell @@ -0,0 +1,30 @@ +#! /bin/sh + +# This script starts a docker shell with QEMU directory mounted +# +# Copyright (C) 2017 Philippe Mathieu-Daudé. GPLv2+. +# +# Usage: +# ./scripts/dockershell qemu:debian-bleeding-dev + +if [ $# -lt 1 ]; then + echo + echo "error: missing image name" + echo + docker images qemu --no-trunc --format="- {{.Repository}}:{{.Tag}}" + exit 1 +fi + +SDIR=$(cd "$(dirname "$0")/.." && pwd -P) +CDIR=$(pwd -P) + +VOLS="-v /tmp:/tmp" +if [ "${SDIR}" = "${CDIR}" ]; then + VOLS="${VOLS} -v ${SDIR}:${SDIR} -w ${SDIR}" +else + VOLS="${VOLS} -v ${SDIR}:${SDIR}:ro -v ${CDIR}:${CDIR} -w ${CDIR}" +fi + +docker run --rm -it ${VOLS} \ + -u $(id -u) \ + $1