file copy ok - drist - a remote deployment tool
HTML git clone git://bitreich.org/drist/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/drist/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit b41d37d283f4e4d5bd18a4d37cf86cdfcb1e5759
HTML Author: Solene Rapenne <solene@perso.pw>
Date: Tue, 17 Jul 2018 11:58:33 +0200
file copy ok
Diffstat:
A drist | 39 +++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+), 0 deletions(-)
---
DIR diff --git a/drist b/drist
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -x
+
+if [ -z "$1" ]
+then
+ echo "il faut indiquer un serveur"
+ exit 1
+else
+ HOSTNAME=$(ssh "$1" hostname -s)
+ if [ "$?" -ne 0 ]
+ then
+ echo "Error while ssh ${1}"
+ exit 2
+ fi
+fi
+
+# -l = keep symlink / -D = special device
+if [ -d "files" ]
+then
+ LIST=$(mktemp /tmp/drist-rsync.XXXXXXXXXX)
+ if [ -f "$LIST" ]
+ then
+ find files/ -type f | cut -d '/' -f 2- > "${LIST}"
+ cat $LIST
+ rsync -vlD --files-from="${LIST}" files/ ${1}:/
+ rm "$LIST"
+ fi
+fi
+
+if [ -d "files-${HOSTNAME}" ]
+then
+ LIST=$(mktemp /tmp/drist-rsync.XXXXXXXXXX)
+ if [ -f "$LIST" ]
+ then
+ find "files-${HOSTNAME}/" -type f | cut -d '/' -f 2- > "${LIST}"
+ rsync -vlD --files-from="${LIST}" "files-${HOSTNAME}/" ${1}:/
+ rm "$LIST"
+ fi
+fi