X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=tools%2Fgen-repo.sh;h=4ddb0170b377cb0fbd5bd93a9cba1b42bfbc5c08;hb=43ae00afe037e77278d08cff2dc105f38184f6bf;hp=8722155771250f3da91f1fb3af533248f378b13f;hpb=9cfcbca9c08c5e09b6055d2a7c16823f8270c7f2;p=osm%2Fdevops.git diff --git a/tools/gen-repo.sh b/tools/gen-repo.sh index 87221557..4ddb0170 100755 --- a/tools/gen-repo.sh +++ b/tools/gen-repo.sh @@ -9,27 +9,43 @@ function usage() { echo -e " -k " echo -e " -j " echo -e " -d " + echo -e " -b " + echo -e " -r " + echo -e " -h " + echo -e " -R " + echo -e " -P " 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" + echo "PUBLIC_KEY_FILE $PUBLIC_KEY_FILE" +} + 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) +PUBLIC_KEY_FILE=~/OSM\ ETSI\ Release\ Key.gpg -while getopts ":p:i:o:k:j::d:" o; do +while getopts ":p:i:o:k:j::d:b:r:h:R:P:" o; do case "${o}" in p) PASSPHRASE_FILE=${OPTARG} @@ -49,6 +65,21 @@ 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} + ;; + P) + PUBLIC_KEY_FILE=${OPTARG} + ;; *) usage exit 1 @@ -56,13 +87,19 @@ 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 " + [ -x $JFROG_CLI ] || FATAL "jfrog cli not found. Please install https://www.jfrog.com/getcli/ and use option '-j '" $JFROG_CLI rt download --build "$BUILD" osm-release || FATAL "Failed to download" BUILD_NUMBER=$(basename "$BUILD") -[ $PASSPHRASE_FILE ] && GPG_PASSPHRASE="--no-use-agent --passphrase \"$(cat $PASSPHRASE_FILE)\"" +[ $PASSPHRASE_FILE ] && GPG_PASSPHRASE="--no-tty --no-use-agent --passphrase \"$(cat $PASSPHRASE_FILE)\"" mkdir -p $BASE_DIR/dists @@ -71,7 +108,7 @@ cp -R $BUILD_NUMBER/pool $BASE_DIR/ cd $BASE_DIR -for i in RO osmclient openvim SO UI; do +for i in RO osmclient openvim SO UI IM; do # gpg sign the packages dpkg-sig -g "$GPG_PASSPHRASE" -k $GPGKEY --sign builder pool/$i/*.deb @@ -88,13 +125,15 @@ apt-ftparchive release dists/$OUT_REPO > dists/$OUT_REPO/Release #gzip -9fk dists/$OUT_REPO/Release rm -f dists/$OUT_REPO/InRelease -eval gpg $GPG_PASSPHRASE --default-key $GPGKEY --clearsign -o dists/$OUT_REPO/InRelease dists/$OUT_REPO/Release +eval gpg $GPG_PASSPHRASE --no-tty --default-key $GPGKEY --clearsign -o dists/$OUT_REPO/InRelease dists/$OUT_REPO/Release 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 - +eval gpg $GPG_PASSPHRASE --no-tty --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/ +# copy over the public key file +[ "$PUBLIC_KEY_FILE" ] && cp "$PUBLIC_KEY_FILE" osm/debian/$RELEASE_DIR + +rsync -avR $RSYNC_OPTIONS osm/debian/$RELEASE_DIR rsync://$RSYNC_USER_HOST/repos