This file is indexed.

postrm is in dokuwiki 0.0.20131208-1.

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
#!/bin/sh
# Postrm script for DokuWiki by Matti P�ll� <mpo@iki.fi>
# Based on postrm for PHPWiki written by Matthew Palmer.

set -e

# Disable apache2 configuration
disable_apache2_conf()
{
    if [ -e /usr/share/apache2/apache2-maintscript-helper ]
    then
        . /usr/share/apache2/apache2-maintscript-helper
        apache2_invoke disconf dokuwiki
    fi
    rm -f /etc/apache2/conf-available/dokuwiki.conf
}


# Reload apache2
reload_apache2()
{
    # Nothing, since `apache2_invoke disconf` already did what had to be done
    :
}

# Disable lighttpd configuration
disable_lighttpd_conf()
{
    if [ -x /usr/sbin/lighty-disable-mod ]
    then
        lighty-disable-mod dokuwiki || true
    fi
    rm -f /etc/lighttpd/conf-available/50-dokuwiki.conf
}


# Reload lighttpd
reload_lighttpd()
{
    # That may fail if lighttpd is not running: this is not a real problem,
    # just ignore it.
    invoke-rc.d lighttpd force-reload || true
}


# Above debhelper's additions that clean the debconf database!

# Actions on remove needing debconf
if [ "$1" = "remove" ] && [ -e /usr/share/debconf/confmodule ]; then
    . /usr/share/debconf/confmodule
    # Disable web servers configuration (it makes no sense to keep webservers
    # configured for a wiki that has been removed)
    db_get dokuwiki/system/configure-webserver
    webservers="$RET"
    db_get dokuwiki/system/restart-webserver
    restart="$RET"
    for webserver in $webservers
    do
        webserver=${webserver%,}
        disable_${webserver}_conf "$@"
        if [ "$restart" = "true" ]
        then
            # Note: configure_apache2 uses functions from
            # /usr/share/apache2/apache2-maintscript-helper, which require an
            # unmodified environment, including maintainer script arguments "$@"
            reload_$webserver "$@"
        fi
    done
fi

# Actions on purge needing debconf
if [ "$1" = "purge" ] && [ -e /usr/share/debconf/confmodule ]; then
    . /usr/share/debconf/confmodule
    db_get dokuwiki/system/purgepages || true
    if [ "$RET" = "true" ]; then
        rm -rf /var/lib/dokuwiki/data/attic/*
        rm -rf /var/lib/dokuwiki/data/media/*
        rm -rf /var/lib/dokuwiki/data/media_attic/*
        rm -rf /var/lib/dokuwiki/data/media_meta/*
        rm -rf /var/lib/dokuwiki/data/meta/*
	rm -rf /var/lib/dokuwiki/data/pages/*
        if [ -e /var/lib/dokuwiki/farm ]
        then
            rm -rf /var/lib/dokuwiki/farm
        fi
    fi
fi

# Actions on remove not needing debconf
if [ "$1" = "remove" ]; then
    rm -rf /var/lib/dokuwiki/data/cache
    rm -rf /var/lib/dokuwiki/data/index
    if [ -e /var/lib/dokuwiki/farm ] && [ "$(stat -c '%h' "/var/lib/dokuwiki/farm")" -gt 2 ]
    then
        for site in /var/lib/dokuwiki/farm/* ; do
            rm -rf -- "$site/data/cache"
            rm -rf -- "$site/data/index"
        done
    fi
fi

# Actions on purge not needing debconf
if [ "$1" = "purge" ]; then
    if [ -x /usr/bin/ucf ]; then
	ucf --purge /etc/dokuwiki/apache.conf
	ucf --purge /etc/dokuwiki/lighttpd.conf
	ucf --purge /var/lib/dokuwiki/acl/acl.auth.php
	ucf --purge /var/lib/dokuwiki/acl/users.auth.php
        ucf --purge /etc/dokuwiki/htaccess
        ucf --purge /etc/dokuwiki/local.php
    fi

    if [ -x /usr/bin/ucfr ]; then
        ucfr --purge dokuwiki /etc/dokuwiki/apache.conf
        ucfr --purge dokuwiki /etc/dokuwiki/lighttpd.conf
	ucfr --purge dokuwiki /var/lib/dokuwiki/acl/acl.auth.php
	ucfr --purge dokuwiki /var/lib/dokuwiki/acl/users.auth.php
	ucfr --purge dokuwiki /etc/dokuwiki/htaccess
        ucfr --purge dokuwiki /etc/dokuwiki/local.php
    fi

    for ext in '' '~' '%' .bak .ucf-new .ucf-old .ucf-dist;  do
        rm -f /etc/dokuwiki/apache.conf$ext
        rm -f /etc/dokuwiki/lighttpd.conf$ext
        rm -f /var/lib/dokuwiki/acl/acl.auth.php$ext
        rm -f /var/lib/dokuwiki/acl/users.auth.php$ext
        rm -f /etc/dokuwiki/htaccess$ext
        rm -f /etc/dokuwiki/local.php$ext
    done

    if dpkg-statoverride --list /var/lib/dokuwiki/plugins >/dev/null 2>&1; then
        dpkg-statoverride --remove /var/lib/dokuwiki/plugins
    fi

    if dpkg-statoverride --list /etc/dokuwiki >/dev/null 2>&1; then
        dpkg-statoverride --remove /etc/dokuwiki
    fi

    # Remove sites configuration
    if [ -e /etc/dokuwiki/farm ]
    then
        rm -rf /etc/dokuwiki/farm
    fi
fi

# Remove some configuration files backups, cf. preinst upgrade.
if [ "$1" = "abort-upgrade" ] ; then
    rm /usr/share/dokuwiki/.htaccess.upgrade
fi

# Automatically added by dh_installdebconf
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule
	db_purge
fi
# End automatically added section


# Stop debconf, or the script would stall forever if we restarted lighttpd
# (cf. debconf-devel(7) (search for "daemon") and bug #133029)
if [ "$1" = "purge" ]
then
    if [ -e /usr/share/debconf/confmodule ]
    then
        db_stop
    fi
fi

exit 0