]> git.saurik.com Git - apt.git/blob - debian/preinst
* apt-ftparchive might write corrupt Release files (LP: #46439)
[apt.git] / debian / preinst
1 #! /bin/sh
2
3 # dpkg does this for us while we are upgrading..
4 #if [ "$1" = "upgrade" -a -L /var/state/apt -a -e /var/lib/apt -a ! -L /var/state/apt ] && dpkg --compare-versions "$2" ">=" "0.4.10"; then
5 # rm /var/state/apt
6 #fi
7
8 if [ "$1" = "upgrade" -o "$1" = "install" -a "$2" != "" ]; then
9 if [ ! -e /var/lib/apt -a -e /var/state/apt ]; then
10 # upgrading from /var/state/apt using apt.
11 # it's probably running now so we want to ensure /var/state/apt
12 # is still valid afterwards. and since we're upgrading
13
14 if [ -x /usr/bin/perl -a -d /var/state/apt -a ! -L /var/state/apt ] &&
15 perl -e 'exit 1 if ((stat("/var/lib"))[0] != (stat("/var/state/apt"))[0])'
16 then
17 # same fs, we can mv it
18 mv /var/state/apt /var/lib/apt
19 ln -s ../lib/apt /var/state/apt
20 # note that this symlink (/var/state/apt) will be removed when
21 # dpkg finishes unpacking the apt we're about to install; this is okay
22 else
23 # scary, let's just symlink it and hope
24 ln -s /var/state/apt /var/lib/apt
25 fi
26 fi
27 touch /var/lib/apt/lists/partial/.delete-me-later || true
28 fi
29
30 #DEBHELPER#