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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. echo 'Acquire::Progress::Ignore::ShowErrorText "false";' > rootdir/etc/apt/apt.conf.d/99show-no-ignore-errors.conf
  17. # update without authenticated files leads to warning
  18. testfailureequal "Get:1 file:$APTARCHIVE unstable InRelease
  19. Ign:1 file:$APTARCHIVE unstable InRelease
  20. Get:2 file:$APTARCHIVE unstable Release
  21. Err:2 file:$APTARCHIVE unstable Release
  22. File not found - ${APTARCHIVE}/dists/unstable/Release (2: No such file or directory)
  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. Get:2 file:$APTARCHIVE unstable Release
  42. Ign:2 file:$APTARCHIVE unstable Release
  43. Get:3 file:$APTARCHIVE unstable/main Sources
  44. Ign:3 file:$APTARCHIVE unstable/main Sources
  45. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  46. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  47. Get:5 file:$APTARCHIVE unstable/main all Packages
  48. Ign:5 file:$APTARCHIVE unstable/main all Packages
  49. Get:6 file:$APTARCHIVE unstable/main Translation-en
  50. Ign:6 file:$APTARCHIVE unstable/main Translation-en
  51. Get:3 file:$APTARCHIVE unstable/main Sources
  52. Ign:3 file:$APTARCHIVE unstable/main Sources
  53. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  54. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  55. Get:5 file:$APTARCHIVE unstable/main all Packages
  56. Ign:5 file:$APTARCHIVE unstable/main all Packages
  57. Get:6 file:$APTARCHIVE unstable/main Translation-en
  58. Ign:6 file:$APTARCHIVE unstable/main Translation-en
  59. Get:3 file:$APTARCHIVE unstable/main Sources
  60. Ign:3 file:$APTARCHIVE unstable/main Sources
  61. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  62. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  63. Get:5 file:$APTARCHIVE unstable/main all Packages
  64. Ign:5 file:$APTARCHIVE unstable/main all Packages
  65. Get:6 file:$APTARCHIVE unstable/main Translation-en
  66. Ign:6 file:$APTARCHIVE unstable/main Translation-en
  67. Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
  68. Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages' 'Architecture: i386') B]
  69. Get:5 file:$APTARCHIVE unstable/main all Packages [$(filesize 'Packages' 'Architecture: all') B]
  70. Get:6 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
  71. Reading package lists...
  72. W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
  73. N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
  74. N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --allow-insecure-repositories -q=0
  75. # ensure we can not install the package
  76. testfailureequal "WARNING: The following packages cannot be authenticated!
  77. foo
  78. E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo