]> gitweb.fluxo.info Git - unisyncer.git/commitdiff
Initial import
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 18 Sep 2014 19:37:04 +0000 (16:37 -0300)
committerSilvio Rhatto <user@example.org>
Thu, 18 Sep 2014 19:37:04 +0000 (16:37 -0300)
README.md [new file with mode: 0644]
TODO.md [new file with mode: 0644]
sync-all [new symlink]
sync-code [new file with mode: 0755]
sync-home [new symlink]
sync-irssi [new symlink]
sync-irssi-tor [new symlink]

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/TODO.md b/TODO.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/sync-all b/sync-all
new file mode 120000 (symlink)
index 0000000..e737e41
--- /dev/null
+++ b/sync-all
@@ -0,0 +1 @@
+sync-code
\ No newline at end of file
diff --git a/sync-code b/sync-code
new file mode 100755 (executable)
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
diff --git a/sync-home b/sync-home
new file mode 120000 (symlink)
index 0000000..e737e41
--- /dev/null
+++ b/sync-home
@@ -0,0 +1 @@
+sync-code
\ No newline at end of file
diff --git a/sync-irssi b/sync-irssi
new file mode 120000 (symlink)
index 0000000..e737e41
--- /dev/null
@@ -0,0 +1 @@
+sync-code
\ No newline at end of file
diff --git a/sync-irssi-tor b/sync-irssi-tor
new file mode 120000 (symlink)
index 0000000..e737e41
--- /dev/null
@@ -0,0 +1 @@
+sync-code
\ No newline at end of file