3 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
4 ##############################################################################
5 # Copyright (c) 2015 The Linux Foundation and others.
7 # All rights reserved. This program and the accompanying materials
8 # are made available under the terms of the Eclipse Public License v1.0
9 # which accompanies this distribution, and is available at
10 # http://www.eclipse.org/legal/epl-v10.html
11 ##############################################################################
13 ARTIFACT_DIR=".sign-artifacts"
14 SIGNATURES_DIR="gpg-signatures"
17 function print_usage {
18 echo "Usage: $0 sign <url>"
20 echo " sign : Downloads and Signs artifacts from Nexus"
24 # Downloads artifacts from a Nexus URL and creates gpg signatures for them
25 # and copies the signatures to a separate directory.
27 echo "Signing artifacts..."
29 if [ -d "$ARTIFACT_DIR" ]; then
30 echo "$ARTIFACT_DIR directory exists. Clearing..."
37 echo "Fetching artifacts from $URL"
39 wget --recursive --execute robots=off --no-parent --quiet \
40 --no-host-directories --cut-dirs=2 \
43 # Remove files that don't need signing
48 -o -name "_maven.repositories*" \
49 -o -name "_remote.repositories*" \
50 -o -name "maven-metadata-local.xml*" \
51 -o -name "maven-metadata.xml*" \
52 -o -name "index.html*" | xargs rm
54 for f in `find . -type f ! -name "*.asc" ! -name "*.sha1" ! -name "*.md5"`
62 if [ -d "$SIGNATURES_DIR" ]; then
63 echo "$SIGNATURES_DIR directory exists. Clearing..."
64 rm -rf $SIGNATURES_DIR
67 rsync -avz --include '*/' --include '*.asc' --exclude '*' \
68 "${ARTIFACT_DIR}/org" "${SIGNATURES_DIR}"
80 if [ "$MODE" == "sign" ]; then
83 echo "ERROR: Invalid mode."