From 4c0306b557ad0dace66c51d32db60d0eafd05743 Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Thu, 8 Aug 2013 13:27:51 +0300 Subject: [PATCH] Sender for droopy --- droopysend | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 droopysend diff --git a/droopysend b/droopysend new file mode 100755 index 0000000..25a965d --- /dev/null +++ b/droopysend @@ -0,0 +1,25 @@ +#!/bin/bash + +#droopy uploader + +IP=128.214.60.230 +PORT=8686 + +function show_error() { + echo Cannot access $IP:$PORT + exit 1 +} + + +for f in $@ +do a=$( readlink -f "$f" ) + b=$( basename "$f" ) + [[ -f "$a" ]] && { + curl -X POST -F upfile=@"$f" http://$IP:$PORT/ || show_error + } + [[ -d "$a" ]] && { + curl -X POST -F upfile=@<( tar cz "$f" ) -F realname="$b".tgz http://$IP:$PORT/ || show_error + } +done + +