46 lines
959 B
Bash
Executable File
46 lines
959 B
Bash
Executable File
#!/bin/bash
|
|
set -x
|
|
|
|
THISDIR="$(cd $(dirname "$BASH_SOURCE") && pwd -P)"
|
|
DST="/var/mirror"
|
|
|
|
echo "$THIS_MIRROR_URL" > $DST/mirrors.txt
|
|
chmod a+r $DST/mirrors.txt
|
|
|
|
mkdir -p "$DST/ubuntu"
|
|
|
|
export GNUPGHOME="/etc/debmirror/ubuntu"
|
|
|
|
SOURCEOPT="--nosource"
|
|
if [[ "$UBUNTU_ENABLE_SOURCE_MIRRORING" != "false" ]]; then
|
|
SOURCEOPT="--source"
|
|
fi
|
|
|
|
DONE=0
|
|
|
|
DIDIST="$(
|
|
echo "$UBUNTU_MIRROR_PROJECTS" | tr "," "\n" | grep -v "\-" | tr "\n" ","
|
|
)"
|
|
|
|
while [[ $DONE -eq 0 ]]; do
|
|
debmirror \
|
|
-a ${UBUNTU_MIRROR_ARCHITECTURES} \
|
|
-s ${UBUNTU_MIRROR_CATEGORIES} \
|
|
-h ${UBUNTU_MIRROR_UPSTREAM} \
|
|
-d ${UBUNTU_MIRROR_PROJECTS} \
|
|
$SOURCEOPT \
|
|
--di-dist="$DIDIST" \
|
|
--di-arch=arches \
|
|
--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
|