update rsync options 40/2040/1
authorMike Marchetti <mmarchetti@sandvine.com>
Tue, 25 Jul 2017 20:46:07 +0000 (16:46 -0400)
committerMike Marchetti <mmarchetti@sandvine.com>
Tue, 25 Jul 2017 20:46:07 +0000 (16:46 -0400)
Change-Id: If6f093c220bbd68e95f7f381f21bfd59e6ff8693
Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
tools/gen-repo.sh

index 8722155..5227f88 100755 (executable)
@@ -9,27 +9,40 @@ function usage() {
     echo -e "  -k  <gpg key>            "
     echo -e "  -j  <jfrog cli>          "
     echo -e "  -d  <base dir>           "
+    echo -e "  -b  <build>              "
+    echo -e "  -r  <release dir>        "
+    echo -e "  -h  <rsync user@host>    "
+    echo -e "  -R  <rsync options>      "
     exit 1
 }
 
-[ $# -lt 1 ] && usage
-
-BUILD="$1"
-
 function FATAL() {
     echo -e $1
     exit 1
 }
 
+function dump_vars() {
+    echo "incoming repo:  $IN_REPO"
+    echo "outgoing repo:  $OUT_REPO"
+    echo "GPGKEY:         $GPGKEY"
+    echo "JFROG_CLI:      $JFROG_CLI"
+    echo "REPO_BASE:      $REPO_BASE"
+    echo "RELEASE_DIR:    $RELEASE_DIR"
+    echo "BUILD:          $BUILD"
+    echo "RSYNC_USER_HOST $RSYNC_USER_HOST"
+    echo "RSYNC_OPTIONS   $RSYNC_OPTIONS"
+}
+
 IN_REPO="unstable"
 OUT_REPO="stable"
 GPGKEY=71C0472C
 JFROG_CLI=~/jfrog
 REPO_BASE=repo
-BASE_DIR=$REPO_BASE/osm/debian/ReleaseTWO
+RELEASE_DIR=ReleaseTWO
+RSYNC_USER_HOST=osmusers@osm-download.etsi.org
 CURR_DIR=$(pwd)
 
-while getopts ":p:i:o:k:j::d:" o; do
+while getopts ":p:i:o:k:j::d:b:r:h:R:" o; do
     case "${o}" in
         p)
             PASSPHRASE_FILE=${OPTARG}
@@ -49,6 +62,18 @@ while getopts ":p:i:o:k:j::d:" o; do
         d)
             BASE_DIR=${OPTARG}
             ;;
+        b)
+            BUILD=${OPTARG}
+            ;;
+        r)
+            RELEASE_DIR=${OPTARG}
+            ;;
+        h)
+            RSYNC_USER_HOST=${OPTARG}
+            ;;
+        R)
+            RSYNC_OPTIONS=${OPTARG}
+            ;;
         *)
             usage
             exit 1
@@ -56,6 +81,12 @@ while getopts ":p:i:o:k:j::d:" o; do
     esac
 done
 
+dump_vars
+
+BASE_DIR=$REPO_BASE/osm/debian/$RELEASE_DIR
+
+[ -z "$BUILD" ] && FATAL "missing option: -b <build>"
+
 [ -x $JFROG_CLI ] || FATAL "jfrog cli not found. Please install https://www.jfrog.com/getcli/ and use option '-j <jfrog cli location>'"
 
 $JFROG_CLI rt download --build "$BUILD" osm-release || FATAL "Failed to download"
@@ -94,7 +125,7 @@ rm -f dists/$OUT_REPO/Release.gpg
 eval gpg $GPG_PASSPHRASE --default-key $GPGKEY -abs -o dists/$OUT_REPO/Release.gpg dists/$OUT_REPO/Release
 
 
-echo "performing rsync to osm-download.etsi.org:/repos/"
+echo "performing rsync of repo $RELEASE_DIR/dist/$OUT_REPO to osm-download.etsi.org:/repos/"
 cd $CURR_DIR/$REPO_BASE
 
-rsync -avR . rsync://osmusers@osm-download.etsi.org/repos/
+rsync -avR $RSYNC_OPTIONS osm/debian/$RELEASE_DIR rsync://$RSYNC_USER_HOST/repos