- apparently this switch enables the application by default
[smartoffice] / kde-cloudstorage / kde-integration / nubisavelink
1 #!/bin/sh
2 #
3 # Links a file or directory to the NubiSave splitter folder
4
5 if [ -z $1 ]
6 then
7         echo "Syntax error: nubisavelink [--move] <sourcepath>" >&2
8         exit 1
9 fi
10
11 splitterfolder=$HOME/nubisave
12
13 if [ ! -d $splitterfolder ]
14 then
15         kdialog \
16                 --sorry "The cloud storage directory [$splitterfolder] is not available.\nNubiSave needs to be activated first." \
17                 --title "Cloud Synchronisation"
18         exit 1
19 fi
20
21 move=0
22 src=$1
23 if [ "$src" = "--move" ]
24 then
25         move=1
26         src=$2
27 fi
28
29 if [ $move -eq 0 ]
30 then
31         which syncme >/dev/null
32         if [ $? != 0 ]
33         then
34                 # FIXME: Symbolic links are not supported, obviously
35                 #ln -sf "$src" $splitterfolder
36                 cp -r "$src" "$splitterfolder"
37         else
38                 syncme add "$src" "$splitterfolder"
39                 # FIXME: config reload workaround by forced restart
40                 syncme stop
41                 syncme start
42         fi
43 else
44         basesrc=`basename $src`
45         mv "$src" "$splitterfolder"
46         ln -sf "$splitterfolder/$basesrc" "$src"
47 fi
48