File: phabricator.postrm

package info (click to toggle)
phabricator 0~git20190207-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 71,728 kB
  • sloc: php: 552,244; sql: 16,997; ansic: 3,619; yacc: 2,503; sh: 754; xml: 519; lex: 488; cpp: 221; python: 186; makefile: 177; sed: 66
file content (82 lines) | stat: -rw-r--r-- 2,543 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
set -e

local_disk_path="/var/lib/phabricator/phd_storage"
repo_default_local_path="/var/lib/phabricator/repositories"
log_directory="/var/log/phabricator"
local_conf_file="/var/lib/phabricator/local.json"

#
# Skip, if we are not in "remove" or "purge" state
# 
if [ "$1" != "remove" ] && [ "$1" != "purge" ]; then
    exit 0
fi

# update the webserver, if needed
# apache2
if [ -e /etc/apache2/conf.d/phabricator.conf -o -e /etc/apache2/conf-enabled/phabricator.conf ]; then
    #   Sniplet adjusted from http://wiki.debian.org/Apache/PackagingFor24
    if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
        . /usr/share/apache2/apache2-maintscript-helper
        apache2_invoke disconf phabricator.conf
        apache2_invoke dismod rewrite
    elif  dpkg-query -f '${Version}'  -W 'apache2.2-common' > /dev/null 2>&1 ; then
        [ -h /etc/apache2/conf.d/phabricator.conf ] && rm /etc/apache2/conf.d/phabricator.conf
        invoke-rc.d apache2 reload || true
    fi
fi
# lighttpd
if which lighty-disable-mod >/dev/null 2>&1 ; then
    lighty-disable-mod phabricator || true
    #   We need to take care: bug #446324
    invoke-rc.d lighttpd reload 3>/dev/null || true
fi
#nginx
if [ -e /etc/nginx/sites-enabled/phabricator.conf ]; then
    rm -f /etc/nginx/sites-enabled/phabricator.conf
    invoke-rc.d nginx reload || true
fi

if [ "$1" = purge ]; then
    rm -rf $local_conf_file || true
    rm -rf /run/phabricator || true
    rm -rf $log_directory || true

    for i in $local_disk_path $repo_default_local_path $log_directory $local_conf_file; do
        if dpkg-statoverride --list $i >/dev/null 2>&1; then
            dpkg-statoverride --remove $i
        fi
    done

    if getent passwd phabricator >/dev/null; then
        if [ -x "$(command -v deluser)" ]; then
            deluser --system phabricator || true
        fi
    fi

    # get rid of configuration files and ucf entries
    for config_file in \
        /etc/apache2/conf-available/phabricator.conf \
        /etc/lighttpd/conf-available/20-phabricator.conf \
        /etc/nginx/sites-available/phabricator.conf
do
    if which ucf >/dev/null 2>&1; then
        ucf --purge $config_file
    fi
    if [ -x "`which ucfr 2>/dev/null`" ]; then
        ucfr --purge phabricator $config_file
    fi
    for ext in .ucf-new .ucf-old .ucf-dist ""; do
        rm -f "$config_file$ext"
    done
done

#TODO: remove /var/lib/phabricator/{repositories,phd_storage}?
#TODO: ask user whether or not to purge databases?
fi

#DEBHELPER# 

exit 0