From 12240fb74c0c6f2768e1070f849cd265ea3dd181 Mon Sep 17 00:00:00 2001 From: VG Date: Wed, 28 Jan 2015 18:45:29 +0100 Subject: First commit --- scripts/shareit | 28 ++++++++++++++++++++++++++++ scripts/shareit-scrot | 14 ++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 scripts/shareit create mode 100755 scripts/shareit-scrot (limited to 'scripts') diff --git a/scripts/shareit b/scripts/shareit new file mode 100755 index 0000000..0c30310 --- /dev/null +++ b/scripts/shareit @@ -0,0 +1,28 @@ +#!/bin/bash + +file="$1" +tempfile="" + +rmtempfile_cb() { rm "$tempfile"; } + +if [ "$file" == "" ]; then + tempfile="$(mktemp)" + trap rmtempfile_cb EXIT + cat > $tempfile + file=$tempfile +fi + +if [ ! -e ~/.certs/org.devys.shareit.crt ]; then + mkdir -p ~/.certs/ + gnutls-cli -p 443 shareit.devys.org --print-cert \ + ~/.certs/org.devys.shareit.crt || exit 1 +fi + +file="${file/\\/\\\\}" +file="${file/\"/\\\"}" + +curl --cacert ~/.certs/org.devys.shareit.crt \ + --netrc --form upload=@"\"$file\"" \ + https://shareit.devys.org/upload/ | \ + sed -n 's/^.*