From 793c216f2415d34ea2a90272214a5d2834982b6a Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 24 Feb 2013 00:00:42 -0600 Subject: office/convertlit: Added (converts .lit files to .epub) Signed-off-by: Robby Workman --- office/convertlit/lit2epub | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 office/convertlit/lit2epub (limited to 'office/convertlit/lit2epub') diff --git a/office/convertlit/lit2epub b/office/convertlit/lit2epub new file mode 100644 index 0000000000..3dca90e68b --- /dev/null +++ b/office/convertlit/lit2epub @@ -0,0 +1,71 @@ +#!/bin/bash + +# 20130220: lit2epub by B. Watson (part of convertlit slackbuilds.org build) +# Licensed under the WTFPL. + +# Wrapper script for convertlit, zips up convertlit's output dir +# and cleans it up afterward. Leave the shebang line alone, this +# uses at least one bash-specific feature. + +NAME=$( basename $0 ) +TMP=${TMP:-/tmp} +OUTDIR=$TMP/$NAME.$$.$RANDOM + +set -e + +if [ "$1" = "" -o "$1" = "--help" -o "$1" = "-h" ]; then + cat <&2 + exit 1 + fi +elif [ "$2" = "-" ]; then + OUTFILE="$OUTDIR/output.epub" +else + OUTFILE="$( readlink -f "$OUTFILE" )" +fi + +# convertlit and zip both want to spew status messages to stdout, +# redirect to stderr so we can output just the .epub to stdout. +convertlit -d "$INFILE" "$OUTDIR"/ 1>&2 +( cd "$OUTDIR" ; zip -r "$OUTFILE" * 1>&2 ) + +if [ "$2" = "-" ]; then + cat "$OUTFILE" + OUTFILE="(standard output)" +fi + +echo 1>&2 +echo "$INFILE => $OUTFILE" 1>&2 +exit 0 -- cgit v1.2.3