#!/bin/bash # http://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself currentdir=$( cd "$(dirname "$0")" ; pwd -P ) if ! test -f "$currentdir/expeditee-release-kits/rke-setup.sh"; then echo "" echo "********************" echo "First edit $currentdir/expeditee-release-kits/rke-setup.sh.in" echo "to generate $currentdir/expeditee-release-kits/rke-setup.sh" echo "" echo "********************" echo "" exit -1 else # rke-setup uses local paths, so cd into expeditee-release-kits first # then call rke-setup.sh to source the environment vars it sets pushd "$currentdir/expeditee-release-kits" source "rke-setup.sh" returnval=$? if [ "$returnval" != "0" ]; then echo "Error running rke-setup.sh, return value: $returnval" popd exit -2 else popd # Make sure the expeditee folder and its rke-build.properties file exist # then run the 'rke' command from snapshots\expeditee pushd "$currentdir/snapshots" if test -d expeditee; then echo "Deleting $currentdir/snapshots/expeditee...." rm -rf $currentdir/snapshots/expeditee fi if ! test -d expeditee; then mkdir expeditee fi if ! test -f expeditee/rke-build.properties; then cp $currentdir/expeditee-release-kits/rke-build.properties.in expeditee/rke-build.properties fi pushd expeditee rke # http://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script DATE=`date +%Y-%m-%d` # Uploading mkdir uploads cp products/Expeditee-1${products_suffix} uploads/Expeditee-1-${DATE}${uploads_suffix} cp rke.out uploads/rke-${DATE}${out_suffix}.out cd uploads && tar -c * | ssh -T -i "${identity_file}" anupama@wharariki.cms.waikato.ac.nz exit 0 fi fi