summarylogtreecommitdiffstats
path: root/radicale.install
blob: c09bef7bd6f546b7dd1598907ff207bcbdb5b09d (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
post_install() {
	getent group radicale &>/dev/null || groupadd -r radicale >/dev/null
	getent passwd radicale &>/dev/null || useradd -r -s /usr/bin/false \
		-g radicale -G radicale,http -d /var/lib/radicale/ radicale >/dev/null

	install -d -m 755 -o radicale -g radicale /var/lib/radicale/

	chown -R root:radicale /etc/radicale/

    echo "If you choose to use a non-standard path for your collections"
    echo "make sure to copy the systemd unit to /etc/systemd/system and"
    echo "adjust the respective line 'ReadWritePaths' to your folder."
    echo "Make sure to reload and re-enable your units afterwards!"
}

pre_upgrade() {
    # Export to new storage format
    if [[ $2 == "1."* ]]
    then
        radicale --export-storage /tmp/radicale2
        mv /tmp/radicale2 /var/lib/radicale2
    fi
}

post_upgrade() {
        chown -R root:radicale /etc/radicale/
        if [[ $2 == "1."* ]]
        then
            echo "The upgrade to 2.x.x requires manual intervention: http://radicale.org/1to2/"
            echo "Your data was exported to /var/lib/radicale2"
        fi
}
 
pre_remove() {
	getent passwd radicale &>/dev/null && userdel radicale >/dev/null
	getent group radicale &>/dev/null && groupdel radicale >/dev/null
	true
}