blob: 94efaa10ff08cac10f8365b6e6d620e08f21f1f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
|