3 # Example evolution synchronization script by Nicolas Tetreault,
4 # modified by Linus Walleij.
7 SYNC_HOME=$HOME/MTP_device_sync
9 # Define tool locations
10 SENDFILE=`which mtp-sendfile`
11 # SENDFILE="$HOME/comp-apps/bin/sendfile"
12 #EADDEXP=`which evolution-addressbook-export`
13 # This is the location in Fedora Core 5:
14 EADDEXP="/usr/libexec/evolution/2.6/evolution-addressbook-export"
16 # You need to change the name of the files
17 # that contains the calendar and contacts on your device.
18 # You can find out by starting Gnomad2, choose the data transfer
19 # tab, sort by size (it should be small files, extension .ics and .vcf)
20 # On my Zen Microphoto, the calendar and contacts files are called
21 # 6651416 with the ics and vcf extensions, respectively.
22 CALENDAR_FILE="6651416.ics"
23 CONTACTS_FILE="6651416.vcf"
25 # The evolution address book. To list your addressbooks, type:
26 # evolution-addressbook-export -l
28 # "file:///home/nt271/.evolution/addressbook/local/system
30 # "file:///home/nt271/.evolution/addressbook/local/1158600180.5386.0@sierra"
32 # I only want the Microphoto addressbook and the output will be
33 # $SYNC_HOME/contacts/Evolution_contacts.vcf
34 EVOLUTION_CONTACTS="file:///home/linus/.evolution/addressbook/local/system"
36 # Check for sync dir, create it if needed
38 if test -d $SYNC_HOME ; then
39 echo "$SYNC_HOME exists, OK."
41 echo "$SYNC_HOME must first be created..."
43 # This is a working dir for contact merging, you can put
44 # in some extra .vcf files here as well if you like.
45 mkdir $SYNC_HOME/contacts
46 # Here you can place some extra calendars to be sync:ed, you
47 # can put in some extra .ics files of any kind here.
48 mkdir $SYNC_HOME/calendars
51 # Check for prerequisites
53 if test -f $EADDEXP ; then
54 echo "evolution-addressbook-export present in $EADDEXP, OK."
56 echo "Cannot locate evolution-addressbook-export!!"
61 # Next line merges all of your tasklist, your personal calendar,
62 # and then any saved to disk calendar you have placed in
63 # $SYNC_HOME/calendars
65 cat $HOME/.evolution/tasks/local/system/tasks.ics \
66 $HOME/.evolution/calendar/local/system/calendar.ics \
67 $SYNC_HOME/calendars/*.icsĀ > $SYNC_HOME/$CALENDAR_FILE
69 # Use evolution-addressbook-export (installed with Evolution) to
70 # export your contacts to vcard.
72 $EADDEXP --format=vcard \
73 --output=$SYNC_HOME/contacts/Evolution_contacts.vcf \
76 # Repeat for each addressbook you want to upload.
78 # The next command will then merge all the contact lists
80 cat $SYNC_HOME/contacts/*.vcf > $SYNC_HOME/$CONTACTS_FILE
82 # The calendar and contacts files now need to be converted from unix
83 # to DOS linefeeds (CR+LF instead of just LF)
85 unix2dos $SYNC_HOME/$CALENDAR_FILE $SYNC_HOME/$CONTACTS_FILE
87 # You can now upload the ics and vcf files to you My Organizer folder
88 # on your device. Change the path to your sendfile command.
89 # Sending the vcf file is only supported in CVS version at this time
91 $SENDFILE -f "My Organizer" -t ics $SYNC_HOME/$CALENDAR_FILE
92 $SENDFILE -f "My Organizer" -t vcf $SYNC_HOME/$CONTACTS_FILE