check for /srv/mirror/debian, use ${DEBIAN_RELEASE} for mirror test

Building the offline mirror on request is slow and we don't
use it anymore since we provide the mirror on the ISO itself,
so instead test for /srv/mirror/debian only.

While at it don't hardcode "squeeze" in the mirror test but
instead use ${DEBIAN_RELEASE}.

From: Michael Prokop <mprokop@sipwise.com>
ksolomko/vlan
Michael Prokop 14 years ago
parent cfd7d6324d
commit d569b4ee57

@ -680,41 +680,20 @@ EOF
fi fi
# provide Debian mirror # provide Debian mirror
if [ -d /srv/mirror/debs ] && $USE_LOCAL_MIRROR ; then if [ -d /srv/mirror/debian ] && $USE_LOCAL_MIRROR ; then
echo "Debian directory /srv/mirror/debs found." echo "Directory /srv/mirror/debian found, trying to use local mirror."
cd /srv/mirror/
if ! [ -d /srv/mirror/debian ] ; then
echo "Setting up configuration for reprepro."
mkdir -p /srv/mirror/debian/conf/
cat > /srv/mirror/debian/conf/distributions << EOF
Origin: Debian
Label: Debian
Suite: stable
Version: 6.0
Codename: squeeze
Architectures: amd64 source
Components: main contrib non-free
Description: Debian Mirror
Log: logfile
EOF
echo "Building local Debian mirror based on packages found in /srv/mirror/debs."
for f in /srv/mirror/debs/*deb ; do
reprepro --silent -b /srv/mirror/debian includedeb squeeze "$f"
done
fi
# run local webserver # run local webserver
if ps aux | grep -q '[p]ython -m SimpleHTTPServer' ; then if ps aux | grep -q '[p]ython -m SimpleHTTPServer' ; then
kill $(ps aux | grep '[p]ython -m SimpleHTTPServer' | awk '{print $2}') kill $(ps aux | grep '[p]ython -m SimpleHTTPServer' | awk '{print $2}')
fi fi
python -m SimpleHTTPServer &>/dev/null & { cd /srv/mirror/ ; python -m SimpleHTTPServer &>/dev/null & }
# make sure the mirror is ready before accessing it (fsck you, CDs!), # make sure the mirror is ready before accessing it (fsck you, CDs!),
# so retry it up to 30 seconds # so retry it up to 30 seconds
mirror_tries=1 mirror_tries=1
while [ "$mirror_tries" -lt 11 -a "$LOCAL_MIRROR" != "true" ] ; do while [ "$mirror_tries" -lt 11 -a "$LOCAL_MIRROR" != "true" ] ; do
if wget -O /dev/null http://localhost:8000/debian/dists/squeeze/main/binary-amd64/Packages &>/dev/null ; then if wget -O /dev/null http://localhost:8000/debian/dists/${DEBIAN_RELEASE}/main/binary-amd64/Packages &>/dev/null ; then
echo "Found functional local mirror, using for first stage installation." echo "Found functional local mirror, using for first stage installation."
MIRROR="http://localhost:8000/debian/" MIRROR="http://localhost:8000/debian/"
LOCAL_MIRROR=true LOCAL_MIRROR=true
@ -724,7 +703,6 @@ EOF
sleep 3 sleep 3
fi fi
done done
fi fi
if [ -z "$MIRROR" ] ; then if [ -z "$MIRROR" ] ; then

Loading…
Cancel
Save