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.

78 lines
1.5 KiB

  1. #!/bin/sh
  2. set -e
  3. . /usr/share/debconf/confmodule
  4. file="$1"
  5. STATE=1
  6. while true; do
  7. case "$STATE" in
  8. 1)
  9. db_input low apt-setup/non-free || true
  10. ;;
  11. 2)
  12. # If they chose not use non-free, ask about
  13. # contrib, with a default of no. If they chose to
  14. # use non-free, they get contrib too..
  15. db_get apt-setup/non-free
  16. if [ "$RET" = false ]; then
  17. db_fget apt-setup/contrib seen
  18. if [ "$RET" = false ]; then
  19. db_set apt-setup/contrib false
  20. fi
  21. db_input low apt-setup/contrib || true
  22. else
  23. db_fget apt-setup/contrib seen
  24. if [ "$RET" = false ]; then
  25. db_set apt-setup/contrib true
  26. fi
  27. fi
  28. ;;
  29. *)
  30. break
  31. ;;
  32. esac
  33. if db_go; then
  34. STATE=$(($STATE + 1))
  35. else
  36. STATE=$(($STATE - 1))
  37. fi
  38. done
  39. if [ $STATE -eq 0 ]; then
  40. exit 10
  41. fi
  42. dists="main"
  43. db_get apt-setup/non-free
  44. if [ "$ret" = true ]; then
  45. dists="$dists non-free"
  46. fi
  47. db_get apt-setup/contrib
  48. if [ "$ret" = true ]; then
  49. dists="$dists contrib"
  50. fi
  51. db_get mirror/suite
  52. suite="$RET"
  53. db_get mirror/protocol
  54. protocol="$RET"
  55. db_get mirror/$protocol/hostname
  56. hostname="$RET"
  57. db_get mirror/$protocol/directory
  58. directory="$RET"
  59. if [ "$protocol" = http ]; then
  60. db_get mirror/$protocol/proxy
  61. proxy="$RET"
  62. if [ -n "$proxy" ]; then
  63. if ! grep -iq "Acquire::$protocol::Proxy" $ROOT/etc/apt/apt.conf.new; then
  64. echo "Acquire::$protocol::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf.new
  65. fi
  66. fi
  67. fi
  68. echo "deb $protocol://$hostname/$directory $suite $dists" >> $file
  69. echo "deb-src $protocol://$hostname/$directory $suite $dists" >> $file