home *** CD-ROM | disk | FTP | other *** search
- #!/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"
-
- # Don't ask this for Ubuntu.
- #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
-