Last active
July 30, 2020 08:24
-
-
Save tcarrondo/df8594a79cf8936d7f2ce52dbc525b15 to your computer and use it in GitHub Desktop.
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 | |
# Simplified by me, Tiago Carrondo <[email protected]> | |
# Thanks to: Romain Fluttaz <[email protected]> | |
# Thanks to: Wayne Ward <[email protected]> | |
# Thanks to: Mitchell Reese <[email protected]> | |
# --------------- [ Server ] ---------------- # | |
CONTACTS_URL=" " # add the carddav URL here | |
USERNAME=" " # you know this one | |
PASSWORD=" " # lots of ****** | |
# ----------------- [ Phone ] ----------------- # | |
CONFIG_NAME=" " # I use "mycloud" (only lowercase allowed) | |
CONTACTS_NAME=" " # I use "personalcontacts" | |
CONTACTS_VISUAL_NAME=" " # you can choose a nice name to show on the contacts app like "OwnContacts" | |
CRON_FREQUENCY= " " # I use "hourly" | |
#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@$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@$CONFIG_NAME $CONTACTS_NAME | |
#Connect remote contact list with local databases | |
syncevolution --configure --template SyncEvolution_Client Sync=None syncURL=local://@$CONFIG_NAME $CONFIG_NAME $CONTACTS_NAME | |
#Add local database to the source | |
syncevolution --configure sync=two-way backend=evolution-contacts database=$CONTACTS_VISUAL_NAME $CONFIG_NAME $CONTACTS_NAME | |
#Start first sync | |
syncevolution --sync refresh-from-remote $CONFIG_NAME $CONTACTS_NAME | |
#Add Sync Cronjob | |
sudo mount / -o remount,rw | |
CRON_LINE="@$CRON_FREQUENCY 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 $CONFIG_NAME" | |
(crontab -u phablet -l; echo "$CRON_LINE" ) | crontab -u phablet - | |
sudo mount / -o remount,ro | |
sudo service cron restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In line 16 I added
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)
Than script works without errors on my fairphone 2