summaryrefslogtreecommitdiff
path: root/scripts/sync
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sync')
-rwxr-xr-xscripts/sync/pull.sh8
-rwxr-xr-xscripts/sync/push.sh10
2 files changed, 14 insertions, 4 deletions
diff --git a/scripts/sync/pull.sh b/scripts/sync/pull.sh
index 1bf5b48..924499a 100755
--- a/scripts/sync/pull.sh
+++ b/scripts/sync/pull.sh
@@ -3,7 +3,7 @@
set -e
SOURCE="$(cat remote)/"
-if [ ! -d $SOURCE ]; then
+if [ ! -d $SOURCE ] && [[ ! $SOURCE =~ ":" ]]; then
echo "Path $SOURCE does not exist."
exit 1
fi
@@ -24,6 +24,10 @@ while getopts 'cfdr' opt; do
r) # Revert
FORCE=1
;;
+ *)
+ echo "Unknown argument"
+ exit 1
+ ;;
esac
done
@@ -31,4 +35,4 @@ if [ $FORCE = 0 ]; then
ARGS+=('--update')
fi
-rsync --archive --itemize-changes "${ARGS[@]}" $SOURCE .
+rsync --archive --itemize-changes "${ARGS[@]}" $SOURCE/$2 .
diff --git a/scripts/sync/push.sh b/scripts/sync/push.sh
index 3adbd02..9e35994 100755
--- a/scripts/sync/push.sh
+++ b/scripts/sync/push.sh
@@ -1,9 +1,11 @@
#! /usr/bin/env sh
+# https://serverfault.com/a/211083
+
set -e
DEST="$(cat remote)"
-if [ ! -d $DEST ]; then
+if [ ! -d $DEST ] && [[ ! $DEST =~ ":" ]]; then
echo "Path $DEST does not exist."
exit 1
fi
@@ -24,6 +26,10 @@ while getopts 'cfdr' opt; do
r) # Revert
FORCE=1
;;
+ *)
+ echo "Unknown argument"
+ exit 1
+ ;;
esac
done
@@ -31,4 +37,4 @@ if [ $FORCE = 0 ]; then
ARGS+=('--update')
fi
-rsync --archive --itemize-changes "${ARGS[@]}" ./ $DEST
+rsync --archive --itemize-changes "${ARGS[@]}" ./$2 $DEST