This file is indexed.

postinst is in dhelp 0.6.21+nmu6ubuntu1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/sh
#
# Copyright (C) 2001,2002 Stefan Hornburg (Racke) <racke@linuxia.de>
# Copyright (C) 2007 Esteban Manchado Velázquez <zoso@debian.org>
# Copyright (C) 2011,2012 Georgios M. Zarkadas <gz@member.fsf.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA  02111-1307  USA.

set -e

# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
	update-menus
fi
# End automatically added section


#### Globals ####

DHELP_INDEXER=/usr/share/dhelp/scripts/index-deferred
DHELP_APTHOOK=/etc/apt/apt.conf.d/35dhelp
DHELP_POSTCMD='Dpkg::Post-Invoke {
    "if test -x '${DHELP_INDEXER}'; then '${DHELP_INDEXER}'; fi";
};'
DHELP_OKINDEX="false"

#### Import Library ####

for DHELP_LIBFILE in /usr/share/dhelp/maint-scripts/*.sh; do 
    if [ -f ${DHELP_LIBFILE} ]; then
        . ${DHELP_LIBFILE}
    else
        >&2 echo "Dhelp error: file ${DHELP_LIBFILE} was not found."
        >&2 echo "Please file a bug report at bugs.debian.org" \
            "against the dhelp package."
    fi
done

#### Functions ####

# cleanup artifacts of previous versions
#
do_upgrade_cleanup_actions ()
{
    # remove /usr/doc/HTML, /usr/doc/HTML2 and /usr/doc/dhelp
    # if upgrading from old dhelp package

    if [ -h /usr/doc/HTML ]; then
        rm --force /usr/doc/HTML
    elif [ -d /usr/doc/HTML ]; then
        rm --force --recursive /usr/doc/HTML
    fi

    if [ -d /usr/doc/HTML2 ]; then
        rm --force --recursive /usr/doc/HTML2
    fi

    if [ -h /usr/doc/dhelp ]; then
        rm --force /usr/doc/dhelp
    fi

    # remove old /var/lib/dhelp/swish++.index (versions older than 0.6)

    if [ ! -d /var/lib/dhelp/swish++.index ]; then
        rm --force /var/lib/dhelp/swish++.index
    fi
}

# create and register with ucf our dpkg post-invoke hook
#
register_dpkg_postinvoke_hook ()
{
    local dhelp_tmp_apthook=$(mktemp)

    chmod 644 ${dhelp_tmp_apthook}
    echo "${DHELP_POSTCMD}" > ${dhelp_tmp_apthook}

    mv_ucfregister_file dhelp ${dhelp_tmp_apthook} ${DHELP_APTHOOK}
}

# build the set of html files inside /usr/share/doc/HTML 
#
build_document_index ()
{
    local ret=0

    # 'dhelp_parse -r', among other actions, produces the pending list.
    echo -n "Building HTML tree..."

    dhelp_parse -r && ret=$? || ret=$?

    if [ ${ret} -eq 0 ]; then
        echo " done."
    fi
    return ${ret}
}

# create the full text search index file in the background
#
delaybuild_search_index ()
{
    local ret=0

    # since the pending list is created by dhelp_parse -r, if index file
    # does not exist, it suffices to do incremental indexing.

    if [ -f /var/lib/dhelp/documents.index ]; then
        return 0
    else
        echo "Reindexing documentation in the background"

        if [ -x ${DHELP_INDEXER} ]; then
            ${DHELP_INDEXER} && ret=$? || ret=$?
            return ${ret}
        else
            install_msg dhelp err \
                "Error: ${DHELP_INDEXER} does not exist or is not executable"
            return 1
        fi
    fi
}

#### Main script body ####

# NOTE: do not fail package installation if "cache data" that can be
# recreated anytime cannot for any reason be created during install.

case $1 in
configure|abort-upgrade)

    # cleanup artifacts of previous versions

    do_upgrade_cleanup_actions

    # Create and register with ucf our dpkg post-invoke hook.

    register_dpkg_postinvoke_hook

    # Hack to tell if the package is configured, so that third party 
    # packages that call dhelp don't barf (from scrollkeeper package).
    # It is also checked by dhelp_parse, hence this line must come
    # _before_ the build_document_index call.

    touch /var/lib/dhelp/configured

    # Create the html document index before registering configuration
    # snippets with installed web servers.

    if build_document_index; then
        DHELP_OKINDEX="true"
    else
        install_msg dhelp err \
            "Error: building of the HTML tree failed;" \
            "check mount options and disk space for '/usr/share/doc/HTML'" \
            "and run 'dhelp_parse -r' to retry the build process."
    fi

    # Try to enable web server configs (at most one is expected to succeed)

    try_chconf_apache2  "$1" "enable" dhelp || true
    try_chconf_lighttpd "$1" "enable" dhelp || true

    # Create the full text search index at the end of postinst.

    if [ "${DHELP_OKINDEX}" = "true" ]; then
        if delaybuild_search_index; then
            :
        else
            install_msg dhelp err \
                "Error: delayed indexing failed;" \
                "run the weekly cron job to recreate the index."
        fi
    else
        install_msg dhelp warning \
            "Not reindexing documentation due to HTML tree" \
            "build error; correct the above and run the weekly" \
            "cron job to recreate the index."
    fi
    ;;
*)
    ;;
esac

unset DHELP_INDEXER DHELP_POSTCMD DHELP_APTHOOK || true
unset DHELP_LIBFILE DHELP_OKINDEX || true