X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fcreate-netrc.sh;fp=shell%2Fcreate-netrc.sh;h=4a15e3b661c114a9a5f600538033a9cf8b118657;hb=851b0b6d0cfe84e986548fd596a9b2f18413fefd;hp=0000000000000000000000000000000000000000;hpb=b9a8a519e9f91956b27bc8b1d636dac0ea3cdc29;p=releng%2Fglobal-jjb.git diff --git a/shell/create-netrc.sh b/shell/create-netrc.sh new file mode 100644 index 00000000..4a15e3b6 --- /dev/null +++ b/shell/create-netrc.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# @License EPL-1.0 +############################################################################## +# Copyright (c) 2017 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## + +NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}" +CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \ + -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \ + -v x:username -o ":" -v x:password \ + "$SETTINGS_FILE") + +machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}') +user=$(echo "$CREDENTIAL" | cut -f1 -d:) +pass=$(echo "$CREDENTIAL" | cut -f2 -d:) + +echo "machine $machine login $user password $pass" > ~/.netrc