2016-04-08 20:41:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -x
|
|
|
|
|
|
|
|
THISDIR="$(cd $(dirname "$BASH_SOURCE") && pwd -P)"
|
|
|
|
DST="/var/mirror"
|
|
|
|
|
2020-02-15 17:55:25 +00:00
|
|
|
echo "$THIS_MIRROR_URL" > $DST/mirrors.txt
|
2016-04-11 02:36:47 +00:00
|
|
|
chmod a+r $DST/mirrors.txt
|
|
|
|
|
2016-04-09 14:18:35 +00:00
|
|
|
mkdir -p "$DST/ubuntu"
|
|
|
|
|
2016-04-08 21:24:53 +00:00
|
|
|
export GNUPGHOME="/etc/debmirror/ubuntu"
|
|
|
|
|
2020-02-15 17:55:25 +00:00
|
|
|
SOURCEOPT="--nosource"
|
2020-02-15 18:29:22 +00:00
|
|
|
if [[ "$UBUNTU_ENABLE_SOURCE_MIRRORING" != "false" ]]; then
|
2020-02-15 17:55:25 +00:00
|
|
|
SOURCEOPT="--source"
|
|
|
|
fi
|
|
|
|
|
2020-02-16 14:05:16 +00:00
|
|
|
DONE=0
|
2016-04-08 20:41:48 +00:00
|
|
|
|
2020-02-16 16:11:34 +00:00
|
|
|
DIDIST="$(
|
|
|
|
echo "$UBUNTU_MIRROR_PROJECTS" | tr "," "\n" | grep -v "\-" | tr "\n" ","
|
|
|
|
)"
|
|
|
|
|
2020-02-16 14:05:16 +00:00
|
|
|
while [[ $DONE -eq 0 ]]; do
|
|
|
|
debmirror \
|
|
|
|
-a ${UBUNTU_MIRROR_ARCHITECTURES} \
|
|
|
|
-s ${UBUNTU_MIRROR_CATEGORIES} \
|
|
|
|
-h ${UBUNTU_MIRROR_UPSTREAM} \
|
|
|
|
-d ${UBUNTU_MIRROR_PROJECTS} \
|
|
|
|
$SOURCEOPT \
|
2020-02-16 16:11:34 +00:00
|
|
|
--di-dist="$DIDIST" \
|
2020-02-16 16:01:45 +00:00
|
|
|
--di-arch=arches \
|
2020-02-16 14:05:16 +00:00
|
|
|
--ignore-small-errors \
|
|
|
|
-r /ubuntu \
|
|
|
|
--getcontents \
|
|
|
|
--progress \
|
|
|
|
--method=http \
|
|
|
|
$DST/ubuntu
|
|
|
|
if [[ $? -eq 0 ]]; then
|
|
|
|
DONE=1
|
|
|
|
fi
|
|
|
|
chmod -R a+rX $DST
|
|
|
|
sleep 1
|
|
|
|
done
|