Create a default calendar

This commit is contained in:
Bob Mottram 2016-11-16 23:55:51 +00:00
parent 9673b4ceed
commit eccb39fc98
1 changed files with 19 additions and 1 deletions

View File

@ -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