You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.0 KiB

#!/bin/sh
set -e
. /usr/share/debconf/confmodule
file="$1"
db_get apt-setup/security_host
host="$RET"
if [ -z "$host" ]; then
exit
fi
# To determine if non-free and contrib should be included, grep
# the file to see if they are listed in it.
dists="main"
for dist in contrib non-free; do
if grep -q '^[^#]*'$dist $ROOT/etc/apt/sources.list; then
dists="$dists $dist"
fi
done
# mirro/suite is also set by cdrom methods
db_get mirror/suite
suite="$RET"
# FIXME what if choose-mirror isn't avalable, ie full CD install?
db_fget mirror/http/proxy seen || true
proxy="$RET"
if [ -n "$proxy" ]; then
if ! grep -iq "Acquire::$procotol::Proxy" $ROOT/etc/apt/apt.conf; then
echo "Acquire::$protocol::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf
fi
fi
echo "deb http://$host/ $suite/updates $dists" >> $file
if ! apt-setup-verify; then
db_sust apt-setup/security-updates-failed SECURITY_HOST "$host"
db_input critical apt-setup/security-updates-failed || true
if ! db_go; then
exit 10 # back up
fi
fi
echo "deb-src http://$host/ $suite/updates $dists" >> $file