Last active
December 22, 2015 20:19
-
-
Save vlfig/6526078 to your computer and use it in GitHub Desktop.
Nexus SHA1 lookup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NEXUS_BASE_URL='https://repository.apache.org/' | |
NRA_SEG='service/local/data_index?sha1=' | |
echo "Using $NEXUS_BASE_URL$NRA_SEG<SHA1 checksum>" | |
echo | |
lookup() | |
{ | |
chksum=`shasum $1` | |
url=$NEXUS_BASE_URL$NRA_SEG"${chksum:0:40}" | |
result=`curl -s ${url}` | |
count=`echo ${result} | sed 's|^.*<totalCount>\(.*\)</totalCount>.*$|\1|'` | |
if [ $count -gt 0 ];then | |
gav=`echo ${result} | sed 's|^.*<groupId>\(.*\)</groupId.*artifactId>\(.*\)</artifactId.*version>\(.*\)</version>.*$|\1:\2:\3|'` | |
echo "$1 -> ($gav)" | |
else | |
echo "$1 -> ()" | |
fi | |
} | |
for target in "$@" | |
do | |
lookup $target | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment