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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. local CREATEDBY="$1"
  33. shift
  34. stat -c%s "$(aptget indextargets --no-release-info --format '$(URI)' "Created-By: $CREATEDBY" "$@" | cut -d'/' -f 3- ).gz"
  35. }
  36. # allow override
  37. #aptget update --allow-insecure-repositories -o Debug::pkgAcquire::worker=1
  38. #exit
  39. testwarningequal "Get:1 file:$APTARCHIVE unstable InRelease
  40. Ign:1 file:$APTARCHIVE unstable InRelease
  41. File not found
  42. Get:2 file:$APTARCHIVE unstable Release
  43. Ign:2 file:$APTARCHIVE unstable Release
  44. File not found
  45. Get:3 file:$APTARCHIVE unstable/main Sources
  46. Ign:3 file:$APTARCHIVE unstable/main Sources
  47. File not found
  48. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  49. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  50. File not found
  51. Get:5 file:$APTARCHIVE unstable/main all Packages
  52. Ign:5 file:$APTARCHIVE unstable/main all Packages
  53. File not found
  54. Get:6 file:$APTARCHIVE unstable/main Translation-en
  55. Ign:6 file:$APTARCHIVE unstable/main Translation-en
  56. File not found
  57. Get:3 file:$APTARCHIVE unstable/main Sources
  58. Ign:3 file:$APTARCHIVE unstable/main Sources
  59. File not found
  60. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  61. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  62. File not found
  63. Get:5 file:$APTARCHIVE unstable/main all Packages
  64. Ign:5 file:$APTARCHIVE unstable/main all Packages
  65. File not found
  66. Get:6 file:$APTARCHIVE unstable/main Translation-en
  67. Ign:6 file:$APTARCHIVE unstable/main Translation-en
  68. File not found
  69. Get:3 file:$APTARCHIVE unstable/main Sources
  70. Ign:3 file:$APTARCHIVE unstable/main Sources
  71. File not found
  72. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  73. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  74. File not found
  75. Get:5 file:$APTARCHIVE unstable/main all Packages
  76. Ign:5 file:$APTARCHIVE unstable/main all Packages
  77. File not found
  78. Get:6 file:$APTARCHIVE unstable/main Translation-en
  79. Ign:6 file:$APTARCHIVE unstable/main Translation-en
  80. File not found
  81. Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
  82. Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages' 'Architecture: i386') B]
  83. Get:5 file:$APTARCHIVE unstable/main all Packages [$(filesize 'Packages' 'Architecture: all') B]
  84. Get:6 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
  85. Reading package lists...
  86. W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
  87. N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
  88. N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --allow-insecure-repositories -q=0
  89. # ensure we can not install the package
  90. testfailureequal "WARNING: The following packages cannot be authenticated!
  91. foo
  92. E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo