From 4ba7c9152f6231ecaa85fe1d31643324300974f6 Mon Sep 17 00:00:00 2001 From: acn128 Date: Fri, 10 Apr 2015 16:07:38 +0200 Subject: [PATCH] Changed ebuilds to include Gentoo's libraries instead of bundled libs. Added "bundled-qt5" USE flag for those who do not want to compile Qt5 libs. Replaced ecodmsprinter backend file with own version. --- net-print/ecodmsprinter/files/ecodms | 75 ++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 net-print/ecodmsprinter/files/ecodms diff --git a/net-print/ecodmsprinter/files/ecodms b/net-print/ecodmsprinter/files/ecodms new file mode 100755 index 0000000..4cc41cf --- /dev/null +++ b/net-print/ecodmsprinter/files/ecodms @@ -0,0 +1,75 @@ +#!/bin/sh +# ------------------------------------------------------------------- +# "/usr/libexec/cups/backend/ecodms" +# based on original file from applord GmbH for ecoDMS +# changed by Anna Christina Naß for Gentoo Linux +# ------------------------------------------------------------------- +# +FILENAME= +# filename of the PDF File +PRINTTIME=`date +%Y-%m-%d_%H.%M.%S` + +# case of wrong number of arguments +if [ $# -ne 5 -a $# -ne 6 ]; then + echo "Usage: $0 job-id user title copies options [file]" + exit 1 +fi + +# check for username and title to be present +if [ "$2" = "" -o "$3" = "" ]; then + echo "ERROR: username and title must be set - maybe you are trying to print not from the X session" 1>&2 + exit 1 +fi + +# check if there is a ecodmssinglesignon process for the current user +MYUID=`id -u $2` +DBUSPROC=`ps -eo euid,ruid,pid,comm,args | grep ecodmssinglesignon | grep -v grep | grep $MYUID | awk '{print \$1}'` +if [ "$MYUID" != "$DBUSPROC" ]; then + echo "ERROR: There is no or more then one ecodmssinglesignon process running on the machine for user $2" 1>&2 + exit 1 +fi + +# get PDF directory from device URI, and check write status +PDFDIR=${DEVICE_URI#ecodms:} +if [ ! -d "$PDFDIR" -o ! -w "$PDFDIR" ]; then + echo "ERROR: directory $PDFDIR not writable" + exit 1 +fi + +# generate output filename +OUTPUTFILENAME="$PDFDIR/$2-$1-$PRINTTIME.ps" + +# set input filename if any +INPUTFILENAMEOPTION=- +if [ $# -eq 6 ]; then + INPUTFILENAMEOPTION=-f $6 +fi + +# ghostscript disabled for now, replaced by "cat" +#/usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="$OUTPUTFILENAME" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite $INPUTFILENAMEOPTION +cat $INPUTFILENAMEOPTION > $OUTPUTFILENAME +#RC=$? +#if [ $RC -ne 0 ]; then +# echo "ERROR: unable to convert the file to pdf format" 1>&2 +# exit $RC +#fi + +# Make the file visible and writable because it should be deleted by the ecodms process; +chmod 666 $OUTPUTFILENAME + +echo "ERROR: $OUTPUTFILENAME" 1>&2 + +## call program here and perform some cleanup +LD_LIBRARY_PATH=/usr/libexec/cups/ecodms/ /usr/libexec/cups/ecodms/ecodmsprinter $2 $OUTPUTFILENAME +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + +# perform cleanup +rm $OUTPUTFILENAME +exit 0 + +# EOF +# ------------------------------------------------------------------- +