1 AUTHOR: Benjamin Boksa <benjamin@boksa.de>
5 LICENSE: GNU GENERAL PUBLIC LICENSE
7 SYNOPSIS: Installing CAPI2.0 and Hylafax with multiple MSN
10 This hint covers the installation of a CAPI2.0 enabled kernel and a very simple fax2mail
11 system based on Hylafax, where faxes are distributed by mail based on the MSN they were sent to.
14 * ftp://ftp.in-berlin.de/pub/capi4linux/capi4k-utils-2004-01-19.tar.gz
15 * ftp://ftp.avm.de/cardware/fritzcrd.pci/linux/suse.82/fcpci-suse8.2-03.11.02.tar.gz
16 * http://ftp.at.linuxfromscratch.org/infosys/mail/maildrop/metamail-linux.tar.z
17 * http://hightek.org/dialog/dialog-0.7.tar.gz
18 * http://ftp.gnu.org/gnu/sharutils/sharutils-4.2.1.tar.gz
19 * http://www.linuxfromscratch.org/patches/downloads/sharutils/sharutils-4.2.1-gettext-1.patch
20 * ftp://ftp.hylafax.org/source/hylafax-4.1.8.tar.gz
23 ISDN card and a local MTA (like sendmail) installed.
27 STEP 1: Introduction and general notes
29 This hint covers the installation of a CAPI2.0 enabled kernel and a very simple fax2mail
30 system based on HylaFax, where faxes are distributed by mail based on the MSN they were sent to.
32 Another thing I would like to mention is the usage of /usr/local/src in this hint. On my system
33 I have decided to keep the source for all packages from LFS/BLFS in /usr/src and all other packages
34 in /usr/local/src, which is the reason why I use /usr/local/src below. If you prefer to use /usr/src
35 just use it whenever you come accross /usr/local/src.
37 STEP 2: Preparing the kernel
39 The first thing to do is to compile a CAPI2.0 enabled kernel and the necessary kernel modules.
40 The following commands assumme you have installed the 2.4.22 kernel as described in the LFS 5.0 book.
41 If you have installed a different kernel or have the kernel sources in a different location make sure to
42 alter the commands accordingly.
44 Change to you kernel source directory and configure the kernel by running the following commands:
46 cd /usr/src/linux-2.4.22
50 First of all make sure to enable ISDN support in your kernel:
55 Then enable CAPI2.0 as shown below:
57 ISDN subsystem ---> Active ISDN cards --->
59 [ ] Verbose reason code reporting (kernel size +=7K)
60 [*] CAPI2.0 Middleware support (EXPERIMENTAL)
61 <M> CAPI2.0 /dev/capi support
62 [*] CAPI2.0 filesystem support
64 The last thing to do to prepare the kernel is to compile and install it:
66 make CC=/opt/gcc-2.95.3/bin/gcc dep &&
67 make CC=/opt/gcc-2.95.3/bin/gcc bzImage &&
68 make CC=/opt/gcc-2.95.3/bin/gcc modules &&
69 make CC=/opt/gcc-2.95.3/bin/gcc modules_install
72 cp arch/i386/boot/bzImage /boot/lfskernel
74 After that reboot your system with the new kernel.
76 STEP 3: Installing capi4k-utils-2004-01-19
78 capi4k-utils is a collection of some software we need in later steps.
80 The first thing to do is to download and unpack capi4k-utils by running these commands
81 (assumes you have installed curl):
85 curl -O ftp://ftp.in-berlin.de/pub/capi4linux/capi4k-utils-2004-01-19.tar.gz
87 tar xvfz capi4k-utils-2004-01-19.tar.gz
88 rm capi4k-utils-2004-01-19.tar.gz
90 The first thing is to configure the software for installation:
92 cd /usr/local/src/capi4k-utils
93 make CC=/opt/gcc-2.95.3/bin/gcc config
95 When I configured the sotware I had to specify the kernel source directory and I decided not
96 to build the pppdcapiplugin as it is not needed for the Hylafax installation:
98 "kernel source directory" -> /usr/src/linux-2.4.22
101 The next thing is to compile and install the software by running the following commands:
103 make CC=/opt/gcc-2.95.3/bin/gcc
104 make CC=/opt/gcc-2.95.3/bin/gcc install
106 cp capiinit/capi.conf /etc
108 After having installed the software you have to make it work with you ISDN card by
109 changing /etc/capi.conf. I did this in two steps.
111 The first step is to remove all lines from /etc/capi.conf that are not needed.
113 ----- begin patch (/etc/capi.conf) -----
114 --- capi.conf.orig 2004-02-21 21:31:42.000000000 +0100
115 +++ capi.conf 2004-02-21 21:32:00.000000000 +0100
117 # card file proto io irq mem cardnr options
118 -#b1isa b1.t4 DSS1 0x150 7 - - P2P
119 -b1pci b1.t4 DSS1 - - - -
120 -c4 c4.bin DSS1 - - - -
122 -c4 - DSS1 - - - - P2P
123 -c4 - DSS1 - - - - P2P
124 -#c2 c2.bin DSS1 - - - -
126 -#t1isa t1.t4 DSS1 0x340 9 - 0
127 -#t1pci t1.t4 DSS1 - - - -
129 -#fcclassic - - 0x150 10 - -
130 ----- end patch -----
132 The last thing to do is to uncomment the line for your card:
134 ----- begin patch (/etc/capi.conf) -----
135 --- capi.conf.orig 2004-02-21 23:59:20.000000000 +0100
136 +++ capi.conf 2004-02-21 23:59:25.000000000 +0100
138 # card file proto io irq mem cardnr options
141 ----- end patch -----
143 Please note that I use the FritzCard PCI, the last step might be different
144 depending on what ISDN card you use.
146 STEP 4: Installing fcpci-suse8.2-03.11.02
148 To install the kernel module that handles the FritzCard PCI use the following
149 commands and make sure to use the same compiler you use to compile the kernel:
153 curl -O ftp://ftp.avm.de/cardware/fritzcrd.pci/linux/suse.82/fcpci-suse8.2-03.11.02.tar.gz
155 tar xvfz fcpci-suse8.2-03.11.02.tar.gz
156 rm fcpci-suse8.2-03.11.02.tar.gz
160 make CC=/opt/gcc-2.95.3/bin/gcc
161 make CC=/opt/gcc-2.95.3/bin/gcc install
163 STEP 5: Installing AFPL Ghostscript-8.11
165 Instructions to install AFPL Ghostscript-8.11 can be found in BLFS 5.0. The URL
166 for these instructions on my local system is the following:
168 http://default.local/lfs/BLFS-BOOK-5.0-HTML/pst/gs.html
170 STEP 6: Installing metamail
176 curl -O http://ftp.at.linuxfromscratch.org/infosys/mail/maildrop/metamail-linux.tar.z
178 tar xvfz metamail-linux.tar.z
179 rm metamail-linux.tar.z
186 install -c $a /usr/bin
192 install -c -m 444 $a /usr/man/man1
197 install -c -m 644 mailcap /etc
199 STEP 7: Installing dialog-0.7
201 The installation of dialog-0.7 is easy, just use the following commands:
205 curl -O http://hightek.org/dialog/dialog-0.7.tar.gz
207 tar xvfz dialog-0.7.tar.gz
215 STEP 8: Installing sharutils 4.1.2
217 Even though there is a patch available for sharutils-4.2.1, I have not found
218 instructions in LFS/BLFS, so I decided to include them.
220 The first thing to do is to get the source and the patch and to unpack the source:
224 curl -O http://ftp.gnu.org/gnu/sharutils/sharutils-4.2.1.tar.gz
225 curl -O http://www.linuxfromscratch.org/patches/downloads/sharutils/sharutils-4.2.1-gettext-1.patch
227 tar xvfz sharutils-4.2.1.tar.gz
228 rm sharutils-4.2.1.tar.gz
230 Now apply the patch by running the following commands:
232 cd /usr/local/src/sharutils-4.2.1
234 patch -Np1 < ../sharutils-4.2.1-gettext-1.patch
236 Now compile the software as shown:
238 cd /usr/local/src/sharutils-4.2.1
239 ./configure --prefix=/usr
245 STEP 9: Installing hylafax-4.1.8
247 As Hylafax needs the uucp user and group to function we create these first:
250 useradd -g uucp -d /dev/null -s /bin/false uucp
252 Then we fetch the software and unpack it:
256 curl -O ftp://ftp.hylafax.org/source/hylafax-4.1.8.tar.gz
258 tar xvfz hylafax-4.1.8.tar.gz
259 rm hylafax-4.1.8.tar.gz
261 The next thing is configure the way Hylafax will be installed:
263 cd /usr/local/src/hylafax-4.1.8
267 After having called configure some defaults are shown.
269 HylaFAX configuration parameters (part 1 of 2) are:
271 [ 1] Directory for applications: /usr/local/bin
272 [ 2] Directory for lib data files: /usr/local/lib/fax
273 [ 3] Directory for lib executables: /usr/local/sbin
274 [ 4] Directory for system apps: /usr/local/sbin
275 [ 5] Directory for manual pages: /usr/local/man
276 [ 6] Directory for HTML documentation: /var/httpd/htdocs/hylafax
277 [ 7] Directory for spooling: /var/spool/hylafax
278 [ 8] Directory for uucp lock files: /var/lock
279 [ 9] Uucp lock file scheme: ascii
280 [10] PostScript imager package: gs
281 [11] PostScript imager program: /usr/bin/gs
282 [12] Manual page installation scheme: bsd-source-cat
283 [13] Default page size: North American Letter
284 [14] Default vertical res (lpi): 98
286 As the defaults where not acceptable for me I decided to overwrite them. Note that
287 <input> means to type the word input and <-enter-> means to press the return key.
289 Are these ok [yes]? <no><-enter->
290 Directory to install applications [/usr/local/bin]? </usr/bin><-enter->
291 Directory to install library data files [/usr/local/lib/fax]? </usr/lib/fax><-enter->
292 Directory to install library executables [/usr/local/sbin]? </usr/sbin><-enter->
293 Directory to install system apps [/usr/local/sbin]? </usr/sbin><-enter->
294 Directory to install manual pages [/usr/local/man]? </usr/man><-enter->
295 Directory to install HTML documentation [/var/httpd/htdocs/hylafax]? <-enter->
296 Directory to setup server spooling area [/var/spool/hylafax]? <-enter->
297 Directory for uucp lock files [/var/lock]? <-enter->
298 UUCP lock file scheme [ascii]? <-enter->
299 PostScript imager package [gs]? <-enter->
300 PostScript imager program [/usr/bin/gs]? <-enter->
301 Manual page installation scheme [bsd-source-cat]? <-enter->
302 Default page size [North American Letter]? <ISO A4><-enter->
303 Default vertical res (lpi) [98]? <-enter->
305 The new values are shown:
307 HylaFAX configuration parameters (part 1 of 2) are:
309 [ 1] Directory for applications: /usr/bin
310 [ 2] Directory for lib data files: /usr/lib/fax
311 [ 3] Directory for lib executables: /usr/sbin
312 [ 4] Directory for system apps: /usr/sbin
313 [ 5] Directory for manual pages: /usr/man
314 [ 6] Directory for HTML documentation: /var/httpd/htdocs/hylafax
315 [ 7] Directory for spooling: /var/spool/hylafax
316 [ 8] Directory for uucp lock files: /var/lock
317 [ 9] Uucp lock file scheme: ascii
318 [10] PostScript imager package: gs
319 [11] PostScript imager program: /usr/bin/gs
320 [12] Manual page installation scheme: bsd-source-cat
321 [13] Default page size: ISO A4
322 [14] Default vertical res (lpi): 98
324 After the changes these are OK for me now, so I accept them:
326 Are these ok [yes]? <-enter->
328 The second set of values is shown:
330 HylaFAX configuration parameters (part 2 of 2) are:
332 [15] Location of getty program: /sbin/agetty
333 [16] Location of voice getty program: /bin/vgetty
334 [17] Location of sendmail program: /usr/sbin/sendmail
335 [18] Location of TIFF tools: /usr/bin
336 [19] Location of SysV init scripts: /etc/rc.d/init.d
337 [20] Location of SysV start scripts: ../rc2.d ../rc3.d ../rc4.d ../rc5.d
338 [21] Location of SysV stop scripts: ../rc0.d ../rc1.d ../rc6.d
339 [22] Name of SysV start script: S97hylafax
340 [23] Name of SysV stop script: K05hylafax
341 [24] Init script starts faxq: yes
342 [25] Init script starts hfaxd yes
343 [26] Start old protocol: no
344 [27] Start paging protocol: no
346 As these are OK for me I simply accepted them:
348 Are these ok [yes]? <-enter->
350 The actual installtion of the software is done with the following commands:
355 Now as Hylafax is installed we set it up using faxsetup:
359 faxsetup will ask a lot of questions which I listed below, together with my answers.
360 Just change them according to your needs:
362 You do not appear to have a "fax" user in the password file.
363 HylaFAX needs this to work properly, add it [yes]? <-enter->
367 Should an entry be added for the FaxMaster to /etc/mail/aliases [yes]? <-enter->
371 Users to receive fax-related mail [root]? <-enter->
375 HylaFAX configuration parameters are:
377 [1] Init script starts faxq: yes
378 [2] Init script starts hfaxd yes
379 [3] Start old protocol: no
380 [4] Start paging protocol: no
381 Are these ok [yes]? <-enter->
385 No scheduler config file exists, creating one from scratch.
386 Country code [1]? <49><-enter->
387 Area code []? <221><-enter->
388 Long distance dialing prefix [1]? <0><-enter->
389 International dialing prefix [011]? <00><-enter->
390 Dial string rules file (relative to /var/spool/hylafax) ["etc/dialrules"]? <-enter->
391 Tracing during normal server operation [1]? <527><-enter->
392 Default tracing during send and receive sessions [0xffffffff]? <527><-enter->
393 Continuation cover page (relative to /var/spool/hylafax) []? <etc/cover.tmpl><-enter->
394 Timeout when converting PostScript documents (secs) [180]? <-enter->
395 Maximum number of concurrent jobs to a destination [1]? <-enter->
396 Define a group of modems []? <-enter->
397 Time of day restrictions for outbound jobs ["Any"]? <-enter->
398 Pathname of destination controls file (relative to /var/spool/hylafax) []? <-enter->
399 Timeout before purging a stale UUCP lock file (secs) [30]? <-enter->
400 Max number of pages to permit in an outbound job [0xffffffff]? <-enter->
401 Syslog facility name for ServerTracing messages [daemon]? <-enter->
403 The non-default scheduler parameters are:
407 LongDistancePrefix: 0
408 InternationalPrefix: 00
410 ContCoverPage: etc/cover.tmpl
413 Are these ok [yes]? <-enter->
417 Restarting HylaFAX server processes.
418 Should I restart the HylaFAX server processes [yes]? <-enter->
420 This is the most important question. As we will not use a modem we do not need to run faxaddmodem:
422 You do not appear to have any modems configured for use. Modems are
423 configured for use with HylaFAX with the faxaddmodem(8C) command.
424 Do you want to run faxaddmodem to configure a modem [yes]? <no><-enter->
426 STEP 10: Installing capi4hylafax-01.02.02
428 cap4hylafax actually makes it possible to use hylafax with the software and kernel we compiled earlier.
430 First fetch the software and unpack it:
434 curl -O ftp://ftp.avm.de/tools/capi4hylafax.linux/capi4hylafax-01.02.02.tar.gz
436 tar xvfz capi4hylafax-01.02.02.tar.gz
437 rm capi4hylafax-01.02.02.tar.gz
439 cd /usr/local/src/capi4hylafax-01.02.02
441 Now compile the software using the following commands:
443 ./configure --prefix=/usr
446 As we will be using three different MSN we add three devices for Hylafax:
448 ln -s capi20 /dev/faxCAPI
449 ln -s capi20 /dev/faxCAPI2
450 ln -s capi20 /dev/faxCAPI3
452 To install the software run the install script and answer some questions.
453 I have included my (slightly changed) answers, make sure to use the values right for you:
460 Incoming MSNs -- is set --- [4929xxx]
461 DDI Params -- no ddi ---
462 Fax Number +49.221.4929xxx
463 Fax Identifier Benjamin Boksa
464 Number Prefix [ empty ]
469 STEP 11: Installing a boot script for the capi
471 The following installs a simple script to start CAPI2.0 at boot time:
473 cat > /etc/rc.d/init.d/capi <<"EOF"
475 # Begin $rc_base/init.d/capi
477 # Based on sysklogd script from LFS-3.1 and earlier.
478 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
480 source /etc/sysconfig/rc
485 echo "Starting capi 2.0..."
486 loadproc capiinit start
490 echo "Stopping capi 2.0..."
506 echo "Usage: $0 {start|stop|restart|status}"
511 # End $rc_base/init.d/capi
514 chmod 755 /etc/rc.d/init.d/capi
516 cd /etc/rc.d/init.d &&
517 ln -sf ../init.d/capi ../rc0.d/K10capi &&
518 ln -sf ../init.d/capi ../rc1.d/K10capi &&
519 ln -sf ../init.d/capi ../rc2.d/S90capi &&
520 ln -sf ../init.d/capi ../rc3.d/S90capi &&
521 ln -sf ../init.d/capi ../rc4.d/S90capi &&
522 ln -sf ../init.d/capi ../rc5.d/S90capi &&
523 ln -sf ../init.d/capi ../rc6.d/K10capi
525 STEP 12: Adjusting the Hylafax installation
527 This section will show some information about adjustments I made after having installed Hylafax:
529 The following patch enables the paging protocol for hylafax which I did not
530 enable during the installation:
532 ----- begin patch (/var/spool/hylafax/etc/setup.cache) -----
534 < HFAXD_SNPP_SERVER='no'
536 > HFAXD_SNPP_SERVER='yes'
537 ----- end patch -----
539 The following patch makes it possible to use uuencode (from sharutils) replacing
540 the old mimencode from metamail:
542 ----- begin patch (/var/spool/hylafax/bin/faxrcvd) -----
543 --- /var/spool/hylafax/bin/faxrcvd.orig 2004-02-22 01:07:54.000000000 +0100
544 +++ /var/spool/hylafax/bin/faxrcvd 2004-02-23 02:53:58.000000000 +0100
549 +function encode_base64 {
550 + if [ -x /usr/bin/uuencode ]; then
551 + /usr/bin/uuencode -m $1 $1 | /bin/sed '1d;$d'
552 + elif [ -x /usr/bin/mimencode ]; then
553 + /usr/bin/mimencode $1
555 + echo "Error: No encoder for base64 found."
556 + echo "Please install sharutils or metamail."
561 FAX2PS=$TIFFBIN/fax2ps
567 echo "Content-Transfer-Encoding: $ENCODING"
568 echo "Content-Disposition: attachment; filename=\"$FILENAME.tif\""
570 - $MIMENCODE $FILE 2>/dev/null
571 + encode_base64 $FILE 2>/dev/null
572 elif [ "$FILETYPE" = "pdf" ]; then
573 echo "Content-Type: application/pdf; name=\"c$COMMID.pdf\""
574 echo "Content-Description: FAX document"
576 $SED 's/.*Resolution: [0-9]*, \([0-9]*\).*/\1/g' | sort -n | $SED -n '$p'`
577 $TIFF2PS -a -O $FILE.ps $FILE 2>/dev/null # fax2ps looks bad
578 $PS2PDF -g$GW\x$GL -r$RW\x$RL $FILE.ps $FILE.pdf 2>/dev/null
579 - $MIMENCODE $FILE.pdf 2>/dev/null
580 + encode_base64 $FILE.pdf 2>/dev/null
581 $RM -f $FILE.ps $FILE.pdf 2>/dev/null
582 else # default as Postscript
583 echo "Content-Type: application/postscript; name=\"$FILENAME.ps\""
584 ----- end patch -----
586 STEP 13: Using multiple MSN with Hylafax
588 The idea behind this is very simple: We create a device for every MSN we want to
589 use with hylafax. The device can the be used to distribute the incoming faxes as needed.
591 Before changing the configuration we have to create to more symlinks to enable
592 the devices we created above:
594 ln -s config.faxCAPI /var/spool/hylafax/etc/config.faxCAPI2
595 ln -s config.faxCAPI /var/spool/hylafax/etc/config.faxCAPI3
597 To use the devices you have to create a section for each of them. The following
598 patch shows my changes. It also shows that I did not have to change anything
599 for the first device, as it was already configured during installation. The
600 other two sections are simply copies of the first section with the necessary
603 ----- begin patch (/var/spool/hylafax/etc/config.faxCAPI) -----
604 --- /var/spool/hylafax/etc/config.faxCAPI.orig 2004-02-23 19:59:54.000000000 +0100
605 +++ /var/spool/hylafax/etc/config.faxCAPI 2004-02-23 11:57:09.000000000 +0100
607 # as many subsections as required, since virtual DeviceNames do not play
608 # any role in this mode of operation.
612 +# 1st device, MSN 4929xxx
615 # "HylafaxDeviceName" ist der Name, unter dem sich C4H bei HylaFAX als
620 +# 2nd device, MSN 2790xxx
622 + HylafaxDeviceName: faxCAPI2
624 + FAXNumber: +49.221.2790xxx
625 + LocalIdentifier: "Benjamin Boksa"
626 + MaxConcurrentRecvs: 2
628 + # ----------- outgoing params -----------
629 + OutgoingController: 1
630 + OutgoingMSN: 2790xxx
633 + UseISDNFaxService: 0
636 + # ----------- incoming params -----------
644 + IncomingMSNs: 2790xxx
645 + AcceptGlobalCall: 1
649 +# 3rd device, MSN 2790xxx
651 + HylafaxDeviceName: faxCAPI3
653 + FAXNumber: +49.221.2790xxx
654 + LocalIdentifier: "Familie Boksa"
655 + MaxConcurrentRecvs: 2
657 + # ----------- outgoing params -----------
658 + OutgoingController: 1
659 + OutgoingMSN: 2790xxx
662 + UseISDNFaxService: 0
665 + # ----------- incoming params -----------
673 + IncomingMSNs: 2790xxx
674 + AcceptGlobalCall: 1
677 ----- end patch -----
679 We create a file FaxDispatch which control the delivery of the converted faxes based
680 on the device (read: the MSN) that received the fax:
682 ----- begin file (/var/spool/hylafax/etc/FaxDispatch) -----
684 faxCAPI) SENDTO=b.boksa@sidebysite.de; FILETYPE=pdf;;
685 faxCAPI2) SENDTO=benjamin@boksa.de; FILETYPE=pdf;;
686 faxCAPI3) SENDTO=daniel@boksa.de,gudrun@boksa.de; FILETYPE=pdf;;
692 * Added/Corrected some stuff as the result of the feedback from blfs-support
694 * Initial release, posted to blfs-support for comments