aboutsummaryrefslogtreecommitdiffstats
path: root/jsaccess/jstore.sh
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-06-18 16:06:24 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2013-06-18 16:06:45 +0200
commit50e871b4ce0ddbea9c957822052caefb5dd8c8fe (patch)
tree1473a449b3a3cf07317e2b04363334074d38e257 /jsaccess/jstore.sh
parentjsaccess: add deployment command (diff)
downloadlaurent-tools-50e871b4ce0ddbea9c957822052caefb5dd8c8fe.tar.xz
laurent-tools-50e871b4ce0ddbea9c957822052caefb5dd8c8fe.zip
jsaccess: add "jstore clone <rsync_uri> localstore"
Diffstat (limited to 'jsaccess/jstore.sh')
-rwxr-xr-xjsaccess/jstore.sh23
1 files changed, 19 insertions, 4 deletions
diff --git a/jsaccess/jstore.sh b/jsaccess/jstore.sh
index b0177b2..4bb40df 100755
--- a/jsaccess/jstore.sh
+++ b/jsaccess/jstore.sh
@@ -37,6 +37,7 @@ usage_exit() {
echo " push [store]"
echo " rset <rsync_uri> [store]"
echo " rget [store]"
+ echo " clone <rsync_uri> <store>"
echo
echo "actions to get informations:"
echo " help|-h"
@@ -221,6 +222,14 @@ action_wipe() {
echo "DELETED store \"$store\""
}
+action_push() {
+ _rget
+ rm -f $tmp
+ cmd="rsync -rvzP --delete $store/ $rsync_uri"
+ echo "Running \"$cmd\""
+ $cmd
+}
+
action_rset() {
_rset $1
}
@@ -230,12 +239,14 @@ action_rget() {
echo "rsync_uri: $rsync_uri"
}
-action_push() {
- _rget
- rm -f $tmp
- cmd="rsync -rvzP --delete $store/ $rsync_uri"
+action_clone() {
+ rsync_uri=$1
+ store=$2
+ [ -e $store ] && echo "ERROR: $store already exists" && clean_exit 1
+ cmd="rsync -rvzP --delete $rsync_uri $store"
echo "Running \"$cmd\""
$cmd
+ echo "CREATED store \"store\""
}
# Check for dependencies
@@ -298,6 +309,10 @@ rget)
_store_get $2
action_rget
;;
+clone)
+ [ $# -ne 3 ] && usage_exit
+ action_clone $2 $3
+ ;;
help|-h|version|-V)
usage_exit
;;