various fixes
[distro-setup] / radicale-setup
index 2f22e642b6429c8917547478bdd8e2951ccad544..cb27eda4ec1d93165c50723d72d10f59a7938fea 100755 (executable)
@@ -9,10 +9,28 @@
 # http://radicale.org/user_documentation/
 # https://davdroid.bitfire.at/configuration/
 
+# note on debugging: if radicale can't bind to the address,
+# in the log it just says "Starting Radicale". If you run
+# it in the foreground, it will give more info. Background
+# plus debug does not help.
+# sudo -u radicale radicale -D -f
 
 # created password file with:
 # htpasswd -c /etc/davpass dav
 
+d=/etc/systemd/system/radicale.service.d
+mkdir -p $d
+sudo dd of=$d/override.conf <<'EOF'
+[Unit]
+# this unit is configured to start and stop whenever openvpn-client@mail.service
+# does
+After=network.target
+BindsTo=openvpn-client@mail.service
+After=openvpn-client@mail.service
+
+[Install]
+RequiredBy=openvpn-client@mail.service
+EOF
 
 pi radicale
 
@@ -36,31 +54,44 @@ setini() {
 
 # comments say default is 0.0.0.0:5232
 setini hosts 10.8.0.4:5232 server
-sgo radicale
 
-# davdroid from f-droid.
+if [[ $HOSTNAME == $MAIL_HOST ]]; then
+    sgo radicale
+fi
+
+# disable power management feature, set to 240 min sync interval,
+# so it shouldn't be bad.
+
+# davdroid from f-druid.
 # login with url and user name
 # username ian,
 # url https://cal.iankelling.org
 # username ian
 # pass, see password manager
-# I disabled power management feature, it's got 240 min sync interval,
-# so it shouldn't be bad.
 #
-
-# when setting up davdroid, switch to groups are per-contact categories,
-# per https://davdroid.bitfire.at/configuration/radicale/
+# add account dialog:
 #
 # set account name as ian@iankelling.org, per help text below the
 # field.
 #
+# switch to groups are per-contact categories,
+# per https://davdroid.bitfire.at/configuration/radicale/
+#
+#
 # After setting up account, I added one address book, named
-# ian. calender was already created, named ian. checked boxes under
+# ianaddr. calender was already created, named ian. checked boxes under
 # both. synced.
 #
+# To restore from old phone to new phone, I wiped all data out, then copied over the newly created files. I think
+#
 # ignorable background info:
 #
-# When debugging, tailed /var/log/radicale/radicale.log and nginx log,
+# opentasks uses the calendar file.
+#
+# The address book I created got a uuid as a name for the file. Note
+# the .props file says if it's a calendar or addressbook.
+#
+# When debugging, tailed /var/log/radicale/radicale.log and apache log,
 # both show the requests happening. Without creating the address book,
 # after creating a contact, a sync would delete it.
 #