se positionner dans le bon répertoitre
cd /var/spool/hylafax/bin/
copier notify en notify-sme
cp -p notify notify-sme
- Code: Tout sélectionner
...
. etc/setup.cache
. bin/common-functions
. bin/common-functions-sme <== ajout
INFO=$SBIN/faxinfo
...
if [ -f etc/templates/$TEMPLATE/hook.sh ]
then
# Any hooks that the templates need
. etc/templates/$TEMPLATE/hook.sh
fi
# formattage de la date qui va etre mise dans les fichiers du fax <== ajout
DATE1=`date +%F_%H:%M:%S` <== ajout
if [ -n "$RETURNFILETYPE" ]; then
for ft in $RETURNFILETYPE
do
ATTACH_ARGS="$ATTACH_ARGS "`BuildAttachArgs-sme $ft` <== modif
done
fi
création de common-functions-sme
C'est une copie de 2 fonctions de common-functions que j'ai modifié
code modifié le 20/04/2010 à 17h50 suite aux différents tests que je viens de faire
Il reste un petit souci d'incrustation qui ne se fait pas sur toutes les pages quand on part d'un pdf
- Code: Tout sélectionner
#
# $Id: common-functions.sh.in,v 1.40.2.2 2007/09/24 19:13:47 aidan Exp $
# => common-functions-sme
# --------------------
#
# This holds various functions that are common to the
# various bin scripts.
# add script to use psmark
##
## BuildAttachArgs <returnfiletype>
##
## Build the list of arguments to be passed on to the
## Functions which do the actual mailing/attaching
##
## It will convert to the requested <returnfiletype>
##
## The result is formatted like:
## "file1" "type1" "name1" "description1" \
## ["file2" "type2" "name2" "description2" [...] ]
BuildAttachArgs-sme ()
{
case $1 in
PostScript|Postscript|PS|ps)
a_type="application/postscript"
a_desc="FAX Document (PostScript)"
;;
PDF|pdf)
a_type="application/pdf"
a_desc="FAX Document (PDF)"
;;
TIFF|tiff|TIF|tif)
a_type="image/tiff"
a_desc="FAX Document (TIFF)"
;;
esac
for i in `LocalSequence 1 $nfiles`
do
eval filename="$"files_"$i"
TraceLog "FILE $i: $filename"
if [ -f "$filename" ]; then
eval filetype="$"filetype_"$i"
if [ "$1" = "raw" ] || [ "$1" = "original" ]; then
a_file=$filename;
a_name=`basename $filename`;
a_desc="FAX Document"
case "$filetype" in
PostScript)
TraceLog "Attaching $file in PostScript format"
a_type="application/postscript"
;;
PDF)
TraceLog "Attaching $file in PDF format"
a_type="application/pdf"
;;
TIFF)
TraceLog "Attaching $file in TIFF format"
a_type="image/tiff"
;;
*)
TraceLog "Attaching $file in unknown[$filetype] format"
a_type="application/unknown"
;;
esac
else
a_file=`ConvertFile-sme "$filename" "$filetype" "$1"`
a_name=`basename $a_file`
fi
fi
if [ -f "$a_file" ]
then
ARGS="$ARGS"" \"$a_file\" \"$a_type\" \"$a_name\" \"$a_desc\""
fi
done
printf '%s' "$ARGS"
}
## ConvertFile <file> <oldtype> <newtype>
## Convert $1 from $2 to type $3
##
## This will (possibly) create a tempoary file
## in the Private $TMPDIR area for the new file
## If the original file is in the proper form, no
## new file will be created
##
## It prints the file name of the converted
## file to stdout
ConvertFile-sme ()
{
libelle_aa=""
case "$3" in
PostScript|postscript|PS|ps)
TraceLog "Converting $1 to Postscript"
case $2 in
PostScript|Postscript|PS|ps)
TraceLog "No conversion"
name="`basename $1 .ps`"
/usr/local/bin/psmark -i "$1" -o $TMPDIR/$name.ps -x -410 -y 20 -r 0 -s 7 "DATE: $DATE1 Fax $JOBINFO to $number from $sender statut $WHY"
echo "$TMPDIR/$name.ps"
;;
PDF|pdf)
TraceLog "pdf2ps necessary"
name="`basename $1 .pdf`"
$PDF2PS $1 $TMPDIR/$name-sme.ps
/usr/local/bin/psmark -i $TMPDIR/$name-sme.ps -o $TMPDIR/$name.ps -x -410 -y 20 -r 0 -s 7 "DATE: $DATE1 Fax $JOBINFO to $number from $sender statut $WHY"
echo "$TMPDIR/$name.ps"
;;
TIFF|tiff|TIF|tif)
TraceLog "tiff2ps necessary"
name="`basename $1 .tif`"
$TIFF2PS -a $1 | /usr/local/bin/psmark -i - -o $TMPDIR/$name.ps -x -410 -y 20 -r 0 -s 7 "DATE: $DATE1 Fax $JOBINFO to $number from $sender statut $WHY"
echo "$TMPDIR/$name.ps"
;;
esac
;;
PDF|pdf)
TraceLog "Converting $1 to PDF"
case $2 in
PostScript|Postscript|PS|ps)
TraceLog "Using ps2pdf"
name="`basename $1 .ps`"
/usr/local/bin/psmark -i "$1" -o - -x -410 -y 20 -r 0 -s 7 "DATE: $DATE1 Fax $JOBINFO to $number from $sender statut $WHY" | $PS2PDF -sPAPERSIZE=a4 - $TMPDIR/$name.pdf >/dev/null 2>&1
echo "$TMPDIR/$name.pdf"
;;
PDF|pdf)
TraceLog "pdf2ps necessary"
name="`basename $1 .pdf`"
$PDF2PS $1 $TMPDIR/$name.ps
/usr/local/bin/psmark -i $TMPDIR/$name.ps -o - -x -410 -y 20 -r 0 -s 7 "DATE: $DATE1 Fax $JOBINFO to $number from $sender statut $WHY " | $PS2PDF -sPAPERSIZE=a4 - $TMPDIR/$name.pdf >/dev/null 2>&1
echo "$TMPDIR/$name.pdf"
;;
TIFF|tiff|TIF|tif)
TraceLog "Using tiff2pdf"
name="`basename $1 .tif`"
$TIFF2PS -a $1 | /usr/local/bin/psmark -i - -o - -x -410 -y 20 -r 0 -s 7 "DATE: $DATE1 Fax $JOBINFO to $number from $sender statut $WHY " | $PS2PDF -sPAPERSIZE=a4 - $TMPDIR/$name.pdf >/dev/null 2>&1
echo "$TMPDIR/$name.pdf"
esac
;;
TIFF|TIF|tif|tiff)
TraceLog "Converting $1 to TIFF"
case $2 in
PostScript|Postscript|PS|ps)
TraceLog "Using ps2fax"
name="`basename $1 .ps`"
/usr/local/bin/psmark -i "$1" -o - -x -410 -y 20 -r 0 -s 7 "DATE: $DATE1 Fax $JOBINFO to $number from $sender statut $WHY " | $PS2FAX -r $resolution -o $TMPDIR/$name.tif
# $PS2FAX -r $resolution $1 $TMPDIR/$name.tif
echo "$TMPDIR/$name.tif"
;;
PDF|pdf)
TraceLog "Using pdf2fax"
name="`basename $1 .pdf`"
$PDF2PS $1 $TMPDIR/$name.ps
/usr/local/bin/psmark -i $TMPDIR/$name.ps -o - -x -410 -y 20 -r 0 -s 7 "DATE: $DATE1 Fax $JOBINFO to $number from $sender statut $WHY " | $PS2FAX -r $resolution -o $TMPDIR/$name.tif
# $PDF2FAX -r $resolution $1 $TMPDIR/$name.tif
echo "$TMPDIR/$name.tif"
;;
TIFF|tiff|TIF|tif)
TraceLog "Nothing neccessary"
name="`basename $1 .tif`"
$TIFF2PS -a $1 | /usr/local/bin/psmark -i - -o - -x -410 -y 20 -r 0 -s 7 "DATE: $DATE1 Fax $JOBINFO to $number from $sender statut $WHY " | $PS2FAX -r $resolution -o $TMPDIR/$name.tif
echo "$TMPDIR/$name.tif"
;;
esac
;;
*)
TraceLog "Ignoring $1 to \"$3\""
;;
esac
}
ajouter une ligne dans /var/spool/hylafax/etc/config
- Code: Tout sélectionner
NotifyCmd: bin/notify-sme
Tout n'est pas forcement testé.
C n'est qu'un code de test
Anne