From 16382ecee75840ae6466a5dc6f973d367063d26b Mon Sep 17 00:00:00 2001 From: Moux Date: Sun, 2 Aug 2015 12:55:35 +0200 Subject: Ajout d'un script de synchronisation Enfs/SSHFS --- bin/sync-volume | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 bin/sync-volume (limited to 'bin/sync-volume') 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 -- cgit