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