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 75 76 77
|
#!/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
# Let's not wait until stable r0 before enabling -updates! (#991947)
updates=y
if [ "$suite" != stable ] && [ "$suite" != oldstable ] && [ "$suite" != testing ]; then
disable_service updates || true
updates=n
fi
db_get apt-setup/security_host
db_subst apt-setup/services-select SEC_HOST "$RET"
db_input medium apt-setup/services-select || true
if ! db_go; then
exit 10 # back up
fi
# Selecting release updates for testing is invalid
if [ "$updates" = n ] && disable_service updates; then
logger -t apt-setup "info: invalid selection of release updates disabled for testing"
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 all services
case $protocol in
http|https)
if db_get mirror/$protocol/proxy && [ -n "$RET" ]; then
proxy="$RET"
if ! grep -iq "Acquire::$protocol::Proxy" $ROOT/etc/apt/apt.conf.new; then
echo "Acquire::$protocol::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf.new
fi
fi
;;
esac
|