]> git.saurik.com Git - apt.git/blame - debian/apt.postinst
all errors should be printed to stderr
[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)
f9e64e7b
DK
18 if dpkg --compare-versions "$2" lt-nl 0.9.9.5; then
19 # we are using tmpfiles for both
20 rm -f /etc/apt/trustdb.gpg
21 # this removal was done unconditional since 0.8.15.3
22 SECRING='/etc/apt/secring.gpg'
23 # test if secring is an empty normal file
24 if test -f $SECRING -a ! -s $SECRING; then
25 rm -f $SECRING
26 fi
285feb3c 27 fi
fb3ecf16 28
3927c6da 29 # add unprivileged user for the apt methods
b9823220
MV
30 adduser --force-badname --system -home /var/empty \
31 --no-create-home --quiet _apt || true
eed65c79 32 chown -R _apt:root \
3927c6da
MV
33 /var/lib/apt/lists \
34 /var/cache/apt/archives
35
fb3ecf16
MV
36 # ensure tighter permissons on the logs, see LP: #975199
37 if dpkg --compare-versions "$2" lt-nl 0.9.7.7; then
38 # ensure permissions are right
39 chmod -f 0640 /var/log/apt/term.log* || true
40 fi
41
d3213963 42 # create kernel autoremoval blacklist on update
5361a618 43 if dpkg --compare-versions "$2" lt 0.9.9.3; then
d3213963
MV
44 /etc/kernel/postinst.d/apt-auto-removal
45 fi
b3d44315
MV
46 ;;
47
48 abort-upgrade|abort-remove|abort-deconfigure)
49
50 ;;
51
52 *)
53 echo "postinst called with unknown argument \`$1'" >&2
54 exit 1
55 ;;
56esac
57
58# dh_installdeb will replace this with shell code automatically
59# generated by other debhelper scripts.
60
61#DEBHELPER#
62
63exit 0
64
65