Last active
September 8, 2022 09:25
-
-
Save bastos77/0c47a94dd0bf3e394f879c0ff42b7839 to your computer and use it in GitHub Desktop.
ubuntu touch SOGo-syncevolution syncronisation script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is a draft combination of the script found at https://gist.github.com/tcarrondo | |
# It is what I have done to make it work for my Fairphone 2 with UBports ubuntu touch 16.04 | |
# Combined by me: Sebastian Gallehr <[email protected]> | |
# Thanks to: Tiago Carrondo <[email protected]> | |
# Thanks to: Romain Fluttaz <[email protected]> | |
# Thanks to: Wayne Ward <[email protected]> | |
# Thanks to: Mitchell Reese <[email protected]> | |
# --------------- [ Server ] ---------------- # | |
CAL_URL="https://..." # add the caldav URL here | |
CONTACTS_URL="https://...." # add the carddav URL here | |
USERNAME="" # you know this one | |
PASSWORD="" # lots of ****** | |
# ----------------- [ Phone ] ----------------- # | |
CALENDAR_CONFIG_NAME="sogokalender" # I use "myCloud" | |
CONTACTS_CONFIG_NAME="sogoadressen" # I use "myCloud" | |
CALENDAR_NAME="sogokalender" # I use "personalcalendar" | |
CALENDAR_VISUAL_NAME="sogokalender" # you can choose a nice name to show on the calendar app like "OwnCalendar" | |
CONTACTS_NAME="sogoadressen" # I use "personalcontacts" | |
CONTACTS_VISUAL_NAME="sogoadressen" # you can choose a nice name to show on the contacts app like "OwnContacts" | |
CRON_FREQUENCY="hourly" # I use "hourly" | |
export DBUS_SESSION_BUS_ADDRESS=$(ps -u phablet e | grep -Eo 'dbus-daemon.*address=unix:abstract=/tmp/dbus-[A-Za-z0-9]{10}' | tail -c35) | |
#Create Calendar | |
syncevolution --create-database backend=evolution-calendar database=$CALENDAR_VISUAL_NAME | |
#Create Peer | |
syncevolution --configure --template webdav username=$USERNAME password=$PASSWORD syncURL=$CAL_URL keyring=no target-config@$CALENDAR_CONFIG_NAME | |
#Create New Source | |
syncevolution --configure backend=evolution-calendar database=$CALENDAR_VISUAL_NAME @default $CALENDAR_NAME | |
#Add remote database | |
syncevolution --configure database=$CAL_URL backend=caldav target-config@$CALENDAR_CONFIG_NAME $CALENDAR_NAME | |
#Connect remote calendars with local databases | |
syncevolution --configure --template SyncEvolution_Client syncURL=local://@$CALENDAR_CONFIG_NAME $CALENDAR_CONFIG_NAME $CALENDAR_NAME | |
#Add local database to the source | |
syncevolution --configure sync=two-way database=$CALENDAR_VISUAL_NAME $CALENDAR_CONFIG_NAME $CALENDAR_NAME | |
#Start first sync | |
syncevolution --sync refresh-from-remote $CALENDAR_CONFIG_NAME $CALENDAR_NAME | |
#Create contact list | |
syncevolution --create-database backend=evolution-contacts database=$CONTACTS_VISUAL_NAME | |
#Create Peer | |
syncevolution --configure --template webdav username=$USERNAME password=$PASSWORD syncURL=$CONTACTS_URL keyring=no target-config@$CONTACTS_CONFIG_NAME | |
#Create New Source | |
syncevolution --configure backend=evolution-contacts database=$CONTACTS_VISUAL_NAME @default $CONTACTS_NAME | |
#Add remote database | |
syncevolution --configure database=$CONTACTS_URL backend=carddav target-config@$CONTACTS_CONFIG_NAME $CONTACTS_NAME | |
#Connect remote contact list with local databases | |
syncevolution --configure --template SyncEvolution_Client Sync=None syncURL=local://@$CONTACTS_CONFIG_NAME $CONTACTS_CONFIG_NAME $CONTACTS_NAME | |
#Add local database to the source | |
syncevolution --configure sync=two-way backend=evolution-contacts database=$CONTACTS_VISUAL_NAME $CONTACTS_CONFIG_NAME $CONTACTS_NAME | |
#Start first sync | |
syncevolution --sync refresh-from-remote $CONTACTS_CONFIG_NAME $CONTACTS_NAME | |
#Add Sync Cronjob | |
sudo mount / -o remount,rw | |
COMMAND_LINE="export DISPLAY=:0.0 && export DBUS_SESSION_BUS_ADDRESS=\$(ps -u phablet e | grep -Eo 'dbus-daemon.*address=unix:abstract=/tmp/dbus-[A-Za-z0-9]{10}' | tail -c35) && /usr/bin/syncevolution $CALENDAR_CONFIG_NAME && /usr/bin/syncevolution $CONTACTS_CONFIG_NAME" | |
sudo echo "$COMMAND_LINE" > /sbin/sogosync | |
sudo chmod +x /sbin/sogosync | |
CRON_LINE="@$CRON_FREQUENCY /sbin/sogosync" | |
(crontab -u phablet -r;) # only if no other cronjob already exist in the crontab | |
(crontab -u phablet -l; echo "$CRON_LINE" ) | crontab -u phablet - | |
sudo mount / -o remount,ro | |
sudo service cron restart |
where DBUS_SESSION_BUS_ADDRESS=$(ps should be replaced by DBUS_SESSION_BUS_ADDRESS=$(ps
Please can you change this script ?
done.
Hello,
Thank you for the quick answer.
Unfortunately, you did not use the right character.
You wrote "/" in "DBUS_SESSION_BUS_ADDRESS=/$(ps"
but the right one is "\" (escape character)
The right expression is
"DBUS_SESSION_BUS_ADDRESS=\$(ps"
Marc Flender
-----
Le 30/05/2022 à 14:04, Sebastian Gallehr a écrit :
… ***@***.**** commented on this gist.
------------------------------------------------------------------------
where DBUS_SESSION_BUS_ADDRESS=$(ps should be replaced by
DBUS_SESSION_BUS_ADDRESS=$(ps
Please can you change this script ?
done.
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/0c47a94dd0bf3e394f879c0ff42b7839#gistcomment-4183582>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZKITLZHF6OYNV64WKE5ECTVMSVENANCNFSM4ITJV6SA>.
You are receiving this because you commented.Message ID:
***@***.***>
@Marc-Flender thanks. I have changed it.
Sorry
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
There is an error in this script, on line 61, so that the cron jobs never work.
COMMAND_LINE="export DISPLAY=:0.0 && export DBUS_SESSION_BUS_ADDRESS=$(ps -u phablet e | grep -Eo 'dbus-daemon.*address=unix:abstract=/tmp/dbus-[A-Za-z0-9]{10}' | tail -c35) && /usr/bin/syncevolution $CALENDAR_CONFIG_NAME && /usr/bin/syncevolution $CONTACTS_CONFIG_NAME"
where
DBUS_SESSION_BUS_ADDRESS=$(ps
should be replaced byDBUS_SESSION_BUS_ADDRESS=\$(ps
Please can you change this script ?
As a matter of fact, it is used in the UBTouch Doumentation here: https://docs.ubports.com/en/latest/userguide/advanceduse/dav.html.
It would be nice .
Thanks in advance