1 | #!/bin/bash
|
---|
2 |
|
---|
3 |
|
---|
4 | # http://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
|
---|
5 | currentdir=$( cd "$(dirname "$0")" ; pwd -P )
|
---|
6 |
|
---|
7 | if ! test -f "$currentdir/expeditee-release-kits/rke-setup.sh"; then
|
---|
8 | echo ""
|
---|
9 | echo "********************"
|
---|
10 | echo "First edit $currentdir/expeditee-release-kits/rke-setup.sh.in"
|
---|
11 | echo "to generate $currentdir/expeditee-release-kits/rke-setup.sh"
|
---|
12 | echo ""
|
---|
13 | echo "********************"
|
---|
14 | echo ""
|
---|
15 | exit -1
|
---|
16 | else
|
---|
17 | # rke-setup uses local paths, so cd into expeditee-release-kits first
|
---|
18 | # then call rke-setup.sh to source the environment vars it sets
|
---|
19 | pushd "$currentdir/expeditee-release-kits"
|
---|
20 | source "rke-setup.sh"
|
---|
21 | returnval=$?
|
---|
22 | if [ "$returnval" != "0" ]; then
|
---|
23 | echo "Error running rke-setup.sh, return value: $returnval"
|
---|
24 | popd
|
---|
25 | exit -2
|
---|
26 | else
|
---|
27 | popd
|
---|
28 |
|
---|
29 | # Make sure the expeditee folder and its rke-build.properties file exist
|
---|
30 | # then run the 'rke' command from snapshots\expeditee
|
---|
31 | pushd "$currentdir/snapshots"
|
---|
32 | if test -d expeditee; then
|
---|
33 | echo "Deleting $currentdir/snapshots/expeditee...."
|
---|
34 | rm -rf $currentdir/snapshots/expeditee
|
---|
35 | fi
|
---|
36 | if ! test -d expeditee; then
|
---|
37 | mkdir expeditee
|
---|
38 | fi
|
---|
39 | if ! test -f expeditee/rke-build.properties; then
|
---|
40 | cp $currentdir/expeditee-release-kits/rke-build.properties.in expeditee/rke-build.properties
|
---|
41 | fi
|
---|
42 | pushd expeditee
|
---|
43 | rke
|
---|
44 |
|
---|
45 | # http://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script
|
---|
46 | DATE=`date +%Y-%m-%d`
|
---|
47 |
|
---|
48 | # Uploading
|
---|
49 | mkdir uploads
|
---|
50 | cp products/Expeditee-1${products_suffix} uploads/Expeditee-1-${DATE}${uploads_suffix}
|
---|
51 | cp rke.out uploads/rke-${DATE}${out_suffix}.out
|
---|
52 | cd uploads && tar -c * | ssh -T -i "${identity_file}" [email protected]
|
---|
53 |
|
---|
54 | exit 0
|
---|
55 | fi
|
---|
56 | fi
|
---|