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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. rm -f $APTARCHIVE/dists/unstable/*Release*
  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. W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository.
  25. E: Use --allow-insecure-repositories to force the update" aptget update --no-allow-insecure-repositories
  26. # no package foo
  27. testsuccessequal 'Listing...' apt list foo
  28. testequal 'lock
  29. partial' ls rootdir/var/lib/apt/lists
  30. filesize() {
  31. stat -c%s "$(aptget indextargets --no-release-info --format '$(URI)' "Created-By: $1" | cut -d'/' -f 3- ).gz"
  32. }
  33. # allow override
  34. #aptget update --allow-insecure-repositories -o Debug::pkgAcquire::worker=1
  35. #exit
  36. testwarningequal "Get:1 file:$APTARCHIVE unstable InRelease
  37. Ign:1 file:$APTARCHIVE unstable InRelease
  38. File not found
  39. Get:2 file:$APTARCHIVE unstable Release
  40. Ign:2 file:$APTARCHIVE unstable Release
  41. File not found
  42. Get:3 file:$APTARCHIVE unstable/main Sources
  43. Ign:3 file:$APTARCHIVE unstable/main Sources
  44. File not found
  45. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  46. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  47. File not found
  48. Get:5 file:$APTARCHIVE unstable/main Translation-en
  49. Ign:5 file:$APTARCHIVE unstable/main Translation-en
  50. File not found
  51. Get:3 file:$APTARCHIVE unstable/main Sources
  52. Ign:3 file:$APTARCHIVE unstable/main Sources
  53. File not found
  54. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  55. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  56. File not found
  57. Get:5 file:$APTARCHIVE unstable/main Translation-en
  58. Ign:5 file:$APTARCHIVE unstable/main Translation-en
  59. File not found
  60. Get:3 file:$APTARCHIVE unstable/main Sources
  61. Ign:3 file:$APTARCHIVE unstable/main Sources
  62. File not found
  63. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  64. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  65. File not found
  66. Get:5 file:$APTARCHIVE unstable/main Translation-en
  67. Ign:5 file:$APTARCHIVE unstable/main Translation-en
  68. File not found
  69. Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
  70. Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages') B]
  71. Get:5 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
  72. Reading package lists...
  73. W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." aptget update --allow-insecure-repositories
  74. # ensure we can not install the package
  75. testfailureequal "WARNING: The following packages cannot be authenticated!
  76. foo
  77. E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo