aboutsummaryrefslogtreecommitdiff
path: root/sync-code
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-09-18 16:37:04 -0300
committerSilvio Rhatto <user@example.org>2014-09-18 16:37:04 -0300
commit4e71c072d8d1b0540efafe77115550656b0fce46 (patch)
tree945cd21d38e0f636d64e1ae955d27cffdf742ea1 /sync-code
downloadunisyncer-4e71c072d8d1b0540efafe77115550656b0fce46.tar.gz
unisyncer-4e71c072d8d1b0540efafe77115550656b0fce46.tar.bz2
Initial import
Diffstat (limited to 'sync-code')
-rwxr-xr-xsync-code51
1 files changed, 51 insertions, 0 deletions
diff --git a/sync-code b/sync-code
new file mode 100755
index 0000000..1d1ccc9
--- /dev/null
+++ b/sync-code
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# sync code or home folder across systems
+#
+
+BASENAME="`basename $0`"
+DEST="$1"
+UNISON="unison"
+
+# Use the following config if you need to sync with legacy systems
+UNISON="unison-2.32.52"
+
+function sync_code_run {
+ local config="$1"
+
+ if [ -z "$config" ]; then
+ return
+ fi
+
+ if [ -f "$HOME/.unison/$config.prf" ]; then
+ echo "Starting sync using $config..."
+ $UNISON $config
+ else
+ echo "Skipping absent profile $config."
+ return
+ 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