aboutsummaryrefslogtreecommitdiff
path: root/sync-code
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-05-25 16:58:57 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-05-25 16:58:57 -0300
commit7cc8991464d46f6fce0882142ef2135c562f80e6 (patch)
tree660fe33c2873df53e40ac33ef133f1fd38b5056c /sync-code
parent2eeb04e645198842c3094cb0ef84f50e4b9bd54f (diff)
downloadscripts-7cc8991464d46f6fce0882142ef2135c562f80e6.tar.gz
scripts-7cc8991464d46f6fce0882142ef2135c562f80e6.tar.bz2
Adding sync-all
Diffstat (limited to 'sync-code')
-rwxr-xr-xsync-code44
1 files changed, 32 insertions, 12 deletions
diff --git a/sync-code b/sync-code
index eece25f..5895491 100755
--- a/sync-code
+++ b/sync-code
@@ -10,23 +10,43 @@ UNISON="unison"
# Use the following config if you need to sync with legacy systems
UNISON="unison-2.32.52"
-if [ ! -z "$DEST" ]; then
+function sync_code_run {
+ local config="$1"
- if [ "$BASENAME" == "sync-code" ]; then
- profile="$DEST-code"
- elif [ "$BASENAME" == "sync-irssi" ]; then
- profile="$DEST-irssi"
- elif [ "$BASENAME" == "sync-irssi-tor" ]; then
- profile="$DEST-irssi-tor"
- else
- profile="$DEST-home"
+ if [ -z "$config" ]; then
+ return
fi
- if [ -f "$HOME/.unison/$profile.prf" ]; then
- $UNISON $profile
+ if [ -f "$HOME/.unison/$config.prf" ]; then
+ echo "Starting sync using $config..."
+ $UNISON $config
else
- echo "No such profile $HOME/.unison/$profile.prf"
+ echo "No such profile $HOME/.unison/$config.prf"
exit 1
fi
+}
+
+if [ ! -z "$DEST" ]; then
+ profiles=""
+
+ if [ "$BASENAME" == "sync-code" ] || [ "$BASENAME" == "sync-all" ]; then
+ profiles="$profiles $DEST-code"
+ fi
+
+ if [ "$BASENAME" == "sync-irssi" ] || [ "$BASENAME" == "sync-all" ]; then
+ profiles="$profiles $DEST-irssi"
+ fi
+
+ if [ "$BASENAME" == "sync-irssi-tor" ] || [ "$BASENAME" == "sync-all" ]; then
+ profiles="$profiles $DEST-irssi-tor"
+ fi
+
+ if [ "$BASENAME" == "sync-home" ] || [ "$BASENAME" == "sync-all" ]; then
+ profiles="$profiles $DEST-home"
+ fi
+
+ for profile in $profiles; do
+ sync_code_run $profile
+ done
fi