various fixes
[distro-setup] / radicale-setup
1 #!/bin/bash -l
2
3 [[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
4
5
6 # davdroid setup instructions at the bottom
7
8 # main docs:
9 # http://radicale.org/user_documentation/
10 # https://davdroid.bitfire.at/configuration/
11
12
13 # created password file with:
14 # htpasswd -c /etc/nginx/caldav/htpasswd ian
15
16
17 # python-dulwich, to track changes with git, per
18 # http://radicale.org/user_documentation/#idgit-support
19 pi nginx python-dulwich radicale
20
21 # I moved /var/lib/radicale after it's initialization.
22 # I did a sudo -u radicale git init in the collections subfolder
23 # after it gets created, per the git docs.
24 lnf -T /o/radicale /var/lib/radicale
25
26 # from https://www.williamjbowman.com/blog/2015/07/24/setting-up-webdav-caldav-and-carddav-servers/
27
28 # more config is for li in distro-end
29
30 # coment in this file says this is needed for it to run on startup
31 sed -ri 's/^\s*#+\s*(ENABLE_RADICALE\s*=\s*yes\s*)/\1/' /etc/default/radicale
32
33 setini() {
34 key="$1" value="$2" section="$3"
35 file="/etc/radicale/config"
36 sed -ri "/ *\[$section\]/,/^ *\[[^]]+\]/{/^\s*$key[[:space:]=]/d};/ *\[$section\]/a $key = $value" "$file"
37 }
38
39 # comments say default is 0.0.0.0:5232
40 setini hosts 10.8.0.4:5232 server
41 sgo radicale
42
43 # davdroid from f-droid. username ian,
44 # url https://iank.pw/radicale/ian.
45 # I disabled power management feature, it's got 240 min sync interval,
46 # so it shouldn't be bad.
47 #
48
49 # when setting up davdroid, switch to groups are per-contact categories,
50 # per https://davdroid.bitfire.at/configuration/radicale/
51 #
52 # set account name as ian@iankelling.org, per help text below the
53 # field.
54 #
55 # After setting up account, I added one address book, named
56 # ian. calender was already created, named ian. checked boxes under
57 # both. synced.
58 #
59 # ignorable background info:
60 #
61 # When debugging, tailed /var/log/radicale/radicale.log and nginx log,
62 # both show the requests happening. Without creating the address book,
63 # after creating a contact, a sync would delete it.
64 #
65 # Address books correspond to .props files in the radicale dir.
66 #
67 # Some background is here,
68 # https://davdroid.bitfire.at/faq/entry/cant-manage-groups-on-device/
69 # which shows separate vcard option is from rfc 6350, the other is 2426,
70 # radicale page says it implements the former not the latter,
71 # which conflicts with the documentation of which to select, but whatever.
72 # http://radicale.org/technical_choices/
73 # https://davdroid.bitfire.at/faq/entry/cant-manage-groups-on-device/
74 #
75 # Note, url above says only cayanogenmod 13+ and omnirom can manage groups.