1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/agendav_ynh.git synced 2024-09-03 20:36:12 +02:00

support baikal, fallback on radicale

This commit is contained in:
Julien Malik 2014-07-02 09:35:12 +02:00
parent 36dc57a65c
commit 06655136e6
2 changed files with 30 additions and 9 deletions

View file

@ -44,7 +44,7 @@ $config['caldav_http_auth_method'] = CURLAUTH_BASIC;
* - Apple Calendar Server: https://host/calendars/users/%u/
*/
$config['caldav_principal_url'] = 'https://YNH_DOMAINYNH_RADICALE_PATH/%u/';
$config['caldav_principal_url'] = 'YNH_CALDAV_PRINCIPAL_URL';
/*
* CalDAV calendars URL template
@ -59,7 +59,7 @@ $config['caldav_principal_url'] = 'https://YNH_DOMAINYNH_RADICALE_PATH/%u/';
* - Apple Calendar Server: https://host/calendars/users/%s/
*/
$config['caldav_calendar_url'] = 'https://YNH_DOMAINYNH_RADICALE_PATH/%s/';
$config['caldav_calendar_url'] = 'YNH_CALDAV_CALENDAR_URL';
/*
* Public CalDAV URL for calendars

View file

@ -11,10 +11,24 @@ if [[ ! $? -eq 0 ]]; then
exit 1
fi
baikal=0
radicale=0
sudo yunohost app list --json | grep -q '"id": "baikal"'
if [[ $? -eq 0 ]]; then
baikal=1
caldavapp=baikal
fi
sudo yunohost app list --json | grep -q '"id": "radicale"'
if [[ ! $? -eq 0 ]]; then
echo "Error : Radicale app is not installed"
exit 1
if [[ $? -eq 0 ]]; then
radicale=1
caldavapp=radicale
fi
if [ $baikal -eq 0 ] && [ $radicale -eq 0 ]; then
echo "Error : You must install Baikal or Radicale before"
exit 1
fi
# Install dependencies
@ -41,10 +55,17 @@ currentpath=$(pwd)
cd $final_path/web/application && ln -s ../config config && cd $currentpath
# caldav config
radicale_path=$(sudo yunohost app setting radicale path)
radicale_path=${radicale_path%/}
sed -i "s@YNH_DOMAIN@$domain@g" ../conf/caldav.php
sed -i "s@YNH_RADICALE_PATH@$radicale_path@g" ../conf/caldav.php
caldavdomain=$(sudo yunohost app setting $caldavapp domain)
caldavpath=$(sudo yunohost app setting $caldavapp path)
if [ $baikal -eq 1 ]; then
caldav_principal_url="https://$(caldavdomain)$(caldavpath)/cal.php/%u/"
caldav_calendar_url="https://$(caldavdomain)$(caldavpath)/cal.php/calendars/%s/"
elif [ $radicale -eq 1 ]; then
caldav_principal_url="https://$(caldavdomain)$(caldavpath)/%u/"
caldav_calendar_url="https://$(caldavdomain)$(caldavpath)/%s/"
fi
sed -i "s@YNH_CALDAV_PRINCIPAL_URL@$caldav_principal_url@g" ../conf/caldav.php
sed -i "s@YNH_CALDAV_CALENDAR_URL@$caldav_calendar_url@g" ../conf/caldav.php
# database config
sed -i "s/YNH_DB_USER/$db_user/g" ../conf/database.php