aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/onap-lab-ci/scripts/mirror-nexus.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deployment/onap-lab-ci/scripts/mirror-nexus.sh')
-rwxr-xr-xdeployment/onap-lab-ci/scripts/mirror-nexus.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/deployment/onap-lab-ci/scripts/mirror-nexus.sh b/deployment/onap-lab-ci/scripts/mirror-nexus.sh
new file mode 100755
index 000000000..94efaa10f
--- /dev/null
+++ b/deployment/onap-lab-ci/scripts/mirror-nexus.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+
+if [ "$#" -ne 1 ]; then
+ echo "$0 <repo>"
+ echo " where <repo> is releases or staging"
+ exit 1
+fi
+
+set -x
+REPO=$1
+
+LOG_DIR=/var/www/html/logs/mirror-nexus/$REPO/
+mkdir -p $LOG_DIR
+
+LOG_FILE=$LOG_DIR/$(date +%FT%TZ).log
+TAR_FILE=$REPO-$(date +%F).tar
+
+MIRRORS_DIR=/var/www/html/mirrors/nexus.onap.org
+REPO_DIR=$MIRRORS_DIR/$REPO
+mkdir -p $REPO_DIR
+cd $REPO_DIR
+
+wget -nv --mirror --random-wait --no-if-modified-since --no-parent -e robots=off --reject "index.html*" -nH --cut-dirs=3 "https://nexus.onap.org/content/repositories/$REPO/" -o /dev/stdout | sed -u "s|URL:https://nexus.onap.org/content/repositories/$REPO/||g" | sed -u 's| ->.*||g' > $LOG_FILE
+
+cd $MIRRORS_DIR
+tar cvf $TAR_FILE.part $REPO/
+mv -b $TAR_FILE.part $TAR_FILE