3 [[ $EUID == 0 ]] ||
exec sudo
-E "${BASH_SOURCE[0]}" "$@"
5 if [[ -e /b
/errhandle
/err
]]; then
6 source /b
/errhandle
/err
9 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
12 source /a
/bin
/bash_unpublished
/source-state
13 source /a
/bin
/distro-functions
/src
/package-manager-abstractions
14 # davdroid setup instructions at the bottom
17 # http://radicale.org/user_documentation/
18 # https://davdroid.bitfire.at/configuration/
20 # note on debugging: if radicale can't bind to the address,
21 # in the log it just says "Starting Radicale". If you run
22 # it in the foreground, it will give more info. Background
23 # plus debug does not help.
24 # sudo -u radicale radicale -D -f
26 # created password file with:
27 # htpasswd -c /etc/davpass dav
29 vpn_ser
=openvpn-client
30 if [[ ! -e /lib
/systemd
/system
/openvpn-client@.service
]]; then
34 d
=/etc
/systemd
/system
/radicale.service.d
36 cat >$d/override.conf
<<EOF
38 # this unit is configured to start and stop whenever openvpn-client@mail.service
41 BindsTo=$vpn_ser@mail.service
42 After=$vpn_ser@mail.service
45 RequiredBy=$vpn_ser@mail.service
47 systemctl daemon-reload
# not sure this is needed
51 # use persistent uid/gid
52 IFS
=:; read -r _ _ uid _
< <(getent passwd radicale
); unset IFS
53 IFS
=:; read -r _ _ gid _
< <(getent group radicale
); unset IFS
54 if [[ $uid != 609 ]]; then
55 systemctl stop radicale ||
:
56 usermod
-u 609 radicale
57 groupmod
-g 609 radicale
58 usermod
-g 609 radicale
60 log_p
=/var
/log
/radicale
61 [[ -d $log_p ]] || log_p
=
62 find /o
/radicale
-xdev -exec chown
-h 609 {} +
63 find /o
/radicale
-xdev -exec chgrp
-h 609 {} +
66 # I moved /var/lib/radicale after it's initialization.
67 # I did a sudo -u radicale git init in the collections subfolder
68 # after it gets created, per the git docs.
69 /a
/exe
/lnf
-T /o
/radicale
/var
/lib
/radicale
71 # from https://www.williamjbowman.com/blog/2015/07/24/setting-up-webdav-caldav-and-carddav-servers/
73 # more config is for li in distro-end
75 # coment in this file says this is needed for it to run on startup
76 sed -ri 's/^\s*#+\s*(ENABLE_RADICALE\s*=\s*yes\s*)/\1/' /etc
/default
/radicale
79 key
="$1" value
="$2" section
="$3"
80 file="/etc/radicale/config"
81 sed -ri "/ *\[$section\]/,/^ *\[[^]]+\]/{/^\s*$key[[:space:]=]/d};/ *\[$section\]/a $key = $value" "$file"
84 # comments say default is 0.0.0.0:5232
85 setini hosts
10.8.0.4:5232 server
87 if [[ $HOSTNAME == $MAIL_HOST ]]; then
88 systemctl start radicale
89 systemctl
enable radicale
92 # disable power management feature, set to 240 min sync interval,
93 # so it shouldn't be bad.
95 # davdroid from f-druid.
96 # login with url and user name
97 # url https://cal.iankelling.org/ian
99 # pass, see password manager for radicale
101 # add account dialog:
103 # set account name as ian@iankelling.org, per help text below the
106 # switch to groups are per-contact categories,
107 # per https://davdroid.bitfire.at/configuration/radicale/
110 # After setting up account, I added one address book, named
111 # ianaddr. calender was already created, named ian. checked boxes under
114 # To restore from old phone to new phone, I wiped all data out, then copied over the newly created files. I think
116 # ignorable background info:
118 # opentasks uses the calendar file.
120 # The address book I created got a uuid as a name for the file. Note
121 # the .props file says if it's a calendar or addressbook.
123 # When debugging, tailed /var/log/radicale/radicale.log and apache log,
124 # both show the requests happening. Without creating the address book,
125 # after creating a contact, a sync would delete it.
127 # Address books correspond to .props files in the radicale dir.
129 # Some background is here,
130 # https://davdroid.bitfire.at/faq/entry/cant-manage-groups-on-device/
131 # which shows separate vcard option is from rfc 6350, the other is 2426,
132 # radicale page says it implements the former not the latter,
133 # which conflicts with the documentation of which to select, but whatever.
134 # http://radicale.org/technical_choices/
135 # https://davdroid.bitfire.at/faq/entry/cant-manage-groups-on-device/
137 # Note, url above says only cayanogenmod 13+ and omnirom can manage groups.
139 # Note, radicale had built-in git support to track changes, but they