3 [[ $EUID == 0 ]] ||
exec sudo
-E "$BASH_SOURCE" "$@"
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 _ _ uid _
< <(getent passwd radicale
); unset IFS
53 IFS
=:; read _ _ 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 find /o
/radicale
/var
/log
/radicale
-xdev -exec chown
-h 609 {} +
61 find /o
/radicale
-xdev -exec chgrp
-h 609 {} +
64 # I moved /var/lib/radicale after it's initialization.
65 # I did a sudo -u radicale git init in the collections subfolder
66 # after it gets created, per the git docs.
67 /a
/exe
/lnf
-T /o
/radicale
/var
/lib
/radicale
69 # from https://www.williamjbowman.com/blog/2015/07/24/setting-up-webdav-caldav-and-carddav-servers/
71 # more config is for li in distro-end
73 # coment in this file says this is needed for it to run on startup
74 sed -ri 's/^\s*#+\s*(ENABLE_RADICALE\s*=\s*yes\s*)/\1/' /etc
/default
/radicale
77 key
="$1" value
="$2" section
="$3"
78 file="/etc/radicale/config"
79 sed -ri "/ *\[$section\]/,/^ *\[[^]]+\]/{/^\s*$key[[:space:]=]/d};/ *\[$section\]/a $key = $value" "$file"
82 # comments say default is 0.0.0.0:5232
83 setini hosts
10.8.0.4:5232 server
85 if [[ $HOSTNAME == $MAIL_HOST ]]; then
86 systemctl start radicale
87 systemctl
enable radicale
90 # disable power management feature, set to 240 min sync interval,
91 # so it shouldn't be bad.
93 # davdroid from f-druid.
94 # login with url and user name
95 # url https://cal.iankelling.org/ian
97 # pass, see password manager for radicale
101 # set account name as ian@iankelling.org, per help text below the
104 # switch to groups are per-contact categories,
105 # per https://davdroid.bitfire.at/configuration/radicale/
108 # After setting up account, I added one address book, named
109 # ianaddr. calender was already created, named ian. checked boxes under
112 # To restore from old phone to new phone, I wiped all data out, then copied over the newly created files. I think
114 # ignorable background info:
116 # opentasks uses the calendar file.
118 # The address book I created got a uuid as a name for the file. Note
119 # the .props file says if it's a calendar or addressbook.
121 # When debugging, tailed /var/log/radicale/radicale.log and apache log,
122 # both show the requests happening. Without creating the address book,
123 # after creating a contact, a sync would delete it.
125 # Address books correspond to .props files in the radicale dir.
127 # Some background is here,
128 # https://davdroid.bitfire.at/faq/entry/cant-manage-groups-on-device/
129 # which shows separate vcard option is from rfc 6350, the other is 2426,
130 # radicale page says it implements the former not the latter,
131 # which conflicts with the documentation of which to select, but whatever.
132 # http://radicale.org/technical_choices/
133 # https://davdroid.bitfire.at/faq/entry/cant-manage-groups-on-device/
135 # Note, url above says only cayanogenmod 13+ and omnirom can manage groups.
137 # Note, radicale had built-in git support to track changes, but they