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

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