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.
 
 
 
 
 
 

40 lines
1.2 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'native'
  7. echo 'Dir::Bin::Editor "cat";' > rootdir/etc/apt/apt.conf.d/editor.conf
  8. echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list.d/rocks.list
  9. testsuccessequal "$(cat rootdir/etc/apt/sources.list.d/rocks.list)" apt edit-sources rocks.list
  10. cat >editor.sh <<EOF
  11. #!/bin/sh
  12. umask 077
  13. touch "\$@"
  14. EOF
  15. chmod +x ./editor.sh
  16. echo 'Dir::Bin::Editor "./editor.sh";' > rootdir/etc/apt/apt.conf.d/editor.conf
  17. testsuccess apt edit-sources blub.list
  18. testfailure test -e 'rootdir/etc/apt/sources.list.d/blub.list'
  19. cat >editor.sh <<EOF
  20. #!/bin/sh
  21. umask 077
  22. echo '#comment' > "\$1"
  23. EOF
  24. testsuccess apt edit-sources blub.list
  25. testfilestats 'rootdir/etc/apt/sources.list.d/blub.list' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
  26. echo 'Dir::Bin::Editor "cat";' > rootdir/etc/apt/apt.conf.d/editor.conf
  27. echo 'blub' > rootdir/etc/apt/sources.list.d/blub.list
  28. testfailure apt edit-sources blub.list --assume-no
  29. echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list.d/blub.list
  30. touch -m -d 'now + 1 hour' rootdir/etc/apt/sources.list.d/blub.list
  31. testwarning apt edit-sources blub.list --assume-no