summarylogtreecommitdiffstats
path: root/install
blob: eeb98ebd4109dbc0fc14992fe0724b51f53667db (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

post_install() {
    # create tempdirs and users from /usr/lib/*.d
    systemd-sysusers
    systemd-tmpfiles --create

    chown -R kopano:kopano /etc/kopano

    installdir kopano:kopano 0700 0600 /var/log/kopano
    installdir kopano:kopano 0700 0600 /var/lib/kopano
    installdir kopano:kopano 0700 0600 /var/lib/kopano/search

    # due to a bug/exception it's impossible to execute phps mapi modul without browsable dir
    installdir kopano:kopano 0755 0600 /etc/kopano

    # fix missing python symlink for presence
    if [[ ! -e "/usr/bin/python" ]];
    then
	ln -s /usr/bin/python2 /usr/bin/python
    fi

    return 0
}

post_upgrade() {
    local newPackageVersion="$1"
    local oldPackageVersion="$2"

    case "$oldPackageVersion" in
	*)
	    ;;	
    esac

    echo
    echo "Please restart kopano services"
    echo
    echo "   $ systemctl restart kopano-gateway"
    echo "   $ systemctl restart kopano-ical"
    echo
    return 0
}

pre_remove() {
    return 0
}

# User Scripts

# care about existing files
installdir() {
    local owner="$1"
    local moddir="$2"
    local modfile="$3"
    local directory="$4"

    mkdir -p "$directory"
    find $directory -exec chown "$owner" {} \;
    find $directory -type f -exec chmod "$modfile" {} \;
    find $directory -type d -exec chmod "$moddir" {} \;
}