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 49 50 51 52 53 54 55 56 57
|
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
file="$1"
db_get apt-setup/services-select
if ! echo "$RET" | grep -q security; then
exit
fi
db_get apt-setup/security_host
host="$RET"
[ "$host" ] || exit
if ! db_get mirror/codename || [ -z "$RET" ]; then
db_get cdrom/codename
fi
codename="$RET"
# 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.new; then
dists="$dists $dist"
fi
done
# Don't test mirror if no network selected in netcfg
echo "deb http://$host/debian-security $codename/updates $dists" >> $file
if db_get netcfg/dhcp_options && \
[ "$RET" = "Do not configure the network at this time" ]; then
CODE=9
else
CODE=0
export ASV_TIMEOUT="-o Acquire::http::Timeout=30"
if ! apt-setup-verify --from $PROGRESS_FROM --to $PROGRESS_TO $file; then
db_subst apt-setup/service-failed HOST "$host"
db_input critical apt-setup/service-failed || true
if ! db_go; then
exit 10 # back up
fi
CODE=9
fi
fi
deb_src="deb-src"
db_get apt-setup/enable-source-repositories
if [ "$RET" = false ]; then
deb_src="# deb-src"
fi
echo "$deb_src http://$host/debian-security $codename/updates $dists" >> $file
exit $CODE
|