This file is indexed.

postinst is in doc-base 0.10.3.

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
#!/bin/sh
# vim:ts=4:sts=4:et:sw
# postinst for doc-base

# Abort if any command returns an error value
set -e

package=doc-base
# upgrades prior to this version require complete re-registration
compat_ver=0.10.0~

ctrldir="/usr/share/$package"
libdir="/var/lib/$package"
infodir="$libdir/info"
docsdir="$libdir/documents"
omfdir="$libdir/omf"
status_db="$infodir/status.yml"
files_db="$infodir/files.yml"
VERBOSE=

if [ "$DOC_BASE_MAINT_DEBUG" ]; then
    echo entering $package postinst
    [ -z "$DOC_BASE_MAINT_VERBOSE" ] || VERBOSE=-v
    set -x
fi

reinstall_docs () {
    # Set the following env variable to fix `Bug#648937: doc-base: trigger fails when 
    # Locale::gettext is broken due to perl upgrade'.  See also #479711 & #479681.
    export PERL_DL_NONLAZY=1

    status=0
    install-docs ${VERBOSE} "--install-$1" || status=$?

    if [ "$status" = 10 ] ; then # error processing databases
        echo                                                                     >&2
        echo "**  Trying to recover from the above install-docs error by"        >&2
        echo "**  removing its internal databases and re-calling it afterwards"  >&2
        echo                                                                     >&2

        ext="possibly_corrupted"
        mv -f "$status_db" "${status_db}.${ext}"
        mv -f "$files_db" "${files_db}.${ext}"
        rm -rf "$docsdir" "$omfdir"; mkdir -p -m 755  "$docsdir" "$omfdir"
        find "$infodir"  -type f '!' -name "*.${ext}" -exec rm -f {} ';'

        install-docs ${VERBOSE} --install-all && status=$? || status=$? 

        [ "$status" != 0 ] || rm -f "${status_db}.${ext}" "${files_db}.${ext}"
    fi
    [ "$status" = 0 ] || exit $status
   
}

case "$1" in
    configure)
        if dpkg --compare-versions "$2" lt-nl "$compat_ver" ||
          [ ! -f "$status_db"  ]; then
            # version is less than last compatable version, we need to
            # re-register all the docs
            reinstall_docs all
        else
            reinstall_docs changed
        fi
        ;;

    triggered)
        if [ -f "$status_db" ]; then
            reinstall_docs changed
        else
            echo "doc-base seems not to be configured yet, skipping triggers run"
        fi
        ;;
esac



exit 0