diff --git a/distro/contents/scripts/clean-app-state b/distro/contents/scripts/clean-app-state index ab2b6c0..f61ddfd 100644 --- a/distro/contents/scripts/clean-app-state +++ b/distro/contents/scripts/clean-app-state @@ -22,6 +22,12 @@ exit 0 ;; esac 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 "$GHN_HOME" ]; then 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 -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 exit 1; fi -echo "Removing application state $ghnhome/$apps" +echo "Removing application state $ghnhome/state/$apps" #removing folder -rm -rf $ghnhome/$apps \ No newline at end of file +rm -rf $ghnhome/state/$apps \ No newline at end of file diff --git a/distro/contents/scripts/clean-container-state b/distro/contents/scripts/clean-container-state index d050846..80737bc 100644 --- a/distro/contents/scripts/clean-container-state +++ b/distro/contents/scripts/clean-container-state @@ -34,4 +34,4 @@ fi echo "Removing container state $ghnhome" #removing folder -rm -rf $ghnhome \ No newline at end of file +rm -rf $ghnhome/state \ No newline at end of file diff --git a/distro/contents/scripts/download b/distro/contents/scripts/download index 80d7ae2..23a7868 100644 --- a/distro/contents/scripts/download +++ b/distro/contents/scripts/download @@ -1,20 +1,23 @@ nexusurl=maven.research-infrastructures.eu/nexus group=org.gcube.distribution artifact=smartgears-distribution -repo=gcube-releases +repo=gcube-release +folder=$PWD function showhelp { - echo -e "\nusage: download [-v ] [-s|-h] \n" + echo -e "\nusage: download [-v ] [-o ] [-s|-h] \n" echo " = the version to download." echo " = By default, this is the latest known version." echo " s = download a snapshot version." + echo " = download to specific folder." echo " x = dry run." echo -e " h = shows this help.\n" } -while getopts ":v:sh" opt; do +while getopts ":v:o:sh" opt; do case $opt in v) version=$OPTARG;; + o) folder=$OPTARG;; s) repo=gcube-snapshots;; h) showhelp exit 0 ;; @@ -34,11 +37,8 @@ done version_regexp=".*\(.*\).*" - 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" \ - | grep "$version_regexp" | sed "s|$version_regexp|\1|"` #(first extract matching line, then extract matching group) - + 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) if [ -z "$version" ]; then echo -e "\nERROR: cannot find a version to download in $repo." >&2 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 echo -e "\n\nERROR: cannot download version $version from $repo." >&2 @@ -60,4 +60,4 @@ if [ ! "$http_code" = "200" ]; then exit 1 fi -echo -e "done.\n" \ No newline at end of file +echo -e "done.\n"