Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-users] HylaFaxing from Samba



Folks,

Some days ago Paul Franz forwarded the documentation for faxing from samba.
Here is the hylafax adaptation of it, fully operational on a standard
hylafax setup. Maybe it will help some of you.
All remarks and q's are welcome. Beware though, I'll be on vacation in
another two days.

Ignace Suy

------------ start of script, see comments for installation and use
--------------------

#!/bin/sh
# 
#     Faxing with HylaFax through a faxprinter
# 
# This script is heavily depending (just about copied) from the work of:
#     -------------------------------------------------
#     Faxfilter für MS-Windows und lpd und mgetty-paket
#     Author     : Wundrig Roland <roland@cygnus.muc.de>    
#     -------------------------------------------------
# Installation.
# On top of the "normal" Hylafax installation you do the following:
# 1. Put the following lines in the /etc/printcap file and delete (if
#    applicable) any other faxprinters:
# 
#    faxlp:\
#      :lp=/dev/null:\
#      :sd=/usr/spool/lpd:\
#      :if=/var/spool/fax/bin/sambafax:\
#      :sh:sf:mx#0: 
# 
# 2. Store this file as /var/spool/fax/bin/sambafax or in the bin
#    directory of your hyla tree (but then adjust the path in printcap)
# 
# 3. I assume that your samba configuration shows all printers
# 
# 4. restart lpd and samba
# 
# 5. On your samba client, install a new printer with a postscript
#    driver (like an apple laserwriter) to print to \\YOURSERVER\faxlp
# 
# 6. Create a fax using your favorite wordchewer and take up a line like:
#        Fax-Nr : 012-345-6789
#    and print to your new faxprinter
# 
#
# The intellectual (c) remains with Wundrig Roland
# This rev created by ignace.suy@reeel.nl, september 2000
# Developed and tested using Hylafax 4.1beta2 On SuSE 6.4.
#

# constants
SENDMAIL="/usr/sbin/sendmail"

# make up a temporary file
FAXFILE=/tmp/sambafax.$$

# retrieve the username and hostname from the paramaters
while :
do
    case "$1" in
        -n) Username="$2"
            shift ; shift
            ;;
        -h) Hostname="$2"
            shift ; shift
            ;;
       -*)  shift
            ;;
        *) break
    esac
done

# if the samba user is anonumous then send mails to the postmaster
if [ "$Username" = "nobody" ];
   then
    MailTo="postmaster"
   else
    MailTo=${Username}
fi

# now dump the to-be faxewd data (PS fdormat) to the temp file
cat >${FAXFILE}

# retrieve the faxnumber from the printfile
FAXNUM=`awk '{ IGNORECASE=1 } /FAX-Nr ?: ?[0-9-]*/ \
         {  gsub(/-/,""); \
            anfang=match($0,/ ?: ?/); \
            anfang=anfang+match(substr($0,anfang),/[0-9]/)-1; \
            ende=match(substr($0,anfang),/[^0-9]/)-1; \
            printf ("%s",substr($0,anfang,ende)) \
         }' ${FAXFILE}`

# if faxnumber is found fax the tempfile
# we donot check the validity of the faxnumber, let sendfax do this...
if [ "${FAXNUM}" = "" ] ; then
    (echo "To: ${MailTo}"
     echo "From: The HylaFAX Samba dancer <fax>"
     echo "Subject: your facsimile request failed"
     echo ""

     echo "The faxnumber is not recognized in your fax of" 
     echo `date`
     echo ""
     echo "The faxnumber is recognised via this text:"
     echo "   Fax-Nr : ddd-ddddddd"
     echo "No spaces or characters are allowed between the digits, just a -"
     echo ""
     echo "Please correct and retry"
    ) | 2>&1 $SENDMAIL -ffax -oi ${MailTo}
else
    sendfax -n -f ${MailTo} -d ${FAXNUM} ${FAXFILE}
fi

# remove the temp file
rm -f ${FAXFILE}

# end of show




____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services