-
Notifications
You must be signed in to change notification settings - Fork 1
/
updateinfo_mirror.sh
executable file
·48 lines (40 loc) · 1.24 KB
/
updateinfo_mirror.sh
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
#!/bin/bash
# Change these settings
USERNAME=""
PASSWORD=""
# No changes after this point
BASEURL="https://updateinfo.cefs.steve-meier.de/"
DIRS=( "7/updates/x86_64" )
WGETOPTS="-N -T 30 -q"
# Rewrite %40 to @, if necessary
USERNAME=${USERNAME/'%40'/@}
# Check that username and password are set
if [[ -z "${USERNAME}" || -z "${PASSWORD}" ]]; then
echo "ERROR: Please sign up via Patreon to receive a username and password"
exit 2
fi
# Check for that destination is an existing directory
if [ ! -d "${1}" ]; then
echo "ERROR: Please specify a destination directory"
exit 1
fi
# Iterate through all supported versions and archs
cd ${1}
for DIR in "${DIRS[@]}"
do
# Create the repodata/ subdirectory
if [ ! -d ${DIR}/repodata ]; then
mkdir -p ${DIR}/repodata
fi
# Get the repomd.xml which contains the index
wget ${WGETOPTS} -P ${1}/${DIR}/repodata ${BASEURL}${DIR}/repodata/repomd.xml
# Extract the other filenames from repomd.xm and fetch them
for REPOFILE in $(grep href ${1}/${DIR}/repodata/repomd.xml | cut -d \" -f 2)
do
wget ${WGETOPTS} --user ${USERNAME} --password ${PASSWORD} -P ${1}/${DIR}/repodata ${BASEURL}${DIR}/${REPOFILE}
if [ $? -eq 6 ]; then
echo "ERROR: Your username/password are incorrect"
exit 2
fi
done
done