summarylogtreecommitdiffstats
path: root/parsoid.install
blob: 7f739124a41e4f972b730712b253d64edf5ef760 (plain)
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
# Colored makepkg-like functions
all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"
yellow="${bold}$(tput setaf 3)"

msg_blue() {
    printf "${blue}==>${bold} $1${all_off}\n"
}

note() {
    printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
}

_update() {
    if ! getent passwd parsoid &>/dev/null; then
        msg_blue "Adding user 'parsoid'"
        useradd -m -r -U -d /usr/share/webapps/parsoid -s /bin/false parsoid &>/dev/null
        chown -R parsoid /usr/share/webapps/parsoid
	chgrp -R parsoid /usr/share/webapps/parsoid
    fi
}

post_install() {
    _update
    echo ">> Before run Parsoid, modify /usr/share/webapps/parsoid/config.yaml ."
    echo ">> Reference comments in this file for help ."
}

post_upgrade() {
    _update
    note "Parsoid now use 'config.yaml' as config file."
}

post_remove() {
    if getent passwd parsoid &>/dev/null; then
        msg_blue "Removing user 'parsoid'"
        userdel -rf parsoid &>/dev/null
    fi
}