Debian Codegraph @

debian/apt-xapian-index.postinst

raw
1 #!/bin/sh
2
3 set -e
4
5 #DEBHELPER#
6
7 # ionice should not be called in a virtual environment
8 # (similar to man-db cronjobs)
9 if [ -x /usr/bin/ionice ] && ! egrep -q '(envID|VxID):.*[1-9]' /proc/self/status
10 then
11 IONICE="/usr/bin/ionice -c3"
12 else
13 IONICE=""
14 fi
15
16 case "$1" in
17 configure)
18 # Just checking the main directory with -d should prevent the indexing
19 # to be started while an indexing is already going on, as the first
20 # thing that update-apt-xapian-index does is to create the directory if
21 # it is missing
22 #
23 # we also full-regenerate the index on upgrades from older versions
24 # because the weekly --update cron job will not use new plugins for
25 # already indexed packages
26 if [ ! -d /var/lib/apt-xapian-index ]
27 then
28 if [ ! -x /usr/sbin/policy-rc.d ] || /usr/sbin/policy-rc.d apt-xapian-index start
29 then
30 echo "apt-xapian-index: Building new index in background..."
31 $IONICE nice /usr/sbin/update-apt-xapian-index --force --quiet &
32 fi
33 fi
34 ;;
35 esac
36
37 exit 0