summaryrefslogtreecommitdiffstats
path: root/fb.in
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-06-27 18:55:17 +0200
committerFlorian Pritz <bluewind@xinu.at>2011-06-27 18:56:31 +0200
commitdf54bdd9eeb043265a1446f8242037c983047cb0 (patch)
tree240b2558e31b8587ab6aa043ca0a49885c69f5ee /fb.in
parentd15d1292054358678afc8f1e69c442f777756c7a (diff)
add -C option: gpg encryption
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.in')
-rw-r--r--fb.in15
1 files changed, 14 insertions, 1 deletions
diff --git a/fb.in b/fb.in
index 1bafe74..3af3b16 100644
--- a/fb.in
+++ b/fb.in
@@ -15,6 +15,7 @@ VERSION="@VERSION@"
DELETE=
EXTENSION=""
GET=
+ENCRYPT=
TAR=
COMPRESS=0
TAREXT=".tar"
@@ -62,6 +63,16 @@ do_upload() {
file="$TMPDIR/$basefilename.xz"
fi
+ basefilename="`basename -- "$file"`"
+
+ if [ "$ENCRYPT" = "1" ]; then
+ if ! gpg -o "$TMPDIR/$basefilename.gpg" -e "$file"; then
+ EXITCODE=1
+ return 1
+ fi
+ file="$TMPDIR/$basefilename.gpg"
+ fi
+
TMPFILE=`mktemp "$TMPDIR/data.XXXXXX"`
if [ `stat -c %s -- "$file"` -gt "$WARNSIZE" ]; then
WARNSIZE=`$LIBDIR/fb-helper d "$PASTEBIN/file/get_max_size"`
@@ -116,13 +127,15 @@ usage: [cat |] `basename "$0"` [switches] [options] [<file(s)|ID(s)|folder(s)>]
-t upload a tar file containing all files (and directories)
-c compress the file being uploaded with gz or xz if used 2 times
When used in conjunction with -g this decompresses the download
+ -C encrypt the file being uploaded
!
}
-while getopts "e:gdhtcv" OPTION; do
+while getopts "e:gdhtcCv" OPTION; do
case $OPTION in
e) EXTENSION="$OPTARG";;
g) GET=1;;
+ C) ENCRYPT=1; require_executable gpg;;
c) COMPRESS=`expr $COMPRESS + 1`
if [ "$COMPRESS" == "1" ]; then
TAROPTS="-z"