From patchwork Thu Jan 3 20:40:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 1020495 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="d56pyFjF"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43W09C5R1hz9rxp for ; Fri, 4 Jan 2019 07:37:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 04CDB85C1D; Thu, 3 Jan 2019 20:37:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id thEdIXTuf-_Z; Thu, 3 Jan 2019 20:37:46 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5DA9085C4B; Thu, 3 Jan 2019 20:37:46 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id DA7181C2A15 for ; Thu, 3 Jan 2019 20:37:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B737C86356 for ; Thu, 3 Jan 2019 20:37:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NUxQNFIrB49k for ; Thu, 3 Jan 2019 20:37:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by whitealder.osuosl.org (Postfix) with ESMTPS id B4C38862ED for ; Thu, 3 Jan 2019 20:37:39 +0000 (UTC) Received: by mail-ed1-f67.google.com with SMTP id g22so30056134edr.7 for ; Thu, 03 Jan 2019 12:37:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iizFFcSmDp3jsxzMIfAIbAXdCp8pa/xYopnakhJEhUQ=; b=d56pyFjFwF26zFf8HJE/H8o4bQ9EL4eNp2O5piLumd0nFrvGDlE37SZBckTQSd1hAW o+pfNuvElu52k6wad6e0Hkn6NaMjwWIlW5mGnflLmTD1k1NtG+ev3JizivAQ4sFjMc/m gCunJeEPlazcb26rWdVosZ7epvy2SF6UeyuOmuIkYjs8f1zv53rcWk3CT+/bW3jPyy0Q KrVgdAyt86eZHwkdQtVP2oEea/uArap/XXr/H3Gzj+aCiDgrexVJhlIt9CW9RGqDsWsS 0YinasFfLWH5CSVrxssOKZ0a+C5jsoJ+rBhrG2FOrgSKyUibu8nezlnzNyAbmA6YOtAv ALvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iizFFcSmDp3jsxzMIfAIbAXdCp8pa/xYopnakhJEhUQ=; b=P8G/D/TEnCEbBJGXTWRtdcwOnfyRUAiJtj4latvTz0FufeTQ63KbRmWOrfOWZEtKPn oWM3245DNcBmZ7oi9rRQyaYI3AhZlrENC8Qxc/RwXc+ULHUKvoRqBtj36n2nO1M2LjD4 fD3LbNIevr0GOI4UPGFJ6xiY5jzdfp0kEOKlT5yMY+CS0Y+JcyigEVz9XD4DXuFZsqrs etGcw75Jx1jTERGlmAocuzgHhP+MJtu1b5XarnX9DltYR+QWD8LBDBBuhBCP2LXitDiq oV0Ffo3xhO/J4tWpYMYhoyKVBX4hto7/pd0U2zf92d6qR+8TMTf8jYooa2T8+fYP9pRa WtFw== X-Gm-Message-State: AA+aEWZWK7MBBMNR7Kjj5q3rRslPNJ95jm8jNfdBoa76LCvQRWqCup5I hTvjqQFbK7hBsxgZ28PwFjm2Az3pg88= X-Google-Smtp-Source: AFSGD/UW3fNtxAncLouEGXICF9raDMrSTRWg+isxdAqYwwrxubNsrtvV8t0bB3dJ7ncDVtIUl9nHtQ== X-Received: by 2002:a50:a55c:: with SMTP id z28mr43801412edb.124.1546547857954; Thu, 03 Jan 2019 12:37:37 -0800 (PST) Received: from localhost.localdomain (d54C493B0.access.telenet.be. [84.196.147.176]) by smtp.gmail.com with ESMTPSA id p1-v6sm13452926ejo.49.2019.01.03.12.37.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jan 2019 12:37:37 -0800 (PST) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Thu, 3 Jan 2019 21:40:21 +0100 Message-Id: <20190103204026.23512-7-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20190103204026.23512-1-patrickdepinguin@gmail.com> References: <20190103204026.23512-1-patrickdepinguin@gmail.com> Subject: [Buildroot] [PATCH 06/11] support/download: implement source-check in file backend X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E. MORIN" , Thomas De Schampheleire MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas De Schampheleire Signed-off-by: Thomas De Schampheleire --- support/download/file | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/support/download/file b/support/download/file index e52fcf2c8c..3a92fa9f67 100755 --- a/support/download/file +++ b/support/download/file @@ -7,6 +7,7 @@ set -e # # Options: # -q Be quiet. +# -C Only check that the source file exists # -o FILE Copy to file FILE. # -f FILE Copy from basename file FILE. # -u DIR Copy from FILE in DIR. @@ -23,6 +24,7 @@ verbose=-v while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do case "${OPT}" in q) verbose=;; + C) checkonly=1;; o) output="${OPTARG}";; f) file="${OPTARG}";; u) dir="${OPTARG}";; @@ -39,4 +41,12 @@ _localfiles() { eval ${LOCALFILES} "${@}" } -_localfiles ${verbose} "'${dir##file://}/${file}'" "'${output}'" +# Remove any scheme prefix +dir="${dir##file://}" + +if [ -n "${checkonly}" ]; then + test -e "'${dir}/${file}'" + exit ${?} +fi + +_localfiles ${verbose} "'${dir}/${file}'" "'${output}'"