You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

95 lines
4.0 KiB

  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. echo 'Acquire::Progress::Ignore::ShowErrorText "false";' > rootdir/etc/apt/apt.conf.d/99show-no-ignore-errors.conf
  12. # a "normal" package with source and binary
  13. buildsimplenativepackage 'foo' 'all' '2.0'
  14. setupaptarchive --no-update
  15. APTARCHIVE="$(readlink -f ./aptarchive)"
  16. find "$APTARCHIVE/dists/unstable" \( -name 'InRelease' -o -name 'Release.gpg' \) -delete
  17. sed -i -n '/^SHA1:$/q;p' "${APTARCHIVE}/dists/unstable/Release"
  18. testfailure aptget update
  19. testwarning aptget update --allow-insecure-repositories
  20. rm -rf rootdir/var/lib/apt/lists
  21. find "$APTARCHIVE/dists/unstable" -name '*Release*' -delete
  22. # update without authenticated files leads to warning
  23. testfailureequal "Get:1 file:$APTARCHIVE unstable InRelease
  24. Ign:1 file:$APTARCHIVE unstable InRelease
  25. Get:2 file:$APTARCHIVE unstable Release
  26. Err:2 file:$APTARCHIVE unstable Release
  27. File not found - ${APTARCHIVE}/dists/unstable/Release (2: No such file or directory)
  28. Reading package lists...
  29. E: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
  30. N: Updating from such a repository can't be done securely, and is therefore disabled by default.
  31. N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update
  32. # no package foo
  33. testsuccessequal 'Listing...' apt list foo
  34. testequal 'auxfiles
  35. lock
  36. partial' ls rootdir/var/lib/apt/lists
  37. filesize() {
  38. local CREATEDBY="$1"
  39. shift
  40. stat -c%s "$(aptget indextargets --no-release-info --format '$(URI)' "Created-By: $CREATEDBY" "$@" | cut -d'/' -f 3- ).gz"
  41. }
  42. # allow override
  43. #aptget update --allow-insecure-repositories -o Debug::pkgAcquire::worker=1
  44. #exit
  45. testwarningequal "Get:1 file:$APTARCHIVE unstable InRelease
  46. Ign:1 file:$APTARCHIVE unstable InRelease
  47. Get:2 file:$APTARCHIVE unstable Release
  48. Ign:2 file:$APTARCHIVE unstable Release
  49. Get:3 file:$APTARCHIVE unstable/main Sources
  50. Ign:3 file:$APTARCHIVE unstable/main Sources
  51. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  52. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  53. Get:5 file:$APTARCHIVE unstable/main all Packages
  54. Ign:5 file:$APTARCHIVE unstable/main all Packages
  55. Get:6 file:$APTARCHIVE unstable/main Translation-en
  56. Ign:6 file:$APTARCHIVE unstable/main Translation-en
  57. Get:3 file:$APTARCHIVE unstable/main Sources
  58. Ign:3 file:$APTARCHIVE unstable/main Sources
  59. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  60. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  61. Get:5 file:$APTARCHIVE unstable/main all Packages
  62. Ign:5 file:$APTARCHIVE unstable/main all Packages
  63. Get:6 file:$APTARCHIVE unstable/main Translation-en
  64. Ign:6 file:$APTARCHIVE unstable/main Translation-en
  65. Get:3 file:$APTARCHIVE unstable/main Sources
  66. Ign:3 file:$APTARCHIVE unstable/main Sources
  67. Get:4 file:$APTARCHIVE unstable/main i386 Packages
  68. Ign:4 file:$APTARCHIVE unstable/main i386 Packages
  69. Get:5 file:$APTARCHIVE unstable/main all Packages
  70. Ign:5 file:$APTARCHIVE unstable/main all Packages
  71. Get:6 file:$APTARCHIVE unstable/main Translation-en
  72. Ign:6 file:$APTARCHIVE unstable/main Translation-en
  73. Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
  74. Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages' 'Architecture: i386') B]
  75. Get:5 file:$APTARCHIVE unstable/main all Packages [$(filesize 'Packages' 'Architecture: all') B]
  76. Get:6 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
  77. Reading package lists...
  78. W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
  79. N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
  80. N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --allow-insecure-repositories
  81. # ensure we can not install the package
  82. testfailureequal "WARNING: The following packages cannot be authenticated!
  83. foo
  84. E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo