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.

56 lines
1.0 KiB

  1. #!/bin/sh
  2. set -e
  3. . /usr/share/debconf/confmodule
  4. db_capb backup
  5. gendir=/usr/lib/apt-setup/generators
  6. if [ "$1" ]; then
  7. ROOT="$1"
  8. chroot=chroot
  9. else
  10. ROOT=
  11. chroot=
  12. fi
  13. export ROOT
  14. log() {
  15. logger -t apt-setup "$@"
  16. }
  17. warning() {
  18. log "warning: $@"
  19. }
  20. gencount=`ls "$gendir"/* | wc -l`
  21. db_progress START 0 $gencount apt-setup/progress/title
  22. for generator in $gendir/*; do
  23. base=$(basename $generator | sed 's/[0-9]*//')
  24. if ! db_progress INFO apt-setup/progress/$base; then
  25. db_subst apt-setup/progress/fallback SCRIPT "$base"
  26. db_progress INFO apt-setup/progress/fallback
  27. fi
  28. tmp=$($chroot tempfile)
  29. echo > $tmp
  30. if $generator $tmp; then
  31. :
  32. if ! apt-setup-verify $tmp $ROOT/etc/apt/sources.list; then
  33. warning "$generator output did not verify"
  34. fi
  35. else
  36. code="$?"
  37. if [ "$code" = 10 ]; then
  38. # TODO handle backup better
  39. log "$generator backed up"
  40. exit 10
  41. fi
  42. warning "$generator returned error code $code; discarding output"
  43. fi
  44. rm -f $tmp
  45. db_progress STEP 1
  46. done
  47. db_progress STOP