From 7e59e1390be3674e30647a223d24fdc51e8d84a8 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 22 Sep 2014 22:10:46 -0300 Subject: Renaming script to sync-all --- sync-all | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- sync-code | 52 +--------------------------------------------------- sync-home | 2 +- sync-irssi | 2 +- sync-irssi-tor | 2 +- 5 files changed, 55 insertions(+), 55 deletions(-) mode change 120000 => 100755 sync-all mode change 100755 => 120000 sync-code diff --git a/sync-all b/sync-all deleted file mode 120000 index e737e41..0000000 --- a/sync-all +++ /dev/null @@ -1 +0,0 @@ -sync-code \ No newline at end of file diff --git a/sync-all b/sync-all new file mode 100755 index 0000000..1d1ccc9 --- /dev/null +++ b/sync-all @@ -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-code b/sync-code deleted file mode 100755 index 1d1ccc9..0000000 --- a/sync-code +++ /dev/null @@ -1,51 +0,0 @@ -#!/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-code b/sync-code new file mode 120000 index 0000000..4ae0e16 --- /dev/null +++ b/sync-code @@ -0,0 +1 @@ +sync-all \ No newline at end of file diff --git a/sync-home b/sync-home index e737e41..4ae0e16 120000 --- a/sync-home +++ b/sync-home @@ -1 +1 @@ -sync-code \ No newline at end of file +sync-all \ No newline at end of file diff --git a/sync-irssi b/sync-irssi index e737e41..4ae0e16 120000 --- a/sync-irssi +++ b/sync-irssi @@ -1 +1 @@ -sync-code \ No newline at end of file +sync-all \ No newline at end of file diff --git a/sync-irssi-tor b/sync-irssi-tor index e737e41..4ae0e16 120000 --- a/sync-irssi-tor +++ b/sync-irssi-tor @@ -1 +1 @@ -sync-code \ No newline at end of file +sync-all \ No newline at end of file -- cgit v1.2.3