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.
 
 
 
 
 
 

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