Initial import
This commit is contained in:
commit
037178b810
24
createlinks
Normal file
24
createlinks
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use esmith::Build::CreateLinks qw(:all);
|
||||
|
||||
service_link_enhanced("iaxmodem", "S95", "7");
|
||||
service_link_enhanced("iaxmodem", "K05", "6");
|
||||
service_link_enhanced("iaxmodem", "K05", "0");
|
||||
|
||||
safe_symlink("restart", "root/etc/e-smith/events/fax-update/services2adjust/hylafax");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/fax-update/services2adjust/iaxmodem");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/fax-update/services2adjust/iaxmodem2");
|
||||
|
||||
templates2events("/etc/iaxmodem/iaxmodem-cfg.ttyIAX", qw(fax-update bootstrap-console-save));
|
||||
templates2events("/etc/iaxmodem/iaxmodem-cfg.ttyIAX2", qw(fax-update bootstrap-console-save));
|
||||
templates2events("/etc/inittab", qw(fax-update));
|
||||
|
||||
safe_touch("root/var/service/iaxmodem/down");
|
||||
safe_touch("root/var/service/iaxmodem2/down");
|
||||
|
||||
safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/iaxmodem');
|
||||
safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/iaxmodem2');
|
||||
safe_symlink("/var/service/iaxmodem" , 'root/service/iaxmodem');
|
||||
safe_symlink("/var/service/iaxmodem2" , 'root/service/iaxmodem2');
|
||||
|
66
ipasserelle-fax.spec
Normal file
66
ipasserelle-fax.spec
Normal file
|
@ -0,0 +1,66 @@
|
|||
%define version 0.1.0
|
||||
%define release 1
|
||||
%define name ipasserelle-fax
|
||||
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
Summary: iPasserelle Fax module
|
||||
Group: System Environment/Applications
|
||||
License: GPLv3+
|
||||
URL: http://www.ipasserelle.com
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||
|
||||
BuildRequires: e-smith-devtools
|
||||
|
||||
Requires: ipasserelle-base
|
||||
Requires: iaxmodem
|
||||
Requires: smeserver-hylafax
|
||||
Requires: psmark
|
||||
|
||||
%description
|
||||
iPasserelle module for the fax server.
|
||||
Uses smeserver-hylafax
|
||||
|
||||
%changelog
|
||||
* Wed Dec 3 2014 Daniel Berteaud <daniel@firewall-services.com> - 0.1.0-1
|
||||
- Import in GIT
|
||||
|
||||
* Thu Sep 12 2011 Daniel Berteaud <daniel@firewall-services.com> - 0.1-1.sme
|
||||
- Initial release
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
perl ./createlinks
|
||||
%{__mkdir_p} root/var/fax
|
||||
%{__mkdir_p} root/var/log/iaxmodem
|
||||
%{__mkdir_p} root/var/log/iaxmodem2
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
rm -f %{name}-%{version}-filelist
|
||||
(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
|
||||
/sbin/e-smith/genfilelist \
|
||||
--file /var/spool/hylafax/bin/faxrcvd-sme 'attr(0755,root,root)' \
|
||||
--dir /var/fax 'attr(0770,root,uucp)' \
|
||||
--dir /var/log/iaxmodem 'attr(0770,root,smelog)' \
|
||||
--dir /var/log/iaxmodem2 'attr(0770,root,smelog)' \
|
||||
--file /var/service/iaxmodem/run 'attr(0755,root,root)' \
|
||||
--file /var/service/iaxmodem/log/run 'attr(0755,root,root)' \
|
||||
--file /var/service/iaxmodem2/run 'attr(0755,root,root)' \
|
||||
--file /var/service/iaxmodem2/log/run 'attr(0755,root,root)' \
|
||||
$RPM_BUILD_ROOT > %{name}-%{version}-%{release}-filelist
|
||||
|
||||
%files -f %{name}-%{version}-%{release}-filelist
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post
|
||||
|
||||
%postun
|
||||
|
|
@ -0,0 +1 @@
|
|||
4570
|
|
@ -0,0 +1 @@
|
|||
private
|
|
@ -0,0 +1 @@
|
|||
disabled
|
1
root/etc/e-smith/db/configuration/defaults/iaxmodem/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/iaxmodem/type
Normal file
|
@ -0,0 +1 @@
|
|||
service
|
|
@ -0,0 +1 @@
|
|||
4571
|
|
@ -0,0 +1 @@
|
|||
private
|
|
@ -0,0 +1 @@
|
|||
disabled
|
|
@ -0,0 +1 @@
|
|||
service
|
|
@ -0,0 +1,3 @@
|
|||
PERMS=0640
|
||||
UID="root"
|
||||
GID="uucp"
|
|
@ -0,0 +1,3 @@
|
|||
PERMS=0640
|
||||
UID="root"
|
||||
GID="uucp"
|
|
@ -0,0 +1,3 @@
|
|||
device /dev/ttyIAX
|
||||
owner uucp:uucp
|
||||
mode 660
|
|
@ -0,0 +1,5 @@
|
|||
port {$iaxmodem{'TCPPort'} || '4570'}
|
||||
refresh 60
|
||||
server {$iaxmodem{'Server'} || '127.0.0.1'}
|
||||
peername {$iaxmodem{'Id'} || '3000'}
|
||||
secret {$iaxmodem{'Secret'} || 'secret'}
|
|
@ -0,0 +1,2 @@
|
|||
cidname {$iaxmodem{'CidName'} || $ldap{'defaultCompany'}}
|
||||
cidnumber {$iaxmodem{'Number'} || '00 00 00 00 00'}
|
|
@ -0,0 +1,2 @@
|
|||
codec slinear
|
||||
nojitterbuffer
|
|
@ -0,0 +1,3 @@
|
|||
device /dev/ttyIAX2
|
||||
owner uucp:uucp
|
||||
mode 660
|
|
@ -0,0 +1,5 @@
|
|||
port {$iaxmodem2{'TCPPort'} || '4571'}
|
||||
refresh 60
|
||||
server {$iaxmodem2{'Server'} || '127.0.0.1'}
|
||||
peername {$iaxmodem2{'Id'} || '3001'}
|
||||
secret {$iaxmodem2{'Secret'} || 'secret'}
|
|
@ -0,0 +1,2 @@
|
|||
cidname {$iaxmodem2{'CidName'} || $ldap{'defaultCompany'}}
|
||||
cidnumber {$iaxmodem2{'Number'} || '00 00 00 00 00'}
|
|
@ -0,0 +1,2 @@
|
|||
codec slinear
|
||||
nojitterbuffer
|
8
root/etc/e-smith/templates/etc/inittab/86iaxmodem2
Normal file
8
root/etc/e-smith/templates/etc/inittab/86iaxmodem2
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
my $status = $iaxmodem2{status} || "disabled";
|
||||
|
||||
if ($status eq 'enabled')
|
||||
{
|
||||
$OUT .= "fax2:23457:respawn:/usr/sbin/faxgetty ttyIAX2\n";
|
||||
}
|
||||
}
|
25
root/var/service/iaxmodem/log/run
Normal file
25
root/var/service/iaxmodem/log/run
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 2011 Firewall Services
|
||||
# daniel@firewall-services.com
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#----------------------------------------------------------------------
|
||||
exec \
|
||||
/usr/local/bin/setuidgid smelog \
|
||||
/usr/local/bin/multilog t s5000000 \
|
||||
/var/log/iaxmodem/
|
||||
|
6
root/var/service/iaxmodem/run
Normal file
6
root/var/service/iaxmodem/run
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
exec 2>&1
|
||||
|
||||
exec /usr/sbin/iaxmodem iaxmodem-cfg.ttyIAX
|
||||
|
25
root/var/service/iaxmodem2/log/run
Normal file
25
root/var/service/iaxmodem2/log/run
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 2011 Firewall Services
|
||||
# daniel@firewall-services.com
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#----------------------------------------------------------------------
|
||||
exec \
|
||||
/usr/local/bin/setuidgid smelog \
|
||||
/usr/local/bin/multilog t s5000000 \
|
||||
/var/log/iaxmodem2/
|
||||
|
6
root/var/service/iaxmodem2/run
Normal file
6
root/var/service/iaxmodem2/run
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
exec 2>&1
|
||||
|
||||
exec /usr/sbin/iaxmodem iaxmodem-cfg.ttyIAX2
|
||||
|
386
root/var/spool/hylafax/bin/faxrcvd-sme
Executable file
386
root/var/spool/hylafax/bin/faxrcvd-sme
Executable file
|
@ -0,0 +1,386 @@
|
|||
#! /bin/bash
|
||||
# $Id: faxrcvd.sh.in,v 1.32 2008/04/29 23:34:25 faxguy Exp $
|
||||
#
|
||||
# ============================================
|
||||
#
|
||||
# A NOTE ON CUSTOMIZING this script:
|
||||
#
|
||||
# You are welcome (even encouraged) to customize this script to suit the
|
||||
# needs of the deployment. However, be advised that this script is
|
||||
# considered part of the package distribution and is subject to being
|
||||
# overwritten by subsequent upgrades. Please consider copying this file
|
||||
# to something like "etc/faxrcvd-custom", modifying that copy of the file,
|
||||
# and then setting "FaxRcvdCmd: etc/faxrcvd-custom" in your modem config
|
||||
# file to prevent your customizations from being overwritten during an
|
||||
# upgrade process.
|
||||
#
|
||||
# ============================================
|
||||
#
|
||||
# HylaFAX Facsimile Software
|
||||
#
|
||||
# Copyright (c) 1990-1996 Sam Leffler
|
||||
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
|
||||
# HylaFAX is a trademark of Silicon Graphics
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and
|
||||
# its documentation for any purpose is hereby granted without fee, provided
|
||||
# that (i) the above copyright notices and this permission notice appear in
|
||||
# all copies of the software and related documentation, and (ii) the names of
|
||||
# Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
# publicity relating to the software without the specific, prior written
|
||||
# permission of Sam Leffler and Silicon Graphics.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
# OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
#
|
||||
# faxrcvd file devID commID error-msg
|
||||
#
|
||||
if [ $# -lt 4 ]; then
|
||||
echo "Usage: $0 file devID commID error-msg [ callID-1 [ callID-2 [ ... [ callID-n ] ] ] ]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# If you want to change the presentation of the e-mail notification
|
||||
# then this is the place to change that. We put it here, up-front,
|
||||
# because this is most likely what most customizations will deal with.
|
||||
#
|
||||
faxrcvd_mail()
|
||||
{
|
||||
MAILTYPE="$1"
|
||||
MAILTO="$2"
|
||||
CCTO="$3"
|
||||
BCCTO="$4"
|
||||
|
||||
(echo "Mime-Version: 1.0"
|
||||
echo "Content-Type: Multipart/Mixed; Boundary=\"$MIMEBOUNDARY\""
|
||||
echo "Content-Transfer-Encoding: 7bit"
|
||||
echo "To: $MAILTO"
|
||||
if [ -n "$CCTO" ]; then echo "Cc: $CCTO"; fi
|
||||
if [ -n "$BCCTO" ]; then echo "Bcc: $BCCTO"; fi
|
||||
printf "From: "
|
||||
printf "$DICTRECEIVEAGENT" | LANG=C $AWK -f bin/rfc2047-encode.awk -v charset="$CHARSET"
|
||||
echo " <$FROMADDR>"
|
||||
printf "Subject: "
|
||||
(
|
||||
if [ -f "$FILE" ]; then
|
||||
eval echo "$DICTRECEIVEDFROM";
|
||||
else
|
||||
eval echo "$DICTNOTRECEIVED";
|
||||
fi
|
||||
) | LANG=C $AWK -f bin/rfc2047-encode.awk -v charset="$CHARSET"; echo
|
||||
echo ""
|
||||
echo "--$MIMEBOUNDARY"
|
||||
echo "Content-Type: text/plain; charset=$CHARSET"
|
||||
echo "Content-Transfer-Encoding: quoted-printable"
|
||||
echo ""
|
||||
(
|
||||
if [ -f $FILE ]; then
|
||||
case "$MAILTYPE" in
|
||||
textonly)
|
||||
echo "$FILE (ftp://$HOSTNAME:$PORT/$FILE):";;
|
||||
esac
|
||||
faxInfo $FILE
|
||||
echo "$DICTRECEIVEDON| $DEVICE" | printFormatted $INFOSIZE
|
||||
if [ -z "$MSG" ]; then
|
||||
case "$MAILTYPE" in
|
||||
withattached)
|
||||
echo "$DICTCOMMID| c$COMMID" | printFormatted $INFOSIZE
|
||||
;;
|
||||
textonly)
|
||||
echo "$DICTCOMMID| c$COMMID (ftp://$HOSTNAME:$PORT/log/c$COMMID)" | printFormatted $INFOSIZE
|
||||
if [ -f $FILE ] && [ -n "$SENDTO" ]; then
|
||||
echo ""
|
||||
eval echo "$DICTDISPATCHEDTO"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
eval echo "$DICTATTEMPTEDFAXFAILED"
|
||||
fi
|
||||
) | LANG=C $AWK -f bin/qp-encode.awk
|
||||
if [ "$MSG" ] || [ ! -f $FILE ]; then
|
||||
(
|
||||
echo ""
|
||||
echo "$DICTMSGINTRO"
|
||||
echo ""
|
||||
echo " $ERRMSG"
|
||||
echo ""
|
||||
echo "$DICTLOGFOLLOWS"
|
||||
echo ""
|
||||
) | LANG=C $AWK -f bin/qp-encode.awk
|
||||
if [ -f log/c$COMMID ]; then
|
||||
echo ""
|
||||
echo "--$MIMEBOUNDARY"
|
||||
echo "Content-Type: text/plain; charset=US-ASCII; name=c$COMMID"
|
||||
echo "Content-Description: FAX session log"
|
||||
echo "Content-Transfer-Encoding: 7bit"
|
||||
echo "Content-Disposition: inline"
|
||||
echo ""
|
||||
$SED -e '/-- data/d' \
|
||||
-e '/start.*timer/d' -e '/stop.*timer/d' \
|
||||
log/c$COMMID
|
||||
elif [ -n "$COMMID" ]; then
|
||||
( echo "$DICTNOLOGAVAIL ($DICTCOMMID c$COMMID)." ) | LANG=C $AWK -f bin/qp-encode.awk
|
||||
else
|
||||
( echo "$DICTNOLOGAVAIL." ) | LANG=C $AWK -f bin/qp-encode.awk
|
||||
fi
|
||||
fi
|
||||
if [ -f $FILE ]; then
|
||||
if [ "$MAILTYPE" = "withattached" ]; then
|
||||
for type in $FILETYPE; do
|
||||
echo ""
|
||||
echo "--$MIMEBOUNDARY"
|
||||
if [ "$type" = "tif" ]; then
|
||||
echo "Content-Type: image/tiff; name=\"$FILENAME.tif\""
|
||||
echo "Content-Description: FAX document"
|
||||
echo "Content-Transfer-Encoding: $ENCODING"
|
||||
echo "Content-Disposition: attachment; filename=\"$FILENAME.tif\""
|
||||
echo ""
|
||||
# This is useful because the majority of TIFF viewers won't
|
||||
# be able to read JBIG compressed TIFF files, while
|
||||
# G4 (MMR) is a much older and supported format.
|
||||
if (tiffinfo $FILE | grep "JBIG" > /dev/null) then
|
||||
tiffcp -c g4 $FILE $FILE.g4.tif
|
||||
encode $FILE.g4.tif
|
||||
$RM -f $FILE.g4.tif 2>$ERRORSTO
|
||||
else
|
||||
encode $FILE
|
||||
fi
|
||||
elif [ "$type" = "tif-r" ]; then
|
||||
echo "Content-Type: image/tiff; name=\"$FILENAME.tif\""
|
||||
echo "Content-Description: FAX document"
|
||||
echo "Content-Transfer-Encoding: $ENCODING"
|
||||
echo "Content-Disposition: attachment; filename=\"$FILENAME.tif\""
|
||||
echo ""
|
||||
if (tiffinfo $FILE | grep "JPEG" > /dev/null) then
|
||||
tiffcp -c jpeg:R $FILE $FILE.r.tif
|
||||
encode $FILE.r.tif
|
||||
$RM -f $FILE.r.tif 2>$ERRORSTO
|
||||
else
|
||||
encode $FILE
|
||||
fi
|
||||
elif [ "$type" = "tif-y" ]; then
|
||||
echo "Content-Type: image/tiff; name=\"$FILENAME.tif\""
|
||||
echo "Content-Description: FAX document"
|
||||
echo "Content-Transfer-Encoding: $ENCODING"
|
||||
echo "Content-Disposition: attachment; filename=\"$FILENAME.tif\""
|
||||
echo ""
|
||||
if (tiffinfo $FILE | grep "JPEG" > /dev/null) then
|
||||
tiffcp -c jpeg:Y $FILE $FILE.y.tif
|
||||
encode $FILE.y.tif
|
||||
$RM -f $FILE.y.tif 2>$ERRORSTO
|
||||
else
|
||||
encode $FILE
|
||||
fi
|
||||
elif [ "$type" = "pdf" ]; then
|
||||
echo "Content-Type: application/pdf; name=\"$FILENAME.pdf\""
|
||||
echo "Content-Description: FAX document"
|
||||
echo "Content-Transfer-Encoding: $ENCODING"
|
||||
echo "Content-Disposition: attachment; filename=\"$FILENAME.pdf\""
|
||||
echo ""
|
||||
$TIFF2PDF -o $FILE.pdf $FILE
|
||||
encode $FILE.pdf
|
||||
$RM -f $FILE.pdf 2>$ERRORSTO
|
||||
else # default as Postscript
|
||||
echo "Content-Type: application/postscript; name=\"$FILENAME.ps\""
|
||||
echo "Content-Description: FAX document"
|
||||
echo "Content-Transfer-Encoding: 7bit"
|
||||
echo "Content-Disposition: attachment; filename=\"$FILENAME.ps\""
|
||||
echo ""
|
||||
$FAX2PS $FILE 2>$ERRORSTO
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
echo "--$MIMEBOUNDARY--"
|
||||
) 2>$ERRORSTO | $SENDMAIL -f$FROMADDR -oi -t
|
||||
}
|
||||
|
||||
test -f etc/setup.cache || {
|
||||
SPOOL=`pwd`
|
||||
cat<<EOF
|
||||
|
||||
FATAL ERROR: $SPOOL/etc/setup.cache is missing!
|
||||
|
||||
The file $SPOOL/etc/setup.cache is not present. This
|
||||
probably means the machine has not been setup using the faxsetup(8C)
|
||||
command. Read the documentation on setting up HylaFAX before you
|
||||
startup a server system.
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# These settings may not be present in setup.cache if user upgraded and
|
||||
# didn't re-run faxsetup; we set them before calling setup.cache for
|
||||
# backward compatibility.
|
||||
ENCODING=base64
|
||||
MIMENCODE=mimencode
|
||||
TIFF2PDF=bin/tiff2pdf
|
||||
TTYCMD=tty
|
||||
CHARSET=UTF-8 # this really gets set in dictionary
|
||||
|
||||
. etc/setup.cache
|
||||
. bin/common-functions
|
||||
|
||||
INFO=$SBIN/faxinfo
|
||||
FAX2PS=$TIFFBIN/fax2ps
|
||||
TIFF2PS=tiff2ps
|
||||
TOADDR=FaxMaster
|
||||
FROMADDR=fax
|
||||
TIFFINFO=tiffinfo
|
||||
NOTIFY_FAXMASTER=always
|
||||
MIMEBOUNDARY="NextPart$$"
|
||||
|
||||
#
|
||||
# Redirect errors to a tty, if possible, rather than
|
||||
# dev-nulling them or allowing them to creep into
|
||||
# the mail.
|
||||
#
|
||||
if $TTYCMD >/dev/null 2>&1; then
|
||||
ERRORSTO=`$TTYCMD`
|
||||
else
|
||||
ERRORSTO=/dev/null
|
||||
fi
|
||||
|
||||
#
|
||||
# Permit various types of attachment types: ps, tif, pdf
|
||||
# Note that non-ASCII filetypes require an encoder.
|
||||
# pdf requires tiff2ps and tiff2pdf
|
||||
#
|
||||
FILETYPE=ps
|
||||
SENDTO=
|
||||
|
||||
#
|
||||
# There is no good portable way to find out the fully qualified
|
||||
# domain name (FQDN) of the host or the TCP port for the hylafax
|
||||
# service so we fudge here. Folks may want to tailor this to
|
||||
# their needs; e.g. add a domain or use localhost so the loopback
|
||||
# interface is used.
|
||||
#
|
||||
HOSTNAME=`hostname` # XXX no good way to find FQDN
|
||||
PORT=4559 # XXX no good way to lookup service
|
||||
|
||||
FILE="$1"; shift;
|
||||
DEVICE="$1"; shift;
|
||||
COMMID="$1"; shift;
|
||||
MSG="$1"; shift;
|
||||
COUNT=1
|
||||
while [ $# -ge 1 ]; do
|
||||
# The eval has $1 set yet, and this forces a variable-to-variable
|
||||
# assignment, allowing us to not need to do escaping
|
||||
eval CALLID$COUNT='$1'
|
||||
shift
|
||||
COUNT=`expr $COUNT + 1`
|
||||
done
|
||||
CIDNUMBER="$CALLID1"
|
||||
CIDNAME="$CALLID2"
|
||||
|
||||
FILENAME=`echo $FILE | $SED -e 's/\.tif//' -e 's/recvq\///'`
|
||||
SENDER="`$INFO $FILE | $SED -n 's/ *Sender: //p' 2>$ERRORSTO`"
|
||||
SUBADDR="`$INFO $FILE | $SED -n 's/ *SubAddr: //p' 2>$ERRORSTO`"
|
||||
|
||||
if [ ! -f $FILE ] && [ -z "$MSG" ]; then
|
||||
MSG="unknown problem, file unavailable"
|
||||
fi
|
||||
|
||||
#
|
||||
# Apply customizations. All customizable variables should
|
||||
# be set to their non-customized defaults prior to this.
|
||||
#
|
||||
if [ -f etc/FaxDispatch ]; then
|
||||
. etc/FaxDispatch # NB: FaxDispatch sets SENDTO
|
||||
fi
|
||||
|
||||
#
|
||||
# Fetch language settings (after FaxDispatch for customization of $LANG).
|
||||
#
|
||||
. bin/dictionary
|
||||
if [ -f etc/FaxDictionary ]; then
|
||||
. etc/FaxDictionary
|
||||
fi
|
||||
|
||||
#
|
||||
# Customize error message.
|
||||
#
|
||||
ERRNUM=`echo $MSG | sed 's/.*{\([^}]*\)}$/\1/g'`
|
||||
if [ "$ERRNUM" != "$MSG" ]; then
|
||||
eval ERRMSG="$"`echo $ERRNUM`
|
||||
if [ -z "$ERRMSG" ]; then
|
||||
ERRMSG="$MSG"
|
||||
fi
|
||||
else
|
||||
ERRNUM=
|
||||
ERRMSG="$MSG"
|
||||
fi
|
||||
|
||||
setInfoSize $FILE
|
||||
|
||||
# Convert TIFF file format/compression from JBIG to MMR (G4) if admin
|
||||
# requested for it in FaxDispatch.
|
||||
# The TIFF JBIG file as saved by HylaFAX is REPLACED with a MMR (G4) version.
|
||||
if [ "$RECV_DATA_CONVERSION" = "JBIG:MMR" ]; then
|
||||
if (tiffinfo $FILE | grep "JBIG" > /dev/null) then
|
||||
$RM -f $FILE.g4
|
||||
tiffcp -c g4 $FILE $FILE.g4
|
||||
if [ $? = 0 -a -s $FILE.g4 ]; then
|
||||
# Using 'cp' and then 'rm' (instead of 'mv') preserves
|
||||
# owner/mode of the original file (at least on Linux)
|
||||
#cp -p $FILE $FILE.jbig.tif
|
||||
cp $FILE.g4 $FILE
|
||||
fi
|
||||
$RM -f $FILE.g4
|
||||
fi
|
||||
fi
|
||||
|
||||
# Archive et impression
|
||||
DATE=`date +%F_%H:%M:%S`
|
||||
FICNAME=`date +%F_%H_%M_%S`
|
||||
YEAR=`date +%Y`
|
||||
MONTH=`date +%b`
|
||||
# If $PRINTER not empty, then print $FILE with $PRINTER
|
||||
if [ -n "$PRINTER" ]; then
|
||||
/usr/bin/tiff2ps -a $FILE | /usr/bin/psmark -i - -o - -x -390 -y 20 -r 0 -s 7 "DATE: $DATE EXPEDITEUR: $CIDNUMBER $CIDNAME" | /usr/bin/lp -d $PRINTER
|
||||
fi
|
||||
# If DSTDIR is not empty, then, we copy the pdf in DSTDIR
|
||||
if [ -n "$DSTDIR" ]; then
|
||||
if [ ! -d "$DSTDIR/$YEAR/$MONTH" ];then
|
||||
/bin/mkdir -p "$DSTDIR/$YEAR/$MONTH"
|
||||
fi
|
||||
/usr/bin/tiff2ps -a $FILE | /usr/bin/psmark -i - -o - -x -410 -y 20 -r 0 -s 7 "DATE: $DATE EXPEDITEUR: $CIDNUMBER $CIDNAME" | /usr/bin/ps2pdf -sPAPERSIZE=a4 - "$DSTDIR/$YEAR/$MONTH/$FICNAME.pdf"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Don't send FaxMaster duplicates, and FaxMaster may not even
|
||||
# want a message at all, depending on NOTIFY_FAXMASTER.
|
||||
#
|
||||
case $NOTIFY_FAXMASTER$MSG in
|
||||
never*) NOTIFY_FAXMASTER=no;;
|
||||
errors) NOTIFY_FAXMASTER=no;;
|
||||
*) NOTIFY_FAXMASTER=yes;;
|
||||
esac
|
||||
if [ "$NOTIFY_FAXMASTER" != "no" ]; then
|
||||
if [ ! -f $FILE ] || [ "$TOADDR" != "$SENDTO" ]; then
|
||||
faxrcvd_mail "textonly" "$TOADDR" "" ""
|
||||
fi
|
||||
fi
|
||||
if [ -n "$SENDTO" ] && [ -f $FILE ]; then
|
||||
for toeml in $SENDTO; do
|
||||
faxrcvd_mail "withattached" "$toeml" "$CCTO" "$BCCTO"
|
||||
done
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user