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.

51 lines
1.2 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.new; then
  15. dists="$dists $dist"
  16. fi
  17. done
  18. # mirror/suite is also set by cdrom methods
  19. db_get mirror/suite
  20. suite="$RET"
  21. # No updates for unstable. Never mind.
  22. if [ "$suite" = unstable ]; then
  23. exit
  24. fi
  25. # FIXME what if choose-mirror isn't available, i.e. full CD install?
  26. db_fget mirror/http/proxy seen || true
  27. proxy="$RET"
  28. if [ -n "$proxy" ]; then
  29. if ! grep -iq "Acquire::$protocol::Proxy" $ROOT/etc/apt/apt.conf.new; then
  30. echo "Acquire::$protocol::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf.new
  31. fi
  32. fi
  33. echo "deb http://$host/ $suite/updates $dists" >> $file
  34. if ! apt-setup-verify $file; then
  35. db_subst apt-setup/security-updates-failed SECURITY_HOST "$host"
  36. db_input critical apt-setup/security-updates-failed || true
  37. if ! db_go; then
  38. exit 10 # back up
  39. fi
  40. fi
  41. echo "deb-src http://$host/ $suite/updates $dists" >> $file