- Nutzung von rsync-kde abhängig von der Session
authorJosef Spillner <josef.spillner@tu-dresden.de>
Sun, 26 Feb 2012 10:47:59 +0000 (07:47 -0300)
committerJosef Spillner <josef.spillner@tu-dresden.de>
Sun, 26 Feb 2012 10:47:59 +0000 (07:47 -0300)
- Abbruch bei Nichtvorhandensein des Splitter-Verzeichnisses

kde-cloudstorage/kde-integration/nubisavelink
kde-cloudstorage/kde-integration/syncme

index adb2dc6..083d5fb 100755 (executable)
@@ -2,16 +2,22 @@
 #
 # Links a file or directory to the NubiSave splitter folder
 
-splitterfolder=$HOME/nubisave
-
-which syncme >/dev/null
-
 if [ -z $1 ]
 then
        echo "Syntax error: nubisavelink [--move] <sourcepath>" >&2
        exit 1
 fi
 
+splitterfolder=$HOME/nubisave
+
+if [ ! -d $splitterfolder ]
+then
+       kdialog \
+               --sorry "The cloud storage directory [$splitterfolder] is not available.\nNubiSave needs to be activated first." \
+               --title "Cloud Synchronisation"
+       exit 1
+fi
+
 move=0
 src=$1
 if [ "$src" = "--move" ]
@@ -22,6 +28,7 @@ fi
 
 if [ $move -eq 0 ]
 then
+       which syncme >/dev/null
        if [ $? != 0 ]
        then
                # FIXME: Symbolic links are not supported, obviously
index 977b952..f048ac0 100755 (executable)
@@ -72,7 +72,15 @@ class Syncer():
 
        def sync(self):
                print "[syncme-daemon (%s->%s)] start" % (self.sourcedir, self.targetdir)
-               os.system("rsync -az '%s' '%s'" % (self.sourcedir, self.targetdir))
+               rsynckde=False
+               if os.getenv("DESKTOP_SESSION") == "kde-plasma":
+                       # FIXME: would be more flexible to just call and check exit status?
+                       if os.path.isfile("/usr/bin/rsync-kde") or os.path.isfile("/usr/local/bin/rsync-kde"):
+                               rsynckde=True
+               if rsynckde:
+                       os.system("rsync-kde '%s' '%s'" % (self.sourcedir, self.targetdir))
+               else:
+                       os.system("rsync -az '%s' '%s'" % (self.sourcedir, self.targetdir))
                print "[syncme-daemon (%s->%s)] finish" % (self.sourcedir, self.targetdir)
 
 class Daemon():