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