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.
 
 
 
 
 
 

87 lines
2.5 KiB

  1. #! /bin/sh
  2. set -e
  3. # summary of how this script can be called:
  4. # * <postinst> `configure' <most-recently-configured-version>
  5. # * <old-postinst> `abort-upgrade' <new version>
  6. # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  7. # <new-version>
  8. # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  9. # <failed-install-package> <version> `removing'
  10. # <conflicting-package> <version>
  11. # for details, see http://www.debian.org/doc/debian-policy/ or
  12. # the debian-policy package
  13. case "$1" in
  14. configure)
  15. if dpkg --compare-versions "$2" lt 1.1~exp4; then
  16. # apt-key before 0.9.10 could leave empty keyrings around
  17. find /etc/apt/trusted.gpg.d/ -name '*.gpg' | while read keyring; do
  18. if ! test -s "$keyring"; then
  19. rm -f "$keyring"
  20. fi
  21. done
  22. # apt-key before 0.9.8.2 could create 0600 trusted.gpg file
  23. if test -e /etc/apt/trusted.gpg ; then
  24. chmod -f 0644 /etc/apt/trusted.gpg || true
  25. fi
  26. fi
  27. if dpkg --compare-versions "$2" lt-nl 0.9.9.5; then
  28. # we are using tmpfiles for both
  29. rm -f /etc/apt/trustdb.gpg
  30. # this removal was done unconditional since 0.8.15.3
  31. SECRING='/etc/apt/secring.gpg'
  32. # test if secring is an empty normal file
  33. if test -f $SECRING -a ! -s $SECRING; then
  34. rm -f $SECRING
  35. fi
  36. fi
  37. # add unprivileged user for the apt methods
  38. adduser --force-badname --system --home /nonexistent \
  39. --no-create-home --quiet _apt || true
  40. # Fixup any mistake in the home directory of the _apt user
  41. if dpkg --compare-versions "$2" lt-nl 1.1~exp10~; then
  42. usermod --home /nonexistent _apt
  43. fi
  44. # deal with upgrades from experimental
  45. if dpkg --compare-versions "$2" 'eq' '1.1~exp3'; then
  46. # libapt will setup partial/ at runtime
  47. chown -R root:root /var/lib/apt/lists /var/cache/apt/archives || true
  48. fi
  49. # ensure tighter permissions on the logs, see LP: #975199
  50. if dpkg --compare-versions "$2" lt-nl 0.9.7.7; then
  51. # ensure permissions are right
  52. chmod -f 0640 /var/log/apt/term.log* || true
  53. fi
  54. # create kernel autoremoval denylist on update
  55. if dpkg --compare-versions "$2" lt 0.9.9.3; then
  56. /etc/kernel/postinst.d/apt-auto-removal
  57. fi
  58. ;;
  59. abort-upgrade|abort-remove|abort-deconfigure)
  60. ;;
  61. *)
  62. echo "postinst called with unknown argument \`$1'" >&2
  63. exit 1
  64. ;;
  65. esac
  66. # dh_installdeb will replace this with shell code automatically
  67. # generated by other debhelper scripts.
  68. #DEBHELPER#
  69. exit 0