test-kernel-helper-autoremove 756 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. set -e
  3. # setup testdir
  4. TESTDIR=$(readlink -f $(dirname $0))
  5. . $TESTDIR/framework
  6. TMPDIR=$(mktemp -d)
  7. cd $TMPDIR
  8. addtrap "cd /; rm -rf $TMPDIR"
  9. # create mock environment
  10. mkdir apt.conf.d
  11. cat > aptconfig.conf <<EOF
  12. Dir::Etc::parts "$TMPDIR/apt.conf.d";
  13. Dir::bin::dpkg "$TMPDIR/fake-dpkg";
  14. EOF
  15. APT_CONFIG=aptconfig.conf
  16. export APT_CONFIG
  17. # install fake-dpkg into it
  18. install -m755 $TESTDIR/test-kernel-helper-autoremove.fake-dpkg $TMPDIR/fake-dpkg
  19. # run the helper
  20. sh ${TESTDIR}/../../debian/apt.auto-removal.sh
  21. # and ensure its there, valid and version 10.0.0-1 is there too
  22. test -e $TMPDIR/apt.conf.d/01autoremove-kernels
  23. apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic\.\*"
  24. # done
  25. msgpass