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.

75 lines
1.9 KiB

  1. #!/bin/sh
  2. set -e
  3. # The default in the template is to have all services enabled. Here, we
  4. # disable services that are not available before the question is asked.
  5. # This way, it is also possible select which services should be enabled
  6. # using preseeding.
  7. . /usr/share/debconf/confmodule
  8. # Returns 0 if the service was actually removed
  9. disable_service() {
  10. local to_disable="$1"
  11. db_get apt-setup/services-select
  12. local services="$RET"
  13. local new_services s
  14. if echo "$services" | grep -q $to_disable; then
  15. new_services=""
  16. for s in $(echo "$services" | sed "s/,/ /"); do
  17. if [ "$s" != $to_disable ]; then
  18. new_services=${new_services:+$new_services, }$s
  19. fi
  20. done
  21. db_set apt-setup/services-select "$new_services"
  22. return 0
  23. fi
  24. return 1
  25. }
  26. if ! db_get mirror/suite || [ -z "$RET" ]; then
  27. db_get cdrom/suite
  28. fi
  29. suite="$RET"
  30. # No update services available for unstable
  31. if [ "$suite" = unstable ]; then
  32. db_set apt-setup/services-select ""
  33. exit
  34. fi
  35. volatile=y
  36. if [ "$suite" != stable ] && [ "$suite" != oldstable ]; then
  37. disable_service volatile || true
  38. volatile=n
  39. fi
  40. db_get apt-setup/security_host
  41. db_subst apt-setup/services-select SEC_HOST "$RET"
  42. db_get apt-setup/volatile_host
  43. db_subst apt-setup/services-select VOL_HOST "$RET"
  44. db_input medium apt-setup/services-select || true
  45. if ! db_go; then
  46. exit 10 # back up
  47. fi
  48. # Selecting volatile for testing is invalid
  49. if [ "$volatile" = n ] && disable_service volatile; then
  50. logger -t apt-setup "info: invalid selection of volatile for testing disabled"
  51. fi
  52. # No need to set up proxy here if no services were selected
  53. db_get apt-setup/services-select
  54. [ "$RET" ] || exit 0
  55. # Proxy configuration is common to both security and volatile
  56. if db_get mirror/http/proxy && [ -n "$RET" ]; then
  57. proxy="$RET"
  58. if ! grep -iq "Acquire::http::Proxy" $ROOT/etc/apt/apt.conf.new; then
  59. echo "Acquire::http::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf.new
  60. fi
  61. fi