From patchwork Tue Feb 19 10:38:34 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: 1044607 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.136; helo=silver.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="u4YUjpgo"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 443cfM06h4z9s3l for ; Tue, 19 Feb 2019 21:38:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 64E7822EC9; Tue, 19 Feb 2019 10:38:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id APYAxJQM+WIo; Tue, 19 Feb 2019 10:38:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id BD92A22EE6; Tue, 19 Feb 2019 10:38:45 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id EDF681BF283 for ; Tue, 19 Feb 2019 10:38:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E573D86BFB for ; Tue, 19 Feb 2019 10:38:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4w9kfckFse0h for ; Tue, 19 Feb 2019 10:38:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by hemlock.osuosl.org (Postfix) with ESMTPS id 406A586B6F for ; Tue, 19 Feb 2019 10:38:42 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id c18so11758995otl.13 for ; Tue, 19 Feb 2019 02:38:42 -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 :mime-version:content-transfer-encoding; bh=XwF31fwxKSz5WNtnqYw6PL24yLtUHYgOjBXrI3H+d9Y=; b=u4YUjpgoiGb0OCE7mgTRUvg4r4MJWUsQL3v3t6lcL5c/V26qEc9gnJbjdrPHfPWl5Z oZ+Zs6zLU1EOsdN6DT+9C8u1/2OWupnYv6bnU+7OV5JUmP1ePvnNkI9nmpDba17b0QBJ T/qogUC8OS0m+NZ80EgcG+0QCAR/dOdNbUs/RBl7nfjMu8JwCdln4Ma0XTNrg2vFdwOT YnuB7z1Y+loW0Wj36aG8iCOE6kceT7jBXBtIQxME2qvUX2eQ9uzUPXhD7je71y5Jj/W3 NU8pjeBsArEY7j89qpVBrqUFKcl7EPG2vHeXlEkQSa7JjDHsSmdjg02/AGfoCjYMjzgh LCow== 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:mime-version:content-transfer-encoding; bh=XwF31fwxKSz5WNtnqYw6PL24yLtUHYgOjBXrI3H+d9Y=; b=CG4O6epSjTWS/21mEkhWTMVplMVaI4f3EZm5fMCGSstT2CfNsNkdFZl+1cn3MUCAJR 6hFUDlxeWDSfLfAgpLc55ngQoWunXRWoNL/eQSRJ9pParC2HP/QJce4hC9tyWuz8f1EH r8TwLypDzckI1TLb7JPFX9xeTh1XGqSsTXGXprWXmtIMoGipFZZ9TyzWx0Ns+3R0uBcD bXotIEEFC6KSjc7etTKgI8Jr3wF4SfN8aHGEyz5ndOdqEhlY65djjdcvwmU9MXI71rn6 a6wIePRjwCIKb/a7SNLbMKR4MSoZ6vXqls/HpkOCAc/aNHd75sTAIdc2sAR9NQkJti2G 2Kuw== X-Gm-Message-State: AHQUAuYH4Ts4AltK3/pwrXqdvUEYi7pAcScoMhhf8X7GpKOgsa/Ba9VC VIBE4paHY2OMyrHr3xXACjPo+0qGNaU= X-Google-Smtp-Source: AHgI3IaWeuPPQpacQbvpyYh1TQuzgY8xB9vRrv4l1J7G+pYgR50+aMMX0Niv6Nig+OF+rVzPsg0Tww== X-Received: by 2002:aca:c40c:: with SMTP id u12mr2131324oif.138.1550572721248; Tue, 19 Feb 2019 02:38:41 -0800 (PST) Received: from localhost ([131.228.32.166]) by smtp.gmail.com with ESMTPSA id b20sm1313063otl.55.2019.02.19.02.38.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 02:38:40 -0800 (PST) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Tue, 19 Feb 2019 11:38:34 +0100 Message-Id: <20190219103839.25409-4-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190219103839.25409-1-patrickdepinguin@gmail.com> References: <20190219103839.25409-1-patrickdepinguin@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCHv5 4/9] support/download/file: implement source-check 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 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas De Schampheleire Signed-off-by: Thomas De Schampheleire --- support/download/file | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) v5: no changes v4: - use true/false as values to 'checkonly' (Yann E. Morin) - replace incorrect 'exit $?' by explicit 'exit 0' (Yann E. Morin) - replace 'test -e' by 'test -f' which is more specific v3: no changes diff --git a/support/download/file b/support/download/file index e52fcf2c8c..059a8dde4c 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. @@ -20,9 +21,11 @@ set -e # Make 'cp' verbose by default, so it behaves a bit like the others. verbose=-v +checkonly=false while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do case "${OPT}" in q) verbose=;; + C) checkonly=true;; o) output="${OPTARG}";; f) file="${OPTARG}";; u) dir="${OPTARG}";; @@ -39,4 +42,12 @@ _localfiles() { eval ${LOCALFILES} "${@}" } -_localfiles ${verbose} "'${dir##file://}/${file}'" "'${output}'" +# Remove any scheme prefix +dir="${dir##file://}" + +if ${checkonly}; then + test -f "'${dir}/${file}'" + exit 0 +fi + +_localfiles ${verbose} "'${dir}/${file}'" "'${output}'"