From eccb39fc98f54c1d9559cd0905d47ffd5179cf80 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 16 Nov 2016 23:55:51 +0000 Subject: [PATCH] Create a default calendar --- src/freedombone-app-radicale | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/freedombone-app-radicale b/src/freedombone-app-radicale index ea2bc8e2..79595fda 100755 --- a/src/freedombone-app-radicale +++ b/src/freedombone-app-radicale @@ -53,6 +53,12 @@ function remove_user_radicale { remove_username="$1" if grep "$remove_username:" ${RADICALE_USERS}; then sed -i "/$remove_username:/d" ${RADICALE_USERS} + if [ -d /var/www/radicale/collections/${remove_username} ]; then + rm -rf /var/www/radicale/collections/${remove_username} + fi + if [ -f /var/www/radicale/collections/${remove_username}.props ]; then + rm /var/www/radicale/collections/${remove_username}.props + fi systemctl reload radicale fi } @@ -67,7 +73,15 @@ function add_user_radicale { if ! grep "$new_username:" ${RADICALE_USERS}; then htpasswd -bd ${RADICALE_USERS} "$new_username" "$new_user_password" - chown www-data:www-data ${RADICALE_USERS} + + echo '{"ICAL:calendar-color": "#9e50df"}' > /var/www/radicale/collections/${new_username}.props + mkdir /var/www/radicale/collections/${new_username} + echo '{"ICAL:calendar-color": "#de631a", "tag": "VCALENDAR"}' > /var/www/radicale/collections/${new_username}/calendar.props + echo 'BEGIN:VCALENDAR' > /var/www/radicale/collections/${new_username}/calendar + echo 'PRODID:-//Radicale//NONSGML Radicale Server//EN' >> /var/www/radicale/collections/${new_username}/calendar + echo 'VERSION:2.0' >> /var/www/radicale/collections/${new_username}/calendar + echo 'END:VCALENDAR' >> /var/www/radicale/collections/${new_username}/calendar + chown -R www-data:www-data /var/www/radicale systemctl reload radicale fi echo '0' @@ -279,6 +293,10 @@ function install_radicale { echo 'type = filesystem' >> ${RADICALE_DIRECTORY}/config echo "filesystem_folder = /var/www/radicale/collections" >> ${RADICALE_DIRECTORY}/config echo '' >> ${RADICALE_DIRECTORY}/config + echo '[well-known]' >> ${RADICALE_DIRECTORY}/config + echo "caldav = '/%(user)s/caldav/'" >> ${RADICALE_DIRECTORY}/config + echo "carddav = '/%(user)s/carddav/'" >> ${RADICALE_DIRECTORY}/config + echo '' >> ${RADICALE_DIRECTORY}/config echo '[logging]' >> ${RADICALE_DIRECTORY}/config echo 'debug = False' >> ${RADICALE_DIRECTORY}/config