#!/bin/bash

#new unison code
/usr/bin/unison /Users/diger/Skola /Volumes/Lexar/Skola -ui text -silent -perms 0 -rsrc true -prefer /Users/diger/Skola -times

/usr/bin/unison /Users/diger/Documents /Volumes/Lexar/Dokument -ui text -silent -perms 0 -rsrc true -prefer /Users/diger/Documents -times

retval=`/usr/local/bin/CocoaDialog.app/Contents/MacOS/CocoaDialog yesno-msgbox --no-cancel --title "Unmount lexar" --text "Should I unmount lexar?" --float --icon finder --informative-text "The automatic sync is now complete. Should I proceed with unmount?"`

if [ "$retval" == "1" ]; then
    /usr/sbin/diskutil eject /Volumes/Lexar
fi

#Old rsync code

#Rsync documents
#rsync -au --modify-window=1 /Volumes/Lexar/Dokument/ /Users/diger/Documents

#rsync -au --modify-window=1 /Users/diger/Documents/ /Volumes/Lexar/Dokument

#Rsync scool work
#rsync -au --modify-window=1 /Volumes/Lexar/Skola/ /Users/diger/Skola

#rsync -au --modify-window=1 /Users/diger/Skola/ /Volumes/Lexar/Skola