-
Notifications
You must be signed in to change notification settings - Fork 2
/
mirror-oracle-repo
executable file
·51 lines (39 loc) · 1.1 KB
/
mirror-oracle-repo
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# Mirrors the ORACLE Shit repos. Meant to be run daily.
#
# -- [email protected] Wed Sep 25 21:54:10 CEST 2019
#
source $(dirname $(realpath $0))/.config.oracle.subr
create_lock
mirror_repo() {
REPO="$1"
echo
echo "--------------------------------------------------------------"
echo "`date` - ORACLE $REPO mirror started"
mkdir -p $MIRROR_DIR/$REPO
# Create stupid symlink as ORACLE dictates it and we don't like it.
ln -s . $MIRROR_DIR/$REPO/getPackage
echo "Syncing packages..."
reposync --newest-only --quiet --gpgcheck --repoid=$REPO --download_path=$MIRROR_DIR
rm -f $MIRROR_DIR/$REPO/getPackage
echo "Creating repo metadata..."
createrepo $MIRROR_DIR/$REPO
echo "Regenerating .repo file..."
cat <<EOF > $MIRROR_DIR/${REPO}.repo
[$REPO]
name=ORACLE repository $REPO
baseurl=$MIRROR_URL/$REPO
gpgcheck=1
gpgkey=$MIRROR_URL/$GPG_KEY
enabled=1
autorefresh=1
type=rpm-md
EOF
echo "`date` - ORACLE $REPO mirror completed"
echo "--------------------------------------------------------------"
echo
}
# Mirror repos
for repo in $ORACLE_REPOS; do
mirror_repo $repo
done