blob: 94efaa10ff08cac10f8365b6e6d620e08f21f1f8 [file] [log] [blame]
Brian Freeman48d30542019-08-20 13:13:58 -05001#!/bin/bash
2
3
4if [ "$#" -ne 1 ]; then
5 echo "$0 <repo>"
6 echo " where <repo> is releases or staging"
7 exit 1
8fi
9
10set -x
11REPO=$1
12
13LOG_DIR=/var/www/html/logs/mirror-nexus/$REPO/
14mkdir -p $LOG_DIR
15
16LOG_FILE=$LOG_DIR/$(date +%FT%TZ).log
17TAR_FILE=$REPO-$(date +%F).tar
18
19MIRRORS_DIR=/var/www/html/mirrors/nexus.onap.org
20REPO_DIR=$MIRRORS_DIR/$REPO
21mkdir -p $REPO_DIR
22cd $REPO_DIR
23
24wget -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
25
26cd $MIRRORS_DIR
27tar cvf $TAR_FILE.part $REPO/
28mv -b $TAR_FILE.part $TAR_FILE