added option -o to download script, all scripts tested succesfully
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/distributions/smartgears-distribution@82578 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ca4b3ae8a6
commit
e2ebb44bec
|
@ -22,6 +22,12 @@ exit 0 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [ -z "$apps" ]; then
|
||||||
|
echo -e "\nERROR: apps parameter do not specified. please specify it with -a option" >&2
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$ghnhome" ]; then
|
if [ -z "$ghnhome" ]; then
|
||||||
if [ -z "$GHN_HOME" ]; then
|
if [ -z "$GHN_HOME" ]; then
|
||||||
echo -e "\nERROR:please specify the gHN directory (-g) or define the GHN_HOME env var." >&2
|
echo -e "\nERROR:please specify the gHN directory (-g) or define the GHN_HOME env var." >&2
|
||||||
|
@ -34,11 +40,11 @@ if [ -z "$ghnhome" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d "$ghnhome/$apps" ]; then
|
if [ ! -d "$ghnhome/state/$apps" ]; then
|
||||||
echo -e "\nERROR: apps folder does not exist or is not a directory, aborting." >&2
|
echo -e "\nERROR: apps folder does not exist or is not a directory, aborting." >&2
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Removing application state $ghnhome/$apps"
|
echo "Removing application state $ghnhome/state/$apps"
|
||||||
#removing folder
|
#removing folder
|
||||||
rm -rf $ghnhome/$apps
|
rm -rf $ghnhome/state/$apps
|
|
@ -34,4 +34,4 @@ fi
|
||||||
|
|
||||||
echo "Removing container state $ghnhome"
|
echo "Removing container state $ghnhome"
|
||||||
#removing folder
|
#removing folder
|
||||||
rm -rf $ghnhome
|
rm -rf $ghnhome/state
|
|
@ -1,20 +1,23 @@
|
||||||
nexusurl=maven.research-infrastructures.eu/nexus
|
nexusurl=maven.research-infrastructures.eu/nexus
|
||||||
group=org.gcube.distribution
|
group=org.gcube.distribution
|
||||||
artifact=smartgears-distribution
|
artifact=smartgears-distribution
|
||||||
repo=gcube-releases
|
repo=gcube-release
|
||||||
|
folder=$PWD
|
||||||
|
|
||||||
function showhelp {
|
function showhelp {
|
||||||
echo -e "\nusage: download [-v <version>] [-s|-h] \n"
|
echo -e "\nusage: download [-v <version>] [-o <folder>] [-s|-h] \n"
|
||||||
echo " <version> = the version to download."
|
echo " <version> = the version to download."
|
||||||
echo " = By default, this is the latest known version."
|
echo " = By default, this is the latest known version."
|
||||||
echo " s = download a snapshot version."
|
echo " s = download a snapshot version."
|
||||||
|
echo " <folder> = download to specific folder."
|
||||||
echo " x = dry run."
|
echo " x = dry run."
|
||||||
echo -e " h = shows this help.\n"
|
echo -e " h = shows this help.\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":v:sh" opt; do
|
while getopts ":v:o:sh" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
v) version=$OPTARG;;
|
v) version=$OPTARG;;
|
||||||
|
o) folder=$OPTARG;;
|
||||||
s) repo=gcube-snapshots;;
|
s) repo=gcube-snapshots;;
|
||||||
h) showhelp
|
h) showhelp
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
@ -34,11 +37,8 @@ done
|
||||||
|
|
||||||
version_regexp=".*<baseVersion>\(.*\)</baseVersion>.*"
|
version_regexp=".*<baseVersion>\(.*\)</baseVersion>.*"
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
version=`curl -silent -L $nexusurl/service/local/artifact/maven/resolve?r=$repo&g=$group&a=$artifact&v=LATEST&e=tar.gz" \
|
version=`curl -silent -L "$nexusurl/service/local/artifact/maven/resolve?r=$repo&g=$group&a=$artifact&v=LATEST&e=tar.gz" | grep "$version_regexp" | sed "s|$version_regexp|\1|"` #(first extract matching line, then extract matching group)
|
||||||
| grep "$version_regexp" | sed "s|$version_regexp|\1|"` #(first extract matching line, then extract matching group)
|
|
||||||
|
|
||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
echo -e "\nERROR: cannot find a version to download in $repo." >&2
|
echo -e "\nERROR: cannot find a version to download in $repo." >&2
|
||||||
echo -e "\naborting.\n"
|
echo -e "\naborting.\n"
|
||||||
|
@ -48,10 +48,10 @@ fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo -e "\ndownloading smartgears-distribution-$version.tar.gz...\c"
|
echo -e "\ndownloading smartgears-distribution-$version.tar.gz to folder $folder ....\c"
|
||||||
|
|
||||||
|
|
||||||
http_code=`curl -s -o "smartgears-distribution-$version.tar.gz" -w "%{http_code}" -L "$nexusurl/service/local/artifact/maven/redirect?r=$repo&g=$group&a=$artifact&v=$version&e=tar.gz"`
|
http_code=`curl -s --create-dirs -o "$folder/smartgears-distribution-$version.tar.gz" -w "%{http_code}" -L "$nexusurl/service/local/artifact/maven/redirect?r=$repo&g=$group&a=$artifact&v=$version&e=tar.gz"`
|
||||||
|
|
||||||
if [ ! "$http_code" = "200" ]; then
|
if [ ! "$http_code" = "200" ]; then
|
||||||
echo -e "\n\nERROR: cannot download version $version from $repo." >&2
|
echo -e "\n\nERROR: cannot download version $version from $repo." >&2
|
||||||
|
|
Loading…
Reference in New Issue