summaryrefslogtreecommitdiff
path: root/debian/preinst
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:56:32 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:56:32 +0000
commitb2e465d6d32d2dc884f58b94acb7e35f671a87fe (patch)
tree5928383b9bde7b0ba9812e6526ad746466e558f7 /debian/preinst
parent00b47c98ca4a4349686a082eba6d77decbb03a4d (diff)
Join with aliencode
Author: jgg Date: 2001-02-20 07:03:16 GMT Join with aliencode
Diffstat (limited to 'debian/preinst')
-rwxr-xr-xdebian/preinst28
1 files changed, 28 insertions, 0 deletions
diff --git a/debian/preinst b/debian/preinst
new file mode 100755
index 000000000..141db6e45
--- /dev/null
+++ b/debian/preinst
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+# dpkg does this for us while we are upgrading..
+#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
+# rm /var/state/apt
+#fi
+
+if [ "$1" = "upgrade" -o "$1" = "install" -a "$2" != "" ]; then
+ if [ ! -e /var/lib/apt -a -e /var/state/apt ]; then
+ # upgrading from /var/state/apt using apt.
+ # it's probably running now so we want to ensure /var/state/apt
+ # is still valid afterwards. and since we're upgrading
+
+ if [ -x /usr/bin/perl -a -d /var/state/apt -a ! -L /var/state/apt ] &&
+ perl -e 'exit 1 if ((stat("/var/lib"))[0] != (stat("/var/state/apt"))[0])'
+ then
+ # same fs, we can mv it
+ mv /var/state/apt /var/lib/apt
+ ln -s ../lib/apt /var/state/apt
+ # note that this symlink (/var/state/apt) will be removed when
+ # dpkg finishes unpacking the apt we're about to install; this is okay
+ else
+ # scary, let's just symlink it and hope
+ ln -s /var/state/apt /var/lib/apt
+ fi
+ fi
+ touch /var/lib/apt/lists/partial/.delete-me-later || true
+fi