small fixes, add maru script
[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://cal.iankelling.org
45 # username ian
46 # I disabled power management feature, it's got 240 min sync interval,
47 # so it shouldn't be bad.
48 #
49
50 # when setting up davdroid, switch to groups are per-contact categories,
51 # per https://davdroid.bitfire.at/configuration/radicale/
52 #
53 # set account name as ian@iankelling.org, per help text below the
54 # field.
55 #
56 # After setting up account, I added one address book, named
57 # ian. calender was already created, named ian. checked boxes under
58 # both. synced.
59 #
60 # ignorable background info:
61 #
62 # When debugging, tailed /var/log/radicale/radicale.log and nginx log,
63 # both show the requests happening. Without creating the address book,
64 # after creating a contact, a sync would delete it.
65 #
66 # Address books correspond to .props files in the radicale dir.
67 #
68 # Some background is here,
69 # https://davdroid.bitfire.at/faq/entry/cant-manage-groups-on-device/
70 # which shows separate vcard option is from rfc 6350, the other is 2426,
71 # radicale page says it implements the former not the latter,
72 # which conflicts with the documentation of which to select, but whatever.
73 # http://radicale.org/technical_choices/
74 # https://davdroid.bitfire.at/faq/entry/cant-manage-groups-on-device/
75 #
76 # Note, url above says only cayanogenmod 13+ and omnirom can manage groups.