summaryrefslogtreecommitdiff
path: root/etc/functions
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-09-25 19:08:57 +0200
committerDaniel Friesel <derf@finalrewind.org>2010-09-25 19:08:57 +0200
commit07ffea44abf0c1045c335ea1ba941b1bcc3bde60 (patch)
treebe97bcdfc37dd4389d58f44721e9be17fd485ae7 /etc/functions
parent75c21d18aa9380af4e8e8c61b46b310c7517c803 (diff)
put: Support directories
Diffstat (limited to 'etc/functions')
-rw-r--r--etc/functions/put9
1 files changed, 7 insertions, 2 deletions
diff --git a/etc/functions/put b/etc/functions/put
index 940c22c..aa99c63 100644
--- a/etc/functions/put
+++ b/etc/functions/put
@@ -53,12 +53,17 @@ while [[ ${1} == -* ]] {
shift
}
-if [[ ! -f ${1} ]] {
+if [[ ! -e ${1} ]] {
echo "${1}: No such file" >&2
return 1
}
-file=${1}
+if [[ -d ${1} ]] {
+ tar -C ${1:h} -cJf /tmp/${1:t}.tar.xz ${1:t}
+ file=/tmp/${1:t}.tar.xz
+} else {
+ file=${1}
+}
while (( ${#hosts} )) {
remote_file=${file:t}