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.

52 lines
1.1 KiB

  1. #!/bin/sh
  2. set -e
  3. . /usr/share/debconf/confmodule
  4. file="$1"
  5. db_get apt-setup/services-select
  6. if ! echo "$RET" | grep -q security; then
  7. exit
  8. fi
  9. db_get apt-setup/security_host
  10. host="$RET"
  11. [ "$host" ] || exit
  12. if ! db_get mirror/codename || [ -z "$RET" ]; then
  13. db_get cdrom/codename
  14. fi
  15. codename="$RET"
  16. # To determine if non-free and contrib should be included, grep
  17. # the file to see if they are listed in it.
  18. dists="main"
  19. for dist in contrib non-free; do
  20. if grep -q '^[^#]* '$dist $ROOT/etc/apt/sources.list.new; then
  21. dists="$dists $dist"
  22. fi
  23. done
  24. # Don't test mirror if no network selected in netcfg
  25. echo "deb http://$host/ $codename/updates $dists" >> $file
  26. if db_get netcfg/dhcp_options && \
  27. [ "$RET" = "Do not configure the network at this time" ]; then
  28. CODE=9
  29. else
  30. CODE=0
  31. export ASV_TIMEOUT="-o Acquire::http::Timeout=30"
  32. if ! apt-setup-verify --from $PROGRESS_FROM --to $PROGRESS_TO $file; then
  33. db_subst apt-setup/service-failed HOST "$host"
  34. db_input critical apt-setup/service-failed || true
  35. if ! db_go; then
  36. exit 10 # back up
  37. fi
  38. CODE=9
  39. fi
  40. fi
  41. echo "deb-src http://$host/ $codename/updates $dists" >> $file
  42. exit $CODE