File wvmime.patch of Package wv

#! /bin/sh /usr/share/dpatch/dpatch-run
## wvmime.dpatch by Matej Vela <vela@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: wvMime:
## DP: - If available, use see(1) from mime-support.
## DP: - Look for kghostview.
## DP: - Make the script whitespace-safe.
## DP: - Use wvPS rather than make_epses.sh (now gone).

@DPATCH@
diff -urNad wv-1.2.1~/wvMime wv-1.2.1/wvMime
--- wv-1.2.1~/wvMime	2006-03-18 19:16:28.000000000 +0100
+++ wv-1.2.1/wvMime	2006-03-18 19:18:54.000000000 +0100
@@ -12,64 +12,37 @@
 	exit 1
 fi
 
-# viewer application
-GV=""
-
-# check for gnome ghost-view first
-type ggv >/dev/null 2>&1
-if [ ${?} -eq "0" ]; then
-	GV="ggv"
-else
-	# TODO: does kde have something?
-
-	# try to default back onto gv
-	type gv >/dev/null 2>&1
-	if [ ${?} -eq "0" ]; then
-		GV="gv"
-	else
-		# old solaris systems
-		type ghostview >/dev/null 2>&1
-		if [ ${?} -eq "0" ]; then
-			GV="ghostview"
-		else
-			# unrecoverable error
-			echo "Could not find a suitable PostScript viewer."
-			echo "Please install ggv, gv, or ghostview"
-			exit 1
-		fi
+if [ -z "$GV" ]; then
+	# determine the viewer application:
+	# - see (let mailcap decide)
+	# - ggv (GNOME Ghostview)
+	# - kghostview (KDE Ghostview)
+	# - gv (Xaw3d Ghostview)
+	# - ghostview (the classic Ghostscript frontend)
+	for GV in see ggv kghostview gv ghostview; do
+		type "$GV" >/dev/null 2>&1 && break
+	done
+	if [ ${?} -ne "0" ]; then
+		# unrecoverable error
+		echo "Could not find a suitable PostScript viewer."
+		echo "Please install ggv, kghostview, gv, or ghostview"
+		exit 1
 	fi
 fi
 
-# temporary PS file, mangled to get some sort
-# of semi-uniqueness
-FILE=`basename ${1}`
-TMPDIR="/tmp/${FILE}-${USER}-${$}"
-TMPPS="$TMPDIR/${FILE}-${USER}-${$}.ps" 
-
-mkdir $TMPDIR
-
-# Make sure all graphics go into /tmp as well
-cp ${1} $TMPDIR/$FILE
-
-# Extract graphics
-wvLatex "$TMPDIR/$FILE" "$TMPDIR/$FILE.tex" 2>/dev/null >/dev/null
+# temporary target directory
+t_dir=${TMPDIR:-/tmp}/wvMime-$USER-$$
+mkdir -m 700 "$t_dir" || exit
+trap 'rm -rf "$t_dir"' 0 1 2 3 15
 
-# Graphics conversion if make_epses.sh installed:
-STEM=$TMPDIR/`basename ${1} .doc`
-type make_epses.sh 2>&1 >/dev/null
-  if [ ${?} -eq "0" ]; then
-    (cd $TMPDIR; make_epses.sh $STEM)
-  fi
+# PS file
+name=`basename "$1" .doc`.ps
 
-wvPS $TMPDIR/$FILE ${TMPPS}
+wvPS --targetdir="$t_dir" "$1" "$name"
 if [ ${?} -ne "0" ]; then 
 	echo "Could not translate into Postscript" 
 	exit 1 
 fi 
 
 # call our ghost-viewer
-${GV} ${TMPPS}
-rm -f ${TMPPS}
-
-cd /
-rm -rf $TMPDIR
+$GV "$t_dir/$name"
openSUSE Build Service is sponsored by