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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#!/bin/sh
set -e
# The default in the template is to have all services enabled. Here, we
# disable services that are not available before the question is asked.
# This way, it is also possible select which services should be enabled
# using preseeding.
. /usr/share/debconf/confmodule
# Returns 0 if the service was actually removed
disable_service() {
local to_disable="$1"
db_get apt-setup/services-select
local services="$RET"
local new_services s
if echo "$services" | grep -q $to_disable; then
new_services=""
for s in $(echo "$services" | sed "s/,/ /"); do
if [ "$s" != $to_disable ]; then
new_services=${new_services:+$new_services, }$s
fi
done
db_set apt-setup/services-select "$new_services"
return 0
fi
return 1
}
if ! db_get mirror/suite || [ -z "$RET" ]; then
db_get cdrom/suite
fi
suite="$RET"
# No update services available for unstable
if [ "$suite" = unstable ]; then
db_set apt-setup/services-select ""
exit
fi
volatile=y
if [ "$suite" != stable ] && [ "$suite" != oldstable ]; then
disable_service volatile || true
volatile=n
fi
db_get apt-setup/security_host
db_subst apt-setup/services-select SEC_HOST "$RET"
db_get apt-setup/volatile_host
db_subst apt-setup/services-select VOL_HOST "$RET"
db_input medium apt-setup/services-select || true
if ! db_go; then
exit 10 # back up
fi
# Selecting volatile for testing is invalid
if [ "$volatile" = n ] && disable_service volatile; then
logger -t apt-setup "info: invalid selection of volatile for testing disabled"
fi
# No need to set up proxy here if no services were selected
db_get apt-setup/services-select
[ "$RET" ] || exit 0
# Proxy configuration is common to both security and volatile
if db_get mirror/http/proxy && [ -n "$RET" ]; then
proxy="$RET"
if ! grep -iq "Acquire::http::Proxy" $ROOT/etc/apt/apt.conf.new; then
echo "Acquire::http::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf.new
fi
fi
|