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.

46 lines
1.0 KiB

  1. #!/bin/sh
  2. set -e
  3. . /usr/share/debconf/confmodule
  4. file="$1"
  5. db_get apt-setup/security_host
  6. host="$RET"
  7. if [ -z "$host" ]; then
  8. exit
  9. fi
  10. # To determine if non-free and contrib should be included, grep
  11. # the file to see if they are listed in it.
  12. dists="main"
  13. for dist in contrib non-free; do
  14. if grep -q '^[^#]*'$dist $ROOT/etc/apt/sources.list; then
  15. dists="$dists $dist"
  16. fi
  17. done
  18. # mirro/suite is also set by cdrom methods
  19. db_get mirror/suite
  20. suite="$RET"
  21. # FIXME what if choose-mirror isn't avalable, ie full CD install?
  22. db_fget mirror/http/proxy seen || true
  23. proxy="$RET"
  24. if [ -n "$proxy" ]; then
  25. if ! grep -iq "Acquire::$procotol::Proxy" $ROOT/etc/apt/apt.conf; then
  26. echo "Acquire::$protocol::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf
  27. fi
  28. fi
  29. echo "deb http://$host/ $suite/updates $dists" >> $file
  30. if ! apt-setup-verify; then
  31. db_sust apt-setup/security-updates-failed SECURITY_HOST "$host"
  32. db_input critical apt-setup/security-updates-failed || true
  33. if ! db_go; then
  34. exit 10 # back up
  35. fi
  36. fi
  37. echo "deb-src http://$host/ $suite/updates $dists" >> $file