#409279 should work from the start (try to run apt-file update in postinst)

#409279#5
Date:
2007-02-01 16:44:02 UTC
From:
To:
Hello,

It would be nice if apt-file would work from the start by trying to run
"apt-file update" in postinst. Of course, it would be nice to fail
elegantly if the Contents file can't be found.

#409279#10
Date:
2007-11-18 20:40:55 UTC
From:
To:
Hi,

The following patch is used in Ubuntu to try and run apt-file
update in postinst, while failing gracefully, and trying to
avoid it if there is no network access to the first mirror. It
should go someway to have apt-file work straight away for most
people. Please consider applying it.

Thanks,

James

diff -pruN 2.0.8.2/debian/apt-file.postinst
2.0.8.2ubuntu2/debian/apt-file.postinst
--- 2.0.8.2/debian/apt-file.postinst	1970-01-01 01:00:00.000000000 +0100
+++ 2.0.8.2ubuntu2/debian/apt-file.postinst	2007-06-17 00:13:15.000000000 +0100
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+    configure)
+	ping -q -c 3 `grep ^deb\  /etc/apt/sources.list | head -1 | \
+		cut -s -d\  -f2 | cut -d/ -f3` > /dev/null 2>&1 && \
+		apt-file update || true
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0

#409279#15
Date:
2007-12-16 20:17:08 UTC
From:
To:
See also https://bugs.launchpad.net/ubuntu/+source/apt-file/+bug/176757

/* era */

#409279#20
Date:
2008-10-11 21:05:03 UTC
From:
To:
However some people would not expect a sudden big download...
#409279#25
Date:
2015-12-06 08:09:26 UTC
From:
To:
Control: tags -1 wontfix

Hi,

I agree (in principle) that it would be nice if apt-file would work
immediately on install.

Though with apt-file now using apt's acquire system, we would end up
calling apt while apt is running.  This is not possible atm. and I will
therefore tag this wontfix for now.

Please note that even if it was possible to (reliably) run apt within a
postinst, I am not necessarily convinced this we should fetch Contents
files during installation.  However, there is not much point in looking
at that while the above is blocking it.

Thanks,
~Niels