test-bug-596498-trusted-unsigned-repo 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'i386'
  7. buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable'
  8. setupaptarchive
  9. aptgetupdate() {
  10. rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin
  11. ${1:-testwarning} aptget update --allow-insecure-repositories
  12. }
  13. PKGTEXT="$(aptget install cool --assume-no -d | head -n 8)"
  14. DOWNLOG="$(echo "$PKGTEXT" | tail -n 1)"
  15. PKGTEXT="$(echo "$PKGTEXT" | head -n 7)"
  16. DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-*.list'
  17. testsuccessequal "$PKGTEXT
  18. $DOWNLOG
  19. Download complete and in download only mode" aptget install cool --assume-no -d
  20. testsuccessequal "$PKGTEXT
  21. $DOWNLOG
  22. Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
  23. sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=no] #' $DEBFILE
  24. aptgetupdate 'testsuccess'
  25. testfailureequal "$PKGTEXT
  26. WARNING: The following packages cannot be authenticated!
  27. cool
  28. Install these packages without verification? [y/N] N
  29. E: Some packages could not be authenticated" aptget install cool --assume-no -d
  30. configarchitecture 'amd64' 'i386'
  31. testequal "$(echo "$PKGTEXT" | sed 's#cool$#cool:i386#g')
  32. WARNING: The following packages cannot be authenticated!
  33. cool:i386
  34. Authentication warning overridden.
  35. $DOWNLOG
  36. Download complete and in download only mode" aptget install cool:i386 --assume-no -d --allow-unauthenticated
  37. configarchitecture 'i386'
  38. find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
  39. sed -i -e 's#\(deb\(-src\)\?\) \[trusted=no\] #\1 #' $DEBFILE
  40. aptgetupdate
  41. testfailureequal "$PKGTEXT
  42. WARNING: The following packages cannot be authenticated!
  43. cool
  44. Install these packages without verification? [y/N] N
  45. E: Some packages could not be authenticated" aptget install cool --assume-no -d
  46. testsuccessequal "$PKGTEXT
  47. WARNING: The following packages cannot be authenticated!
  48. cool
  49. Authentication warning overridden.
  50. $DOWNLOG
  51. Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
  52. sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=yes] #' $DEBFILE
  53. aptgetupdate
  54. testsuccessequal "$PKGTEXT
  55. $DOWNLOG
  56. Download complete and in download only mode" aptget install cool --assume-no -d