test-apt-get-update-unauth-warning 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh
  2. #
  3. # ensure we print warnings for unauthenticated repositories
  4. #
  5. set -e
  6. TESTDIR=$(readlink -f $(dirname $0))
  7. . $TESTDIR/framework
  8. setupenvironment
  9. configarchitecture "i386"
  10. configcompression '.' 'gz'
  11. # a "normal" package with source and binary
  12. buildsimplenativepackage 'foo' 'all' '2.0'
  13. setupaptarchive --no-update
  14. APTARCHIVE="$(readlink -f ./aptarchive)"
  15. find "$APTARCHIVE/dists/unstable" -name '*Release*' -delete
  16. # update without authenticated files leads to warning
  17. testfailureequal "Get:1 file:$APTARCHIVE unstable InRelease
  18. Ign:1 file:$APTARCHIVE unstable InRelease
  19. File not found
  20. Get:2 file:$APTARCHIVE unstable Release
  21. Err:2 file:$APTARCHIVE unstable Release
  22. File not found
  23. Reading package lists...
  24. E: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
  25. N: Updating such a repository securily is impossible and therefore disabled by default.
  26. N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --no-allow-insecure-repositories -q=0
  27. # no package foo
  28. testsuccessequal 'Listing...' apt list foo
  29. testequal 'lock
  30. partial' ls rootdir/var/lib/apt/lists
  31. filesize() {
  32. stat -c%s "$(aptget indextargets --no-release-info --format '$(URI)' "Created-By: $1" | cut -d'/' -f 3- ).gz"
  33. }
  34. # allow override
  35. #aptget update --allow-insecure-repositories -o Debug::pkgAcquire::worker=1
  36. #exit
  37. testwarningequal "Get:1 file:$APTARCHIVE unstable InRelease
  38. Ign:1 file:$APTARCHIVE unstable InRelease
  39. File not found
  40. Get:2 file:$APTARCHIVE unstable Release
  41. Ign:2 file:$APTARCHIVE unstable Release
  42. File not found
  43. Get:3 file:$APTARCHIVE unstable/main Sources
  44. Ign:3 file:$APTARCHIVE unstable/main Sources
  45. File not found
  46. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  47. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  48. File not found
  49. Get:5 file:$APTARCHIVE unstable/main Translation-en
  50. Ign:5 file:$APTARCHIVE unstable/main Translation-en
  51. File not found
  52. Get:3 file:$APTARCHIVE unstable/main Sources
  53. Ign:3 file:$APTARCHIVE unstable/main Sources
  54. File not found
  55. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  56. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  57. File not found
  58. Get:5 file:$APTARCHIVE unstable/main Translation-en
  59. Ign:5 file:$APTARCHIVE unstable/main Translation-en
  60. File not found
  61. Get:3 file:$APTARCHIVE unstable/main Sources
  62. Ign:3 file:$APTARCHIVE unstable/main Sources
  63. File not found
  64. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  65. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  66. File not found
  67. Get:5 file:$APTARCHIVE unstable/main Translation-en
  68. Ign:5 file:$APTARCHIVE unstable/main Translation-en
  69. File not found
  70. Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
  71. Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages') B]
  72. Get:5 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
  73. Reading package lists...
  74. W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
  75. N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
  76. N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --allow-insecure-repositories -q=0
  77. # ensure we can not install the package
  78. testfailureequal "WARNING: The following packages cannot be authenticated!
  79. foo
  80. E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo