summaryrefslogtreecommitdiffstats
path: root/tenshi/tenshi.install
blob: 270cd640a750a3206dd91e47a981dd015207d7d8 (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
42
# $Id: $
#
# Description: post-install script for tenshi
# Contributor: Ryan Corder <ryanc@greengrey.org>
#

# arg 1: new package version
post_install() {
    # create tenshi user
    if [ -z "`grep '^tenshi:' /etc/group`" ]; then
        groupadd tenshi
    fi
    if [ -z "`grep '^tenshi:' /etc/passwd`" ]; then
        useradd -d /var/lib/tenshi -g tenshi -s /bin/false tenshi
    else
        usermod -s /bin/false tenshi
    fi

    # set more secure permissions on config files, etc
    chown -R tenshi:tenshi /etc/tenshi
    chmod 640 /etc/tenshi/tenshi.conf
    chown -R tenshi:tenshi /var/lib/tenshi
    chmod 750 /var/lib/tenshi
    chmod -R o-rwx /var/lib/tenshi
}

# arg 1: new package version
# arg 2: old package version
post_upgrade() {
    post_install $1
}

# arg 1: old package version
pre_remove() {
    userdel tenshi &> /dev/null
    groupdel tenshi &> /dev/null
}

op=$1
shift

$op $*