script support - 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 effd83e11ba14b330cc585cc85830d3841f8b5d8
DIR parent b41d37d283f4e4d5bd18a4d37cf86cdfcb1e5759
HTML Author: Solene Rapenne <solene@perso.pw>
Date: Tue, 17 Jul 2018 13:50:35 +0200
script support
Diffstat:
M drist | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
---
DIR diff --git a/drist b/drist
@@ -1,9 +1,8 @@
#!/bin/sh
-set -x
-if [ -z "$1" ]
+if [ "$#" -ne 1 ]
then
- echo "il faut indiquer un serveur"
+ echo "You should pass a server as a parameter"
exit 1
else
HOSTNAME=$(ssh "$1" hostname -s)
@@ -22,7 +21,7 @@ then
then
find files/ -type f | cut -d '/' -f 2- > "${LIST}"
cat $LIST
- rsync -vlD --files-from="${LIST}" files/ ${1}:/
+ rsync -vlD --files-from="${LIST}" files/ "${1}":/
rm "$LIST"
fi
fi
@@ -33,7 +32,27 @@ then
if [ -f "$LIST" ]
then
find "files-${HOSTNAME}/" -type f | cut -d '/' -f 2- > "${LIST}"
- rsync -vlD --files-from="${LIST}" "files-${HOSTNAME}/" ${1}:/
+ rsync -vlD --files-from="${LIST}" "files-${HOSTNAME}/" "${1}":/
rm "$LIST"
fi
fi
+
+if [ -f "script" ]
+then
+ cat "script" | \
+ ssh "${1}" 'DRIST=$(mktemp /tmp/drist.XXXXXXXXXXXX) &&
+ cat - > "$DRIST" &&
+ chmod u+x "$DRIST" &&
+ "$DRIST" ;
+ rm "$DRIST"'
+fi
+
+if [ -f "script-${HOSTNAME}" ]
+then
+ cat "script-${HOSTNAME}" | \
+ ssh "${1}" 'DRIST=$(mktemp /tmp/drist.XXXXXXXXXXXX) &&
+ cat - > "$DRIST" &&
+ chmod u+x "$DRIST" &&
+ "$DRIST" ;
+ rm "$DRIST"'
+fi