NO-JIRA: more tweaks for the release helper script

Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a0bd5536
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a0bd5536
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a0bd5536

Branch: refs/heads/master
Commit: a0bd5536773a840191c5b125c2f79817445f19e5
Parents: 0434efb
Author: Robbie Gemmell <rob...@apache.org>
Authored: Mon Sep 25 16:54:40 2017 +0100
Committer: Robbie Gemmell <rob...@apache.org>
Committed: Mon Sep 25 16:58:24 2017 +0100

----------------------------------------------------------------------
 scripts/download-release.sh | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a0bd5536/scripts/download-release.sh
----------------------------------------------------------------------
diff --git a/scripts/download-release.sh b/scripts/download-release.sh
index 42f02f4..5025c88 100755
--- a/scripts/download-release.sh
+++ b/scripts/download-release.sh
@@ -26,10 +26,10 @@ error () {
    echo ""
    echo "$@"
    echo ""
-   echo "Usage: ./download-release.sh repo-url version target"
+   echo "Usage: ./download-release.sh repo-url version [target-dir (defaults 
to version, must not exist)]"
    echo ""
    echo "example:"
-   echo "./download-release.sh https://repo1.maven.org/maven2 2.3.0 ./target"
+   echo "./download-release.sh https://repo1.maven.org/maven2 2.3.0"
    echo ""
    exit 64
 }
@@ -41,7 +41,7 @@ doDownload () {
 
   echo $theFile
 
-  echo "Downloading $theFile from $completeURL"
+  echo "Downloading $completeURL"
   curl $completeURL > $theFile
 
   echo "Downloading $theFile.asc"
@@ -60,25 +60,32 @@ doDownload () {
   sha512sum $theFile > $theFile.sha512
 }
 
-if [ "$#" != 3 ]; then
+if [ "$#" -lt 2 ]; then
   error "Cannot match arguments"
 fi
 
 release=$2
+target=${3-$2}
+echo "Target Directory: $target"
 
-if [ -d $3 ]; then
-  cd $3
+if [ -d $target ]; then
+  error "Directory $target already exists, stopping"
 else
-  error "Directory $3 does not exist"
+  echo "Directory $target does not exist, creating"
+  mkdir $target
+  cd $target
 fi
 
 repoURL="$1/org/apache/activemq/apache-artemis/$2"
 
-doDownload apache-artemis-$release-bin.tar.gz 
+doDownload apache-artemis-$release-bin.tar.gz
 doDownload apache-artemis-$release-bin.zip
 doDownload apache-artemis-$release-source-release.tar.gz
 doDownload apache-artemis-$release-source-release.zip
 
+echo ""
+echo "--- Download Complete for Release $2 Artifacts are in $target---"
+echo ""
 echo "Validating all MD5 checksum files"
 md5sum -c *.md5
 

Reply via email to