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.

44 lines
812 B

  1. #!/bin/sh
  2. set -e
  3. . /usr/share/debconf/confmodule
  4. file="$1"
  5. chroot=
  6. if [ "$ROOT" ]; then
  7. chroot=chroot
  8. fi
  9. i=0
  10. while db_get "apt-setup/local$i/repository" && [ "$RET" ]; do
  11. repository="${RET#deb }"
  12. comment=
  13. if db_get "apt-setup/local$i/comment"; then
  14. comment="$RET"
  15. fi
  16. key=
  17. if db_get "apt-setup/local$i/key"; then
  18. key="$RET"
  19. fi
  20. echo >> $file
  21. if [ -n "$comment" ]; then
  22. echo "## $comment" >> $file
  23. fi
  24. echo "deb $repository" >> $file
  25. # if true, add a line for deb-src
  26. if db_get "apt-setup/local$i/source" && [ "$RET" = true ]; then
  27. echo "deb-src $repository" >> $file
  28. fi
  29. if [ -n "$key" ]; then
  30. # fetch the key
  31. fetch-url "$key" "$ROOT/tmp/key$i.pub"
  32. # add it to the keyring
  33. $chroot $ROOT apt-key add "/tmp/key$i.pub"
  34. rm -f "$ROOT/tmp/key$i.pub"
  35. fi
  36. i="$(($i + 1))"
  37. done
  38. exit 0