diff options
author | Florian Pritz <bluewind@xinu.at> | 2011-06-04 22:52:15 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2011-06-04 22:52:15 +0200 |
commit | 033512b16a8afa44cd7ba3a25f8d91bf87092f2f (patch) | |
tree | d9ceac5673e21a2faefc71a3946190728d9c54e4 /fb.in | |
parent | 9ed7e989478ae322d0e0fc9c41719c33c192ad80 (diff) |
display error when required executables are missingv0.8
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.in')
-rw-r--r-- | fb.in | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -26,6 +26,13 @@ CLIPBOARD="" EXITCODE=0 LIBDIR="@LIBDIR@" +require_executable() { + if ! type $1 >/dev/null; then + echo "Error: $1 not found. Please install." >&2 + exit 1 + fi +} + do_upload() { local EXTRA="" file="$1" @@ -46,9 +53,11 @@ do_upload() { fi if [ "$COMPRESS" = "1" ]; then + require_executable gzip gzip -c -- "$file" > "$TMPDIR/$basefilename.gz" file="$TMPDIR/$basefilename.gz" elif [ "$COMPRESS" = "2" ]; then + require_executable xz xz -c -- "$file" > "$TMPDIR/$basefilename.xz" file="$TMPDIR/$basefilename.xz" fi @@ -147,8 +156,10 @@ if [ "$DELETE" ] || [ "$GET" ]; then $LIBDIR/fb-helper d "$PASTEBIN/file/delete/$i" || EXITCODE=1 elif [ "$GET" ]; then if [ "$COMPRESS" = "1" ]; then + require_executable zcat $LIBDIR/fb-helper d "$PASTEBIN/$i" | zcat || EXITCODE=1 elif [ "$COMPRESS" = "2" ]; then + require_executable xzcat $LIBDIR/fb-helper d "$PASTEBIN/$i" | xzcat || EXITCODE=1 else $LIBDIR/fb-helper d "$PASTEBIN/$i" || EXITCODE=1 |