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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 "Ign:1 file:$APTARCHIVE unstable InRelease
  18. File not found
  19. Err:2 file:$APTARCHIVE unstable Release
  20. File not found
  21. W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository.
  22. E: Use --allow-insecure-repositories to force the update" aptget update --no-allow-insecure-repositories
  23. # no package foo
  24. testsuccessequal 'Listing...' apt list foo
  25. testequal 'lock
  26. partial' ls rootdir/var/lib/apt/lists
  27. filesize() {
  28. stat -c%s "$(aptget files --no-release-info --format '$(URI)' "Created-By: $1" | cut -d'/' -f 3- ).gz"
  29. }
  30. # allow override
  31. testwarningequal "Ign:1 file:$APTARCHIVE unstable InRelease
  32. File not found
  33. Ign:2 file:$APTARCHIVE unstable Release
  34. File not found
  35. Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
  36. Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages') B]
  37. Get:5 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
  38. Reading package lists...
  39. 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
  40. # ensure we can not install the package
  41. testfailureequal "WARNING: The following packages cannot be authenticated!
  42. foo
  43. E: There are problems and -y was used without --force-yes" aptget install -qq -y foo