summaryrefslogtreecommitdiff
path: root/debian/postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/postinst')
-rwxr-xr-xdebian/postinst32
1 files changed, 31 insertions, 1 deletions
diff --git a/debian/postinst b/debian/postinst
index 42dfd16..9a7f2c0 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -34,13 +34,43 @@ rm -f /var/lib/dhelp/swish++.index
# that call dhelp don't barf (from scrollkeeper package)
touch /var/lib/dhelp/configured
+DHELP_INDEXER=/usr/share/dhelp/index-deferred
+DHELP_APTHOOK=/etc/apt/apt.conf.d/35dhelp
+
+# create and register with ucf our dpkg post-invoke hook
+
+DHELP_POSTCMD="\"if test -x ${DHELP_INDEXER}; then ${DHELP_INDEXER}; fi\""
+DHELP_TMP_APTHOOK=`mktemp 2>/dev/null`
+if [ $? -ne 0 ]; then
+ >&2 echo "Error: unable to create temporary file"
+ exit 1
+fi
+if ! chmod 644 ${DHELP_TMP_APTHOOK}; then
+ >&2 echo "Error: unable to change mode of temporary file"
+ exit 2
+fi
+echo "Dpkg::Post-Invoke { ${DHELP_POSTCMD}; };" > ${DHELP_TMP_APTHOOK}
+
+ucf --debconf-ok --three-way ${DHELP_TMP_APTHOOK} ${DHELP_APTHOOK}
+rm -f ${DHELP_TMP_APTHOOK}
+ucfr dhelp ${DHELP_APTHOOK}
+
+# 'dhelp_parse -r', among other actions, produces the pending list.
echo -n "Building HTML tree..."
dhelp_parse -r
echo " done."
+# Thus, if index file does not exist, it suffices to do incremental indexing.
if [ ! -f /var/lib/dhelp/documents.index ]; then
echo "Reindexing documentation in the background"
- /etc/cron.weekly/dhelp 2>/dev/null >/dev/null &
+ if [ -x ${DHELP_INDEXER} ]; then
+ ${DHELP_INDEXER}
+ else
+ >&2 echo "Error: ${DHELP_INDEXER} does not exist or is not executable"
+ exit 3
+ fi
fi
+unset DHELP_INDEXER DHELP_POSTCMD DHELP_APTHOOK DHELP_TMP_APTHOOK || true
+
#DEBHELPER#