home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / ubiquity / apt-setup / generators / 90services-select < prev    next >
Encoding:
Text File  |  2009-03-20  |  1.9 KB  |  76 lines

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