This file is indexed.

postinst is in wims-modules 1:4.07a~dfsg1-7.

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
#! /bin/sh
# postinst script for wims
#
# see: dh_installdeb(1)

set -e

if (getent passwd wims > /dev/null) && (getent group wims > /dev/null); then
    exist_wims_user=yes
else
    exist_wims_user=no
fi

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#

read_only_dirs(){
    adm=/var/lib/wims/public_html/modules/adm
    dirs=$(ls -d $adm/doc $adm/new $adm/sheet $adm/vote)

for d in $dirs; do
    [ $exist_wims_user = yes ] && ! dpkg-statoverride --list $d > /dev/null && dpkg-statoverride --update --add wims wims 700 $d
    # do it once more in case dpkg-statoverride did not work
    chmod 700 $d
done
true
}

mkindex(){
    # if user wims cannot run a script, allow it temporarily
    wimsShell=$(getent passwd wims| awk -F: '{print $7}')
    isShell=$(echo "$wimsShell" | sed -n 's/\(^.*sh$\)/\1/p')
    if [ -z "$isShell" ]; then usermod wims --shell /bin/sh; fi
    (cd /var/lib/wims; su wims -c bin/mkindex)
    if [ -z "$isShell" ]; then usermod wims --shell "$wimsShell"; fi
}

case "$1" in
    triggered)
	[ $exist_wims_user = yes ] && \
	    chown -R wims:wims /var/lib/wims/public_html/modules \
	      /var/lib/wims/public_html/gifs
	read_only_dirs;
	# we refresh index files only if wims is already installed.
        # we do not "su - wims", so even if wims has an updated homedir
        # due to a previous install it still works.
	if [ $exist_wims_user = yes -a -x /var/lib/wims/public_html/wims ]
	    then
	    chown -R wims:wims /var/lib/wims/tmp
	    chown -R wims:wims /var/lib/wims/public_html/bases
	    chown -R wims:wims /var/lib/wims/public_html/scripts
	    for d in qpuzzle spuzzle; do
		puzzledir=/var/lib/wims/public_html/scripts/data/$d
		[ ! -d $puzzledir ] || chown -R wims:wims $puzzledir
	    done
	    chown -R wims:wims /var/lib/wims/public_html/bases
	    mkindex
	fi
    ;;

    configure|abort-upgrade|abort-remove|abort-deconfigure)
    # as this package is interested in its own trigger there is no need
    # to manage the option 'configure. The option 'triggered' should be
    # invoked upon post-installation automatically.
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0