From patchwork Sat Feb 9 20:23:48 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: 1039290 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="GOZRcaUR"; 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 43xk6J5sjWz9sMp for ; Sun, 10 Feb 2019 07:24:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id ECBE124B78; Sat, 9 Feb 2019 20:24:05 +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 h93FSBK5KtGM; Sat, 9 Feb 2019 20:24:02 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id F0B6E24368; Sat, 9 Feb 2019 20:23:58 +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 6135C1BF82F for ; Sat, 9 Feb 2019 20:23:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5EF2E87E36 for ; Sat, 9 Feb 2019 20:23:57 +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 tyDMBBTN4k-F for ; Sat, 9 Feb 2019 20:23:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by hemlock.osuosl.org (Postfix) with ESMTPS id 92A6287E23 for ; Sat, 9 Feb 2019 20:23:56 +0000 (UTC) Received: by mail-ed1-f42.google.com with SMTP id d9so713892edh.12 for ; Sat, 09 Feb 2019 12:23:56 -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=wazC4ZztTs8oNOxYgr5EOFw2FGycvOSUeQHzahK9YQk=; b=GOZRcaURgOSbXt+y+6oUorwG7u53kTB3cjvsAByvqtvgGqptw+m5bP31z/3uWphp5L 3KaAgBHNWWxRFbXFd6akj8K9TJpGUqWH8KO6i0RKpGTMImhAMumSZmERzfjrcHkjRzx3 vf5Jk9XoevKVF4kxxtJz15k54Pbabge4kywzFfZiuEAgiunjPnsz1i6DGEQucVkWuhzZ Eg1FuWOULEZZUAi5zOUHDwqlCZR9DEBTesdRzKtE1oJW2y0GJrg+DggiRMZMuuOJs9bv rNKBli3ruEKZyu71YNaOOHI0EneBCsTN6h55qp6fyAp93OZ8Op/qnpsGbgCk9m1ehz7b S43g== 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=wazC4ZztTs8oNOxYgr5EOFw2FGycvOSUeQHzahK9YQk=; b=Rdbb/ooDgp7xZqf2mqkjc05HvI2wgmN6c0NRmTLzGEsTZvwBUk4uKlJ5SoBlyQxAMH 3LO2fX4Dgy842T/i7f2yvG1DF9P2N3nvYB28dhT0c7hwlib7DfbMXLd6l20pIk1w4U4r ze33vC0uShn0MtPgHwaeYvSNs6on8zawVtg61ES5lXBRQe0QLzKezNuhhnBe/p0sGkm1 x4lelwG/wHXI9wxYvKWeogxXHLCOL/kHmlePidVZwM7FxQSVT5S4yLO3jhkmTMTmxFjw e5hKLLqpfaHHXhN8YE0x3oQdb7IioZ9upyT2mSe4PD5KbYZP5Vod+iNnB/EUVZcl5nhe DBCw== X-Gm-Message-State: AHQUAuYd7PNkxFtxUgN7ttUwNGFz2HeFxq7iTb2oWLQ7Sf8zmt3SXVah 3CZrfbL2aJ16FnVYLK2BTlaJNcxNBmQ= X-Google-Smtp-Source: AHgI3IaSXQeDM4kQ+u8iN6noDAxwAUZRZsi13fl5yrVdfSs6cn6ao4xDRpUodaLbLPp9qemvoPB7iQ== X-Received: by 2002:a17:906:a94c:: with SMTP id hh12mr4360280ejb.168.1549743834723; Sat, 09 Feb 2019 12:23:54 -0800 (PST) Received: from localhost.localdomain (d54C493B0.access.telenet.be. [84.196.147.176]) by smtp.gmail.com with ESMTPSA id j16sm492310edt.81.2019.02.09.12.23.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Feb 2019 12:23:54 -0800 (PST) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Sat, 9 Feb 2019 21:23:48 +0100 Message-Id: <20190209202350.4984-6-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190209202350.4984-1-patrickdepinguin@gmail.com> References: <20190209202350.4984-1-patrickdepinguin@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCHv3 6/7] support/download/scp: 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/scp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) v3: no changes diff --git a/support/download/scp b/support/download/scp index 80cf495c4e..d81952956c 100755 --- a/support/download/scp +++ b/support/download/scp @@ -7,17 +7,20 @@ set -e # # Options: # -q Be quiet. +# -C Only check that the file exists remotely. # -o FILE Copy to local file FILE. # -f FILE Copy from remote file FILE. # -u URI Download file at URI. # # Environment: # SCP : the scp command to call +# SSH : the ssh command to use for checkonly verbose= while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do case "${OPT}" in q) verbose=-q;; + C) checkonly=1;; o) output="${OPTARG}";; f) filename="${OPTARG}";; u) uri="${OPTARG}";; @@ -33,8 +36,19 @@ shift $((OPTIND-1)) # Get rid of our options _scp() { eval ${SCP} "${@}" } +_ssh() { + eval ${SSH} "${@}" +} # Remove any scheme prefix uri="${uri##scp://}" +if [ -n "${checkonly}" ]; then + # uri now looks like: foo.example.org:some/directory + domain="${uri%%:*}" + path="${uri#*:}/${filename}" + _ssh ${verbose} "${@}" "'${domain}'" ls "'${path}'" > /dev/null + exit ${?} +fi + _scp ${verbose} "${@}" "'${uri}/${filename}'" "'${output}'"