summaryrefslogtreecommitdiffstats
path: root/bin/sync-volume
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sync-volume')
-rwxr-xr-xbin/sync-volume35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/sync-volume b/bin/sync-volume
new file mode 100755
index 0000000..2cab139
--- /dev/null
+++ b/bin/sync-volume
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+PROFIL="${1}"
+IS_AUTO="${2}"
+
+if [ ! -e "$HOME/.unison/${PROFIL}.prf" ]
+then
+ echo "Le profil ${PROFIL} n'existe pas" >&2
+ exit 1
+fi
+
+ROOT=$(grep -r "^root *=" $HOME/.unison/${PROFIL}.prf | sed -e 's/^root *= *//')
+for dossier in ${ROOT}
+do
+ if [ ! -x "${dossier}" ]
+ then
+ if [ -z "${IS_AUTO}" ]
+ then
+ echo "Le dossier ${dossier} n'est pas lisible" >&2
+ exit 1
+ else
+ exit 0
+ fi
+ fi
+done
+
+
+if [ -z "${IS_AUTO}" ]
+then
+ unison -ui text "${PROFIL}"
+else
+ nodeletion=$(grep -r "^root *=" $HOME/.unison/${PROFIL}.prf | sed -e 's/root *=/-nodeletion/')
+
+ unison -ui text -silent -batch $nodeletion "${PROFIL}"
+fi