diff options
-rw-r--r-- | .SRCINFO | 48 | ||||
-rw-r--r-- | 0006-hylafaxplus-jobfmt-assigned-modem-to-used-modem.patch | 21 | ||||
-rw-r--r-- | 1000-hylafaxplus-modem-support.patch | 135 | ||||
-rw-r--r-- | PKGBUILD | 507 | ||||
-rw-r--r-- | hylafax.install | 4 | ||||
-rwxr-xr-x | localnxxtoregex.sh | 108 |
6 files changed, 725 insertions, 98 deletions
@@ -1,14 +1,18 @@ # Generated by mksrcinfo v8 -# Tue Nov 27 22:28:47 UTC 2018 +# Thu Feb 8 22:07:06 UTC 2024 pkgbase = hylafaxplus pkgdesc = Enterprise Fax Server - pkgver = 5.6.1 - pkgrel = 2 + pkgver = 7.0.7 + pkgrel = 3 url = http://hylafax.sourceforge.net/ install = hylafax.install arch = i686 arch = x86_64 license = custom + depends = glibc + depends = libtiff>=4.6.0 + depends = bash + depends = perl depends = dash depends = libtiff depends = pam @@ -16,16 +20,26 @@ pkgbase = hylafaxplus depends = sharutils depends = jbigkit depends = lcms2 - depends = smtp-server - depends = gsfonts-type1 + depends = gawk + depends = libjpeg-turbo + depends = libldap + depends = libxcrypt + depends = openssl + depends = zlib + depends = libtiff5-hylafaxplus + optdepends = smtp-server: email support optdepends = avantfax: manage HylaFAX+ through web browser optdepends = t38modem: sip/voip fax modem pool interface optdepends = fax4cups: CUPS fax printer optdepends = faxfrontend: CUPS fax printer optdepends = 2Fax: ascii to fax generator including pictures and fonts - provides = hylafax=5.6.1 + optdepends = yajhfc: hylafax client in Java + optdepends = mainpine-rfuser: reset utility for MainPine modems + optdepends = tgif: Cover Page Customization + provides = hylafax=7.0.7 conflicts = hylafax - source = https://downloads.sourceforge.net/hylafax/hylafax-5.6.1.tar.gz + options = !buildflags + source = https://downloads.sourceforge.net/hylafax/hylafax-7.0.7.tar.gz source = sendfaxvsi-1.0.0.tgz::https://github.com/severach/sendfaxvsi/archive/18fabc74490362cd26690331d546d727c727db25.tar.gz source = fmfix.pl source = localnxxtoregex.sh @@ -35,16 +49,32 @@ pkgbase = hylafaxplus source = 0004-hylafaxplus-systemd.patch source = 0004a-hylafaxplus-systemd.patch source = 0005-hylafaxplus-faxsetup.patch - sha256sums = 419b8376f36a0a7bc685f083cd5230d4cc28581c4a8c035d2ae611e2a6651280 + source = 0006-hylafaxplus-jobfmt-assigned-modem-to-used-modem.patch + source = 1000-hylafaxplus-modem-support.patch + md5sums = 17ec4957f66ef422afe928eeb4a879d9 + md5sums = 3af38f1eaa4f9fb92cac2f0cf9544321 + md5sums = 916f2c100eb2b41ef6b35f96bdb9444a + md5sums = ae0a86260ab7ed94187a5d8e560a82ac + md5sums = 0edd9dbf9b745437a5a4c174d6418e96 + md5sums = a2d08cfd91be2aa608dd3bc9ef6c69bc + md5sums = c8c3aab59725c20eddc7d31d21c7b31e + md5sums = fd0395521f6c2b8681e5fbcfd943043d + md5sums = a14922b05223f703c41dff8035477706 + md5sums = 0de848f554e2a93c09352eadb2b2e260 + md5sums = 151567ca960d860c88ff0e5154cb5b78 + md5sums = dd1e2859dd1cc13db863ba74bc539ca0 + sha256sums = 8b9bcd4fe25f08b658e6cfcb3514183c22cbbfdf7166fa092510011a8228f88d sha256sums = 0aed186ab30fdb7cf36895a0ff50b03bd4a68db63cf4f19763995dabd9caffb0 sha256sums = 466ab17cdaa1eb1f1f0b5bdc444a90df5835a1896b1363584264920bbc3929f2 - sha256sums = 80d2e28ee7a7d8f93501e32c96e9895e242409da1326761d36dbf28e5a0e3677 + sha256sums = 8b2dbf38d13d0c25e6164e691187b4f45ae971c009e80911cd96aac0f61cf871 sha256sums = dd4728f8204d0bba2a026768f0e0216778ed26583c3f799f6266554e21b48fe2 sha256sums = 5f19fa1f3b12fd480f4c28a9a2bdf041359d5510e1040b735d5f312071dcbd04 sha256sums = b4b93c149164ed7c96f4f04373c32198c1e19c89ca9e2ab6e92e17c0a48bd1af sha256sums = 989d6f71a8cfe99a3ca983981f8d8e9368776e2fc7667a809755d8d7292d52ad sha256sums = 528f267805203b792741423f46114fee7b48664f1aab35a0edff7d519555ccc2 sha256sums = e2b43c19705ce112dd3a08ecd0cae4c5558910366291524566cdd5890b2c6095 + sha256sums = 4efef67287b2b5ebaa2485ac5be5a62d2a86b2830b416f7a6905cfe17d6e76bb + sha256sums = 98e79e16e9cda5bb853501daaac7734cd5a367eb7543990f6a3c16fef49d0968 pkgname = hylafaxplus diff --git a/0006-hylafaxplus-jobfmt-assigned-modem-to-used-modem.patch b/0006-hylafaxplus-jobfmt-assigned-modem-to-used-modem.patch new file mode 100644 index 000000000000..4d6882215bfe --- /dev/null +++ b/0006-hylafaxplus-jobfmt-assigned-modem-to-used-modem.patch @@ -0,0 +1,21 @@ +--- hfaxd/Jobs.c++.Arch 2020-07-31 18:37:47.000000000 -0400 ++++ hfaxd/Jobs.c++ 2022-01-25 15:31:31.103951194 -0500 +@@ -2252,11 +2252,17 @@ HylaFAXServer::Jprintf(FILE* fd, const c + break; + case 'l': + fprintf(fd, fspec, job.pagelength); + break; + case 'm': +- fprintf(fd, fspec, (const char*) job.modem); ++ { ++ const char *q,*p=job.modemused; ++ if (*p == '\0') p=job.modem; ++ if (0==strcmp(p,"any")) p=""; ++ q=strstr(p,"tty"); /* I'd rather search backwards */ ++ fprintf(fd, fspec, q?(q+3):p); ++ } + break; + case 'n': + fprintf(fd, fspec, " DQA"[job.notify]); + break; + case 'o': diff --git a/1000-hylafaxplus-modem-support.patch b/1000-hylafaxplus-modem-support.patch new file mode 100644 index 000000000000..9b1f888568c8 --- /dev/null +++ b/1000-hylafaxplus-modem-support.patch @@ -0,0 +1,135 @@ +diff -pNaru5 config.Arch/conexant-1.0 config/conexant-1.0 +--- config.Arch/conexant-1.0 2015-07-26 20:46:06.000000000 -0400 ++++ config/conexant-1.0 2019-04-25 00:05:01.600945703 -0400 +@@ -7,13 +7,17 @@ + # support "Class 1.0" which means that they have "adaptive receive" + # (AT+FAR=1), but not V.34. + # + # Comtrol RocketModem II/III/IV + # MultiTech MT5600ZDX ++# MultiTech MT5656ZDX ++# MultiTech MT5600BA + # Zoltrix FMVSP56i3 + # + # CONFIG:CLASS1.0:56000:.*:.*: Manufacturer=Rockwell/Conexant Model=AC/K56 ++# CONFIG:CLASS1.0:MT5600BA-V92:.*:.*: Manufacturer=MultiTech Model=MT5600BA-V92 ++# CONFIG:CLASS1.0:MT5600BA:.*:.*: Manufacturer=MultiTech Model=MT5600BA-V90 + # CONFIG:CLASS1.0:MT5600ZDX:.*:.*: Manufacturer=MultiTech Model=MT5600ZDX + # CONFIG:CLASS1.0:MT5656ZDX*:.*:.*: Manufacturer=MultiTech Model=MT5656ZDX + # CONFIG:CLASS1.0:.*:.*LEONARDO.*:.*: Manufacturer=Digicom Model=Leonardo + # + # BEGIN-SERVER +@@ -36,5 +40,8 @@ ModemHardFlowCmd: AT&K3 # setup hardwar + ModemSoftFlowCmd: AT&K4 # setup software flow control + ModemSetupDTRCmd: AT&D2 # setup so DTR drop resets modem + ModemSetupDCDCmd: AT&C1 # setup so DCD reflects carrier (or not) + # + Class1AdaptRecvCmd: AT+FAR=1 # reports carrier detection mismatches ++# ++# ATDT wait for dial tone W produces busy signals on MT5600BA ++#ModemDialCmd: ATDT9,%s +diff -pNaru5 config.Arch/lucent config/lucent +--- config.Arch/lucent 2015-07-26 20:46:06.000000000 -0400 ++++ config/lucent 2019-04-12 14:05:09.188228149 -0400 +@@ -46,10 +46,12 @@ + # CONFIG:CLASS1:Zoom V.90 Serial*:.*:.*: Manufacturer=Zoom Model=2949L + # CONFIG:CLASS1:EFM560 VER*:.*:.*: Manufacturer=AboCom Model=EFM560 + # CONFIG:CLASS1:Mainpine Venus V.92*:.*:.*: Manufacturer=Mainpine Model=RockForce + # CONFIG:CLASS1:Mainpine CFAX34*:.*:.*: Manufacturer=Mainpine Model='IQ Express' + # CONFIG:CLASS1:.*:Mainpine CFAX34*:.*: Manufacturer=Mainpine Model='IQ Express' ++# CONFIG:CLASS1:LT 33.6 MT3334ZDX*:.*:.*: Manufacturer=Lucent Model='MT3334ZDX' ++# CONFIG:CLASS1:Agere OCM V.92 MT9234ZBA*:.*:.*: Manufacturer=MultiTech Model=MT9234ZBA + # CONFIG:CLASS1:Agere OCM V.92*:.*:.*: Manufacturer=Agere Model=OCM + # CONFIG:CLASS1:AGERE OCM V.92*:.*:.*: Manufacturer=Agere Model=OCM + # + # BEGIN-SERVER + # END-SERVER +diff -pNaru5 config.Arch/lucent-mt-10 config/lucent-mt-10 +--- config.Arch/lucent-mt-10 2015-07-26 20:46:06.000000000 -0400 ++++ config/lucent-mt-10 2019-04-12 14:05:09.188228149 -0400 +@@ -10,10 +10,11 @@ + # CONFIG:CLASS1.0:LT V.90 1.0 MT5634ZBA*:.*:.*: Manufacturer=MultiTech Model=MT5634ZBA + # CONFIG:CLASS1.0:LT V.92 1.0 MT5634ZBA*:.*:.*: Manufacturer=MultiTech Model=MT5634ZBA + # CONFIG:CLASS1.0:LT V.90 1.0 ISI5634PCI*:.*:.*: Manufacturer=MultiTech Model=ISI5634PCI + # CONFIG:CLASS1.0:LT V.92 1.0 ISI5634PCI*:.*:.*: Manufacturer=MultiTech Model=ISI5634PCI + # CONFIG:CLASS1.0:LT V.92 1.0 MT5634SMI*:.*:.*: Manufacturer=MultiTech Model=MT5634SMI ++# CONFIG:CLASS1.0:Agere OCM V.92 MT9234ZBA*:.*:.*: Manufacturer=MultiTech Model=MT9234ZBA + # CONFIG:CLASS1.0:Agere OCM V.92*:.*:.*: Manufacturer=Agere Model=OCM + # CONFIG:CLASS1.0:AGERE OCM V.92*:.*:.*: Manufacturer=Agere Model=OCM + # + # BEGIN-SERVER + # END-SERVER +diff -pNaru5 config.Arch/lucent-mt-2 config/lucent-mt-2 +--- config.Arch/lucent-mt-2 2015-07-26 20:46:06.000000000 -0400 ++++ config/lucent-mt-2 2019-04-12 14:05:09.188228149 -0400 +@@ -9,10 +9,11 @@ + # + + # + # CONFIG: CLASS2:"Multi-Tech Systems"-"MT5634ZPX-PCI"-* + # CONFIG: CLASS2:"Multi-Tech Systems"-"MT5634ZBA"-* ++# CONFIG: CLASS2:"Multi-Tech Systems"-*"MT3334ZDX"* + # CONFIG: CLASS2:*-"ISI5634PCI"-* + # CONFIG: CLASS2:*-"MT5634SMI-V92"-* + # + # BEGIN-SERVER + # END-SERVER +diff -pNaru5 config.Arch/rc288dpi-1 config/rc288dpi-1 +--- config.Arch/rc288dpi-1 2015-07-26 20:46:06.000000000 -0400 ++++ config/rc288dpi-1 2019-04-12 14:06:52.938859444 -0400 +@@ -38,10 +38,12 @@ + # switches to XON/XOFF (testing host was too fast to see). + # + # CONFIG:CLASS1:28800:.*:.*: Manufacturer=ROCKWELL Model=RC288DPi + # CONFIG:CLASS1:33600:.*:.*: Manufacturer=Rockwell Model=33600 + # CONFIG:CLASS1:56000:.*:.*: Manufacturer=Rockwell/Conexant Model=AC/K56 ++# CONFIG:CLASS1:MT5600BA-V92:.*:.*: Manufacturer=MultiTech Model=MT5600BA-V92 ++# CONFIG:CLASS1:MT5600BA:.*:.*: Manufacturer=MultiTech Model=MT5600BA + # CONFIG:CLASS1:MT5600ZDX:.*:.*: Manufacturer=MultiTech Model=MT5600ZDX + # CONFIG:CLASS1:MT5656ZDX*:.*:.*: Manufacturer=MultiTech Model=MT5656ZDX + # + # BEGIN-SERVER + # END-SERVER +diff -pNaru5 config.Arch/usr-rts config/usr-rts +--- config.Arch/usr-rts 2015-07-26 20:46:06.000000000 -0400 ++++ config/usr-rts 2019-04-24 23:18:18.003137846 -0400 +@@ -79,13 +79,18 @@ ModemSetupAACmd: AT+FCLASS=0 # leave mod + ModemAnswerCmd: AT+FCLASS=1 # force RTS/CTS after change + # + # Disables the reporting of bad frames by the modem. This + # overcomes a firmware problem in the x2 and V90 Sportsters. + # It is not necessary for the Courier modem. ++# It errors on the Sportster 5686G V.92. + # +-Class2NRCmd: AT+FNR=1,1,1,0 ++#Class2NRCmd: AT+FNR=1,1,1,0 + # ++# Sportster 5686G (Agere CV92) doesn't respond correctly to AT+FTM=? ++#Class1TMQueryCmd: "!3,24,48,72,73,74,96,97,98,121,122,145,146" ++#Class1RMQueryCmd: "!3,24,48,72,73,74,96,97,98,121,122,145,146" ++# + # When using AT+FRS=n we see USR modems reset themselves in the middle of sessions + # this is not good. So, we seem to work-around that problem by not using the + # command. Unfortunately, this isn't an ideal thing. + # + Class1SwitchingCmd: "<delay\0727>" +diff -pNaru5 config.Arch/zyxel-1496e-1 config/zyxel-1496e-1 +--- config.Arch/zyxel-1496e-1 2015-07-26 20:46:06.000000000 -0400 ++++ config/zyxel-1496e-1 2019-04-24 23:28:05.746941599 -0400 +@@ -60,14 +60,14 @@ ModemSetupAACmd: AT+FAA=1 # enable in cu + # Additional reset commands: + # + # &B1 DTE-DCE rate is fixed at DTE setting + # &N0 Auto-negotiate highest possible DCE-DCE link rate + # &S0 DSR always on +-# *F0 Deny remote configuration ++# *F0 Deny remote configuration (removed due to error on U90E) + # S38.3=1 DCD on/off sequence follows UNIX standard + # +-ModemResetCmds: AT&B1&N0&S0*F0S38.3=1 ++ModemResetCmds: AT&B1&N0&S0S38.3=1 + # + # We normally append the "@" symbol to the dial string so that + # the modem will wait 5 seconds before attempting to connect + # and return result codes that distinguish between no carrier + # and no answer. This makes it possible to avoid problems with @@ -23,6 +23,10 @@ # TODO: Improve systemd code now that it's out of sed and in patch # TODO: Remove hfaxd.service and faxq.service symlinks +# TODO: log/c* modem and phone statistics script +# TODO: doneq/q* extended connection info awk script +# TODO: automatic requeue script + # Setting these skel defaults will make adding modems easier. _opt_AreaCode="517" @@ -81,15 +85,18 @@ _opt_pagesize="Letter" # A4, Letter, Legal # Enable one of the modems with some of the following commands. -# sudo systemctl enable faxgetty@ttyUSB0.service -# sudo systemctl start faxgetty@ttyUSB0.service -# sudo systemctl enable faxgetty@ttyACM0.service -# sudo systemctl start faxgetty@ttyACM0.service +# sudo systemctl enable --now faxgetty@ttyUSB0.service +# sudo systemctl enable --now faxgetty@ttyACM0.service # You only need to enable the first faxgetty service manually. faxsetup will # detect that faxgetty is in use and automatically enable and start all # configured modems. When all modems are added run faxsetup again to restart # the servers and enable all modems. +# Note that all modems are enabled including those that were manually +# disabled 'systemctl disable --now'. To permanently disable a modem +# you must 'rm /var/spool/hylafax/etc/config.tty...' +# To prevent faxsetup from enabling a modem and keep the config: +# mv /var/spool/hylafax/etc/config.ttyACM1 /var/spool/hylafax/etc/config.disabled.ttyACM1 # sudo faxsetup @@ -170,38 +177,59 @@ _opt_pagesize="Letter" # A4, Letter, Legal # http://lists.opensuse.org/opensuse/2009-09/msg00269.html # Re: [opensuse] Update Hylafax 4.4 to 6.03 with src.rpm on OpenSuSE 10.3 +# 0 use external libtiff package (libtiff5 or libtiff-hylafaxplus) +# 1 include libtiff in hylafaxplus +_opt_Integrated_LIBTIFF=0 + +# 0 link hylafaxplus executables to external libtiff (libtiff5 or libtiff-hylafaxplus) +# 1 link to system libtiff. New versions are often incompatible. +_opt_HF_System_LIBTIFF=1 + set -u pkgname='hylafaxplus' _pkgnick='hylafax' -pkgver='5.6.1' -pkgrel='2' +pkgver='7.0.7' +pkgrel='3' _sendfaxvsicommit='18fabc74490362cd26690331d546d727c727db25' pkgdesc='Enterprise Fax Server' arch=('i686' 'x86_64') url='http://hylafax.sourceforge.net/' license=('custom') -depends=('dash' 'libtiff' 'pam' 'ghostscript' 'sharutils' 'jbigkit' 'lcms2' 'smtp-server' 'gsfonts-type1') # 'cron' +depends=('glibc' 'gcc-libs' 'bash' 'perl' 'dash' 'libtiff' 'pam' 'ghostscript' 'sharutils' 'jbigkit' 'lcms2' 'gawk' 'libjpeg-turbo' 'libldap' 'libxcrypt' 'openssl' 'zlib') # 'gsfonts-type1') # 'cron' +depends[1]='libtiff>=4.6.0' # 'libtiff<4.6.0' https://sourceforge.net/p/hylafax/mailman/message/38259441/ +if [ "${_opt_Integrated_LIBTIFF}" -eq 0 ]; then + depends+=('libtiff5-hylafaxplus') +else + provides=('libtiff5') # no =version +fi # BASE64 is the default so HylaFAX+ doesn't need uuencode but I put it in anyways to placate configure and the bin finder in faxsetup! -optdepends=('avantfax: manage HylaFAX+ through web browser' - #'HERMESfax: manage HylaFAX+ through web browser' # Way too old - 't38modem: sip/voip fax modem pool interface' - 'fax4cups: CUPS fax printer' # http://vigna.di.unimi.it/fax4CUPS/ - 'faxfrontend: CUPS fax printer' # https://www.vitki.net/book/page/integrating-hylafax-cups - '2Fax: ascii to fax generator including pictures and fonts' # http://www.atbas.org/2fax/ascii.php - #'cypheus: (Windows) manage HylaFAX+' # Pretty old +optdepends=( + 'smtp-server: email support' # this must be configured if installed or Hylafax will spam the process table with orphaned sendmail processes + 'avantfax: manage HylaFAX+ through web browser' + #'HERMESfax: manage HylaFAX+ through web browser' # Way too old + 't38modem: sip/voip fax modem pool interface' + 'fax4cups: CUPS fax printer' # http://vigna.di.unimi.it/fax4CUPS/ + 'faxfrontend: CUPS fax printer' # https://www.vitki.net/book/page/integrating-hylafax-cups + '2Fax: ascii to fax generator including pictures and fonts' # http://www.atbas.org/2fax/ascii.php + #'cypheus: (Windows) manage HylaFAX+' # Pretty old # Too ad like and will show in red as not found packages... We'll leave them here for avid readers. - #'Winprint-HylaFAX-Reloaded: (Windows) print to fax' # http://nerdvittles.com/?p=738 Incredible Fax: Free Faxing Returns to Incredible PBX 1.8 - #'WinPrint-Hylafax-for-Windows: (Windows) print to fax' - #'Hylafax-support: iFax Solutions can help configure your fax system' + #'Winprint-HylaFAX-Reloaded: (Windows) print to fax' # http://nerdvittles.com/?p=738 Incredible Fax: Free Faxing Returns to Incredible PBX 1.8 + #'WinPrint-Hylafax-for-Windows: (Windows) print to fax' + #'Hylafax-support: iFax Solutions can help configure your fax system' # 'sambafax' # 'gfax: fax from Gnome (X)' + 'yajhfc: hylafax client in Java' + 'mainpine-rfuser: reset utility for MainPine modems' + 'tgif: Cover Page Customization' ) provides=("hylafax=${pkgver}") conflicts=('hylafax') # backup=(var/spool/hylafax/bin/{faxrcvd,notify}) +options=('!buildflags') # get rid of Class 1 errors No response to PPS MPS, RSPREC DCN, No receiver protocol, Failure to train remote modem install="${_pkgnick}.install" # 'var/spool/hylafax/etc/hosts.hfaxd') # This is better handled with a .default file. _verwatch=("${url}" 'news/\([0-9\.]\+\)\.php' 'l') +_srcdir="${_pkgnick}-${pkgver}" source=( "https://downloads.sourceforge.net/hylafax/${_pkgnick}-${pkgver}.tar.gz" "sendfaxvsi-1.0.0.tgz::https://github.com/severach/sendfaxvsi/archive/${_sendfaxvsicommit}.tar.gz" @@ -213,17 +241,34 @@ source=( '0004-hylafaxplus-systemd.patch' '0004a-hylafaxplus-systemd.patch' '0005-hylafaxplus-faxsetup.patch' + '0006-hylafaxplus-jobfmt-assigned-modem-to-used-modem.patch' + '1000-hylafaxplus-modem-support.patch' ) -sha256sums=('419b8376f36a0a7bc685f083cd5230d4cc28581c4a8c035d2ae611e2a6651280' +md5sums=('17ec4957f66ef422afe928eeb4a879d9' + '3af38f1eaa4f9fb92cac2f0cf9544321' + '916f2c100eb2b41ef6b35f96bdb9444a' + 'ae0a86260ab7ed94187a5d8e560a82ac' + '0edd9dbf9b745437a5a4c174d6418e96' + 'a2d08cfd91be2aa608dd3bc9ef6c69bc' + 'c8c3aab59725c20eddc7d31d21c7b31e' + 'fd0395521f6c2b8681e5fbcfd943043d' + 'a14922b05223f703c41dff8035477706' + '0de848f554e2a93c09352eadb2b2e260' + '151567ca960d860c88ff0e5154cb5b78' + 'dd1e2859dd1cc13db863ba74bc539ca0') +sha256sums=('8b9bcd4fe25f08b658e6cfcb3514183c22cbbfdf7166fa092510011a8228f88d' '0aed186ab30fdb7cf36895a0ff50b03bd4a68db63cf4f19763995dabd9caffb0' '466ab17cdaa1eb1f1f0b5bdc444a90df5835a1896b1363584264920bbc3929f2' - '80d2e28ee7a7d8f93501e32c96e9895e242409da1326761d36dbf28e5a0e3677' + '8b2dbf38d13d0c25e6164e691187b4f45ae971c009e80911cd96aac0f61cf871' 'dd4728f8204d0bba2a026768f0e0216778ed26583c3f799f6266554e21b48fe2' '5f19fa1f3b12fd480f4c28a9a2bdf041359d5510e1040b735d5f312071dcbd04' 'b4b93c149164ed7c96f4f04373c32198c1e19c89ca9e2ab6e92e17c0a48bd1af' '989d6f71a8cfe99a3ca983981f8d8e9368776e2fc7667a809755d8d7292d52ad' '528f267805203b792741423f46114fee7b48664f1aab35a0edff7d519555ccc2' - 'e2b43c19705ce112dd3a08ecd0cae4c5558910366291524566cdd5890b2c6095') + 'e2b43c19705ce112dd3a08ecd0cae4c5558910366291524566cdd5890b2c6095' + '4efef67287b2b5ebaa2485ac5be5a62d2a86b2830b416f7a6905cfe17d6e76bb' + '98e79e16e9cda5bb853501daaac7734cd5a367eb7543990f6a3c16fef49d0968') + # The HylaFAX binaries work very well. The scripts need major fixes! # HylaFAX+ is pretty much completely broken for any Linux install, # and some parts are broken for other Unix too. The original HylaFAX @@ -242,9 +287,124 @@ sha256sums=('419b8376f36a0a7bc685f083cd5230d4cc28581c4a8c035d2ae611e2a6651280' # Note: I only send faxes. Fax receiving might need a bunch more patches. +if [ "${_opt_Integrated_LIBTIFF}" -ne 0 ]; then +_libtiff_top() { +set -u +local _pkgname=tiff +#pkgname=libtiff +#pkgname+='5' +local pkgver=4.4.0 +#pkgrel=2 +#pkgdesc='Library for manipulation of TIFF images' +#arch=('x86_64' 'aarch64') +#url='http://www.simplesystems.org/libtiff' +license+=('custom') +depends+=('gcc-libs' 'glibc' 'libjpeg-turbo' 'libjpeg.so' 'zlib' 'xz' 'zstd') +#depends+=('libtiff>=4.6.0') +conflicts+=('libtiff<4.6.0' 'libtiff5') +_libtiff_srcdir="${_pkgname}-${pkgver}" +source+=( + "https://download.osgeo.org/libtiff/tiff-${pkgver}.tar.gz" + # fix CVE-2022-2056 / CVE-2022-2057 / CVE-2022-2058: https://bugs.archlinux.org/task/75360 + "${pkgname}-4.4.0-fpe_tiffcrop.patch::https://gitlab.com/libtiff/libtiff/-/commit/dd1bcc7abb26094e93636e85520f0d8f81ab0fab.patch" + # fix CVE-2022-34526: https://bugs.archlinux.org/task/75608 + "${pkgname}-4.4.0-CVE-2022-34526.patch::https://gitlab.com/libtiff/libtiff/-/commit/275735d0354e39c0ac1dc3c0db2120d6f31d1990.patch" +) +} +_libtiff_top + +_libtiff_prepare() { + set -u + cd "${_libtiff_srcdir}" + # apply patch from the source array (should be a pacman feature) + local _src + for _src in "${source[@]}"; do + _src="${_src%%::*}" + _src="${_src##*/}" + if [[ "${_src}" = libtiff*.patch ]]; then + echo "Applying patch ${_src}..." + patch -Np1 -i "../${_src}" + fi + done + set +u +} + +_libtiff_incdir='libtiff-hylafaxplus' +_libtiff_libdir='libtiff-hylafaxplus' + +_libtiff_build() { + set -u + local _configure_options=( + --prefix=/usr + #--sysconfdir=/etc + #--enable-ld-version-script + #--mandir=/usr/share/man + #--with-docdir=/usr/share/doc/${pkgname} + --includedir="/usr/include/${_libtiff_incdir}" + #--libdir="/usr/lib/${_libtiff_libdir}" + #--bindir='/usr/bin/hylafax' # how will all the scripts work if we move the binaries + ) + cd "${_libtiff_srcdir}" + if [ ! -s 'Makefile' ]; then + #CFLAGS+=' -fpic' + ./configure "${_configure_options[@]}" + fi + make -s + set +u +} + +_libtiff_check() { + set -u + cd "${_libtiff_srcdir}" + make check + set +u +} + +_libtiff_package() { + set -u + cd "${_libtiff_srcdir}" + make DESTDIR="${pkgdir}" install + install -Dm644 'COPYRIGHT' -t "${pkgdir}/usr/share/licenses/${pkgname}" + + cd "${pkgdir}" + local _f + for _f in tiffcp; do + mv "usr/bin/${_f}"{,.hylafax} + mv "usr/share/man/man1/${_f}"{.1,.hylafax.1} + done + for _f in tiffdump tiffinfo tiffset tiffsplit; do + rm "usr/bin/${_f}" + rm "usr/share/man/man1/${_f}.1" + done + shopt -s failglob + rm -r usr/share/{doc,man/man3} usr/lib/libtiff*.a + if :; then + rm -r 'usr/lib/pkgconfig' + install -d "usr/lib/${_libtiff_libdir}" + pushd "usr/lib/${_libtiff_libdir}" > /dev/null + mv ../libtiff*.so . + local _f + for _f in ../*.so*; do + ln -s "${_f}" + done + popd > /dev/null + fi + shopt -u failglob + #sed -e 's:^TIFFBIN=.*$:TIFFBIN=/usr/bin:g' -i "${pkgdir}/usr/bin/faxsetup" # not needed if we change TIFFBIN detection to tiffcp + set +u +} +else +_libtiff_incdir='libtiff5' +_libtiff_libdir='libtiff5' +_libtiff_prepare() { :; } +_libtiff_build() { :; } +_libtiff_check() { :; } +_libtiff_package() { :; } +fi + _pkginit() { if [ "${SOURCEONLY:-0}" -ne 0 ]; then # see makepkg -S if this var changes - if [ "${_opt_FAXNumber}" != '+1.517.555.0113' ] || [ "${_opt_LocalIdentifier}" != 'ArchLinuxFAX' ]; then + if [ "${_opt_FAXNumber}" != '+1.517.555.0101' ] || [ "${_opt_LocalIdentifier}" != 'ArchLinuxFAX' ]; then echo 'Our fax info must be removed from the PKGBUILD' 1>&2 echo 'to produce a source package.' 1>&2 exit 1 @@ -255,20 +415,31 @@ _pkginit unset -f _pkginit prepare() { + _libtiff_prepare; cd "${srcdir}" set -u - cd "${_pkgnick}-${pkgver}" + cd "${_srcdir}" # sbin is deprecated and should not be used. We'll obliterate # all uses of /sbin. Some /sbin not applicable to our OS are left alone. #cp -p 'configure'{,.Arch} - sed -e 's:^\(DIR_SBIN=/usr/local/\)sbin$:\1bin:g' \ - -e 's|:/sbin:\($PATH\)|:\1|g' \ - -e 's|\(findApp [^ ]\+ \)/sbin:\($PATH\)|\1\2|g' \ - -e 's|\(findAppDef [^ ]\+ \)/sbin:\($PATH\)|\1\2|g' \ - -e 's|^\(PATH=$PATH:/bin:/usr/bin\)\(:/etc\)$|\1 # \2 # it was an insanely stupid choice for some UNIX systems to put /etc in the path!|g' \ - -e 's:^\(test -d /usr/sbin &&\):#\1:g' \ - -e 's:^#!/bin/sh$:#!/usr/bin/dash:g' \ - -i 'configure' + local _seds=( + -e 's:^\(DIR_SBIN=/usr/local/\)sbin$:\1bin:g' + -e 's|:/sbin:\($PATH\)|:\1|g' + -e 's|\(findApp [^ ]\+ \)/sbin:\($PATH\)|\1\2|g' + -e 's|\(findAppDef [^ ]\+ \)/sbin:\($PATH\)|\1\2|g' + -e 's|^\(PATH=$PATH:/bin:/usr/bin\)\(:/etc\)$|\1 # \2 # it was an insanely stupid choice for some UNIX systems to put /etc in the path!|g' + -e 's:^\(test -d /usr/sbin &&\):#\1:g' + -e 's:^#!/bin/sh$:#!/usr/bin/dash:g' + -e '# pretend, that libtiff 4.x is similar to 4.0' + -e '/tiff_runlen_t/ s:4\..\+):4.[0123456789]):' + ) + if [ "${_opt_Integrated_LIBTIFF}" -ne 0 ]; then + _seds+=( + -e '# change TIFFBIN detection to a binary still in libtiff 4.6.0 avoiding the need for -with-TIFFBIN' + -e 's:tiff2ps:tiffcp:g' + ) + fi + sed "${_seds[@]}" -i 'configure' test ! -s 'configure.Arch' || echo "${}" # Ghostscript dropped Type1 from the font path. @@ -284,13 +455,13 @@ prepare() { #cp -p 'etc/faxsetup.sh.in'{,.Arch} # diff -pNau5 'etc/faxsetup.sh.in'{.Arch,} > '0004a-hylafaxplus-systemd.patch' - patch -Nbup0 -i "${srcdir}/0004a-hylafaxplus-systemd.patch" + patch -Nup0 -i "${srcdir}/0004a-hylafaxplus-systemd.patch" sed -e 's:/bin/systemctl:/usr/bin/systemctl:g' -i 'etc/faxsetup.sh.in' test ! -s 'etc/faxsetup.sh.in.Arch' || echo "${}" #cp -p 'etc/faxsetup.sh.in'{,.Arch} - # diff -pNau5 'faxsetup.sh.in'{.orig,} > '0005-hylafaxplus-faxsetup.patch' - patch -Nbup0 -i "${srcdir}/0005-hylafaxplus-faxsetup.patch" + # diff -pNau5 'faxsetup.sh.in'{.Arch,} > '0005-hylafaxplus-faxsetup.patch' + patch -Nup0 -i "${srcdir}/0005-hylafaxplus-faxsetup.patch" sed -Ee "# Remove ' for mcedit syntax highlighter" \ -e "s:([dD]on)'t:"'\1t:g' \ -e '# Branding' \ @@ -298,6 +469,16 @@ prepare() { -i 'etc/faxsetup.sh.in' test ! -s 'etc/faxsetup.sh.in.Arch' || echo "${}" + #cp -p 'hfaxd/Jobs.c++'{,.Arch} + # diff -pNau5 'hfaxd/Jobs.c++'{.Arch,} > '0006-hylafaxplus-jobfmt-assigned-modem-to-used-modem.patch' + patch -Nup0 -i "${srcdir}/0006-hylafaxplus-jobfmt-assigned-modem-to-used-modem.patch" + test ! -s 'hfaxd/Jobs.c++.Arch' || echo "${}" + + #cp -pr 'config'{,.Arch} + # diff -pNaru5 'config'{.Arch,} > '1000-hylafaxplus-modem-support.patch' + patch -Nup0 -i "${srcdir}/1000-hylafaxplus-modem-support.patch" + test ! -d 'config.Arch' || echo "${}" + # Var $TTY clashes with the Arch Linux environment and likely all other Linux # too. $TTY contains the terminal device from `tty`. With this already set # to a known valid terminal, faxaddmodem never asks for a modem device and @@ -348,6 +529,15 @@ prepare() { # diff -pNau5 cover.templ{.default,} > '0003-graphic.logo.instructions.patch' patch -d 'util' -Nup0 -i "${srcdir}/0003-graphic.logo.instructions.patch" + # Add Include to all of the config files. The initial include is blank so it won't change anything. + local _cfg + for _cfg in $(grep -le '^ModemType:' config/*); do + printf '#\nInclude:\t\t"etc/config-modems"\n' >> "${_cfg}" + done + + # Switch tiffcp to old version that supports tiffcp -i + sed -e 's:\btiffcp\b:tiffcp.hylafax:g' -i $(grep --include 'configure' --include '*.sh*' -lr -e '\btiffcp\b' .) + set +u echo 'Checking for fonts missing from fmfix.pl' @@ -355,27 +545,45 @@ prepare() { } build() { + _libtiff_build; cd "${srcdir}" set -u - cd "${_pkgnick}-${pkgver}" + cd "${_srcdir}" if [ ! -s 'Makefile' ]; then + local _conf=( + --nointeractive + --with-OPTIMIZER="${CFLAGS:-}" + --target="${CARCH}-arch-linux" + --with-DIR_BIN='/usr/bin' + --with-DIR_LIB='/usr/lib' + --with-DIR_LIBDATA='/usr/lib/fax' + --with-DIR_LIBEXEC='/usr/bin' + --with-DIR_MAN='/usr/share/man' + --with-DIR_SBIN='/usr/bin' + --with-SYSVINIT='no' + --with-PAGESIZE="${_opt_pagesize}" + --with-SCRIPT_SH='/usr/bin/dash' + #--with-PATH_AFM='/usr/share/fonts/Type1' #gs ignores this + ) + local _LDPATH='' + if [ "${_opt_Integrated_LIBTIFF}" -ne 0 ]; then + _conf+=( + --with-TIFFINC="-I${srcdir}/${_libtiff_srcdir}/libtiff" + --with-LIBTIFF="-L${srcdir}/${_libtiff_srcdir}/libtiff/.libs -ltiff" + #--with-TIFFBIN="${srcdir}/${_libtiff_srcdir}/tools" # not needed if we change TIFFBIN detection to tiffcp and require libtiff>=4.6.0 + ) + _LDPATH="${srcdir}/${_libtiff_srcdir}/libtiff/.libs" + elif [ "${_opt_HF_System_LIBTIFF}" -eq 0 ]; then + _conf+=( + --with-TIFFINC="-I/usr/include/${_libtiff_incdir}" + --with-LIBTIFF="-L/usr/lib/${_libtiff_libdir} -ltiff" + ) + fi # On my system LN has something in it. Short variable names should be avoided in scripts. + LD_LIBRARY_PATH="${_LDPATH}" LN= \ CHOWN="${srcdir}/chown" \ CHGRP="${srcdir}/chgrp" \ - ./configure \ - --nointeractive \ - --with-OPTIMIZER="${CFLAGS}" \ - --target="${CARCH}-arch-linux" \ - --with-DIR_BIN='/usr/bin' \ - --with-DIR_LIB='/usr/lib' \ - --with-DIR_LIBDATA='/usr/lib/fax' \ - --with-DIR_LIBEXEC='/usr/bin' \ - --with-DIR_MAN='/usr/share/man' \ - --with-DIR_SBIN='/usr/bin' \ - --with-SYSVINIT='no' \ - --with-PAGESIZE="${_opt_pagesize}" \ - --with-SCRIPT_SH='/usr/bin/dash' -# --with-PATH_AFM='/usr/share/fonts/Type1' gs ignores this + ./configure "${_conf[@]}" fi make -s -j1 # hylafax is not multi threaded make compatible @@ -383,9 +591,13 @@ build() { set +u } +check() { + _libtiff_check; cd "${srcdir}" +} + package() { set -u - cd "${_pkgnick}-${pkgver}" + cd "${_srcdir}" local _chown="${pkgdir}/_install_chown.sh" @@ -495,6 +707,111 @@ EOF echo "${_host}" >> "${_outfile}" done + # The usage of config include files needs to be standardized + touch "${pkgdir}/var/spool/hylafax/etc/config-modems.default" + + # Lengthen retries to minimize failed jobs on high volume fax servers + install -Dm644 <(cat << EOF +# The delay in seconds to wait before retrying a job whose +# dialing attempt failed with a BUSY status result. +# 12 dials over two hours: (2*60*60)/12 +JobReqBusy: 600 + +# The delay in seconds to wait before retrying a job whose +# dialing attempt failed with a NO ANSWER status result. +# 2 dials over 2 hours: (2*60*60)/2 +JobReqNoAnswer: 3600 + +# The delay in seconds to wait before retrying a job whose +# dialing attempt failed with a NO CARRIER status result. +# 2 dials over 2 hours: (2*60*60)/2 +JobReqNoCarrier: 3600 + +# Delay in seconds for a Fax protocol error. +JobReqProto: 180 + +# rings to wait before answering phone +# 0 for send only modems +RingsBeforeAnswer: 0 +EOF + ) "${pkgdir}/var/spool/hylafax/etc/config-modems.sample" + + # faxaddmodem destroys some things we'd like to add to etc/config + install -Dm644 <(cat << EOF +# faxaddmodem destroys some lines we add to etc/config +# so we add them here and use Include which isn't destroyed. +# To use this, etc/config must contain the line +# Include:<------><------>etc/config-local +# Hylafax does not automatically detect changes to included files +# touch etc/config to signal a change + +#FAXNumber: +1.000.000.0000 +#PageMargins: l=0.40in,r=0.40in,t=0.1in,b=0.1in +#JobControlCmd: etc/jobcontrol-local +#ModemGroup: "any:0:.*" +##ModemGroup: "any:0:(ttyACM.*|ttyUSB[0123456])" +#ModemGroup: "Rockwell:0:ttyUSB[067]" +#ModemGroup: "Lucent:0:ttyACM.*" +#ModemGroup: "Courier:0:ttyUSB3" +EOF + ) "${pkgdir}/var/spool/hylafax/etc/config-local.default" + + # It's difficult to set up job control from the scant information in man pages and the Internet + install -Dm755 <(cat << EOF +#!/usr/bin/bash + +set -u +set -e + +# man jobcontrol + +if [ -x "\${0##*/}" ]; then + self="\$(readlink -m "\$0")" + cd .. + self="\${self##\${PWD}/}" + if ! grep -q "^JobControlCmd:\s\+\${self}" 'etc/config-local'; then + echo "JobControlCmd not installed" + echo "Try:" + echo " printf 'JobControlCmd:\t\t%s\n' '\${self}' >> 'config-local'" + fi + echo "DEMO!" 1>&2 + if [ "\$#" -ne 1 ]; then + echo "Usage \$0 JID" + exit 1 + fi +fi + +source etc/setup.cache +source bin/common-functions + +QFILE="sendq/q\$1" +if [ -s "\${QFILE}" ]; then + HYLAFAX_TMPDIR='' + TMPDIR='' + SetupPrivateTmp + parseQfile '' "\${QFILE}" + case "\$number-\$owner-\$tottries" in + #5551212-lee-3) echo "Class1ECMSupport: no";; + #*-sam-*) echo "LocalIdentifier: +1.800.555.1224";; + 911-*|???555*) echo 'RejectNotice: "Calls to 911 and directory assistance are not permitted"';; + [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]*) echo "RejectNotice: \"Invalid number (\${#number} digits)\"";; + [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-*) echo "RejectNotice: \"Invalid number (\${#number} digits)\"";; + ???111*|000*|111*|???000*) echo 'RejectNotice: "Invalid number"';; + #5175551214-*) echo 'Modem: "Rockwell"';; # not compatible with Lucent + #2705551214-*) # bad lines at this location won't let the fax complete + # # man sendq + # echo 'DesiredBR: 0' # 0 for 2400 bps, 1 for 4800 bps, 2 for 7200 bps, 3 for 9600 bps, 4 for 12000 bps, 5 for 14400 bps, 6 for 16800 bps, 7 for 19200 bps, 8 for 21600 bps, 9 for 24000 bps, 10 for 26400 bps, 11 for 28800 bps, 12 for 31200 bps, and 13 for 33600 bps (default). + # echo 'DesiredEC: 0' # 0 to disable, 1 for 64-byte ECM, 2 for 256-byte ECM (default). + # echo 'DesiredDF: 0' # 0 for 1-D MH, 1 for 2-D MR, 3 for 2-D MR with uncompressed data, and 4 for 2-D MMR (default). + # ;; + esac +else + echo "This only works with files in the sendq. Don't try JID in the doneq." 1>&2 +fi +exit 0 +EOF + ) "${pkgdir}/var/spool/hylafax/etc/jobcontrol-local.default" + # Add dial rules for USA 7 and 10 digit numbers. The posted examples have them in the wrong order. # diff -pNau5 dialrules{.default,} > '0001-dialrules.7-10.digits.USA.patch' patch -d "${pkgdir}/var/spool/hylafax/etc" -Nup0 -i "${srcdir}/0001-dialrules.7-10.digits.USA.patch" @@ -552,6 +869,7 @@ Documentation=man:faxq(8) [Service] Type=forking ExecStart=/usr/bin/faxq +Nice=-10 ExecReload=/bin/kill -HUP \$MAINPID [Install] @@ -571,12 +889,13 @@ EOF # https://aur.archlinux.org/ [Unit] -Description=HylaFAX+ faxgetty on %i +Description=HylaFAX+ faxgetty on %I Documentation=man:faxgetty(8) After=faxq.service hfaxd.service [Service] -ExecStart=/usr/bin/faxgetty %i +ExecStart=/usr/bin/faxgetty %I +Nice=-10 Type=simple Restart=always RestartSec=0 @@ -617,7 +936,7 @@ Documentation=man:faxqclean(8) man:faxcron(8) [Service] Type=oneshot -ExecStart=/usr/bin/faxqclean +ExecStart=/usr/bin/faxqclean -a -j 1209600 ExecStart=/usr/bin/faxcron -rcv 30 Nice=19 IOSchedulingClass=best-effort @@ -640,7 +959,7 @@ Target = ghostscript [Action] Description = HylaFax+: Check for changed ghostscript font folder When = PostTransaction -Exec = /usr/bin/bash /var/spool/hylafax/bin/ghostscript-upgrade.sh +Exec = /usr/share/libalpm/scripts/hylafax-ghostscript-upgrade.sh EOF ) "${pkgdir}/usr/share/libalpm/hooks/hylafax-ghostscript.hook" install -Dm744 <(cat << EOF @@ -663,9 +982,89 @@ if [ "\${EUID}" -eq 0 ]; then fi fi EOF - ) "${pkgdir}/var/spool/hylafax/bin/ghostscript-upgrade.sh" + ) "${pkgdir}/usr/share/libalpm/scripts/hylafax-ghostscript-upgrade.sh" + + # pacman hooks to generate AFM files + install -Dm644 <(cat << EOF +# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR +# https://aur.archlinux.org/ + +[Trigger] +Operation = Upgrade +Type = Package +Target = ghostscript + +[Action] +Description = HylaFax+: Generate Ghostscript Type 1 Font Metrics files +When = PostTransaction +Exec = /usr/share/libalpm/scripts/hylafax-ps2afm.sh build +EOF + ) "${pkgdir}/usr/share/libalpm/hooks/hylafax-ghostscript-post.hook" + install -Dm644 <(cat << EOF +# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR +# https://aur.archlinux.org/ + +[Trigger] +Operation = Upgrade +Type = Package +Target = ghostscript + +[Action] +Description = HylaFax+: Remove Ghostscript Type 1 Font Metrics files +When = PreTransaction +Exec = /usr/share/libalpm/scripts/hylafax-ps2afm.sh destroy +EOF + ) "${pkgdir}/usr/share/libalpm/hooks/hylafax-ghostscript-pre.hook" + install -Dm744 <(cat << EOF +#!/usr/bin/bash + +# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR +# https://aur.archlinux.org/ + +# build afm files for gs built in fonts at +# /usr/share/ghostscript/*/Resource/Font +# No more need for gsfonts-type1 + +set -u +set -e + +if [ "\${EUID}" -ne 0 ]; then + echo 'Must be root' + exit 1 +fi + +cd '/usr/share/ghostscript/Resource/Font' + +_fn_build() { + local f fa fm + for f in *Mono*; do + if [ "\${f//./}" = "\${f}" ]; then + fa="\${f}.pfa" + fm="\${f}.afm" + ln -sf "\${f}" "\${fa}" + pf2afm "\${fa}" > /dev/null # supress .pfm message + rm "\${fa}" + sed -e 's:\r::g' -i "\${fm}" + fi + done +} + +_fn_destroy() { + local f fa fm + for f in *Mono*; do + if [ "\${f//./}" = "\${f}" ]; then + fm="\${f}.afm" + rm "\${fm}" + fi + done +} + +_fn_\${1:-build} +EOF + ) "${pkgdir}/usr/share/libalpm/scripts/hylafax-ps2afm.sh" install -Dpm644 'COPYRIGHT' "${pkgdir}/usr/share/licenses/${_pkgnick}/COPYRIGHT" set +u + cd "${srcdir}"; _libtiff_package } set +u diff --git a/hylafax.install b/hylafax.install index df6b61a39407..bce1df69bc2a 100644 --- a/hylafax.install +++ b/hylafax.install @@ -10,7 +10,7 @@ _print_install() { echo ' The device to configure is usually ttyS0, ttyUSB0, or ttyACM0' echo ' The number of pages to accept to more than 25' echo ' The country code and area code' - echo ' The Fax Class to 2.0' + echo ' The Fax Class to 1 or 1.0' # I can find no modem reliable at Class 2* echo ' Most other defaults are OK' echo -e '\n' } @@ -30,6 +30,7 @@ post_install() { post_upgrade #usermod -d '/' "${_hyuser}" &>/dev/null _print_install + /usr/share/libalpm/scripts/hylafax-ps2afm.sh build mandb -q set +u } @@ -114,6 +115,7 @@ pre_remove() { systemctl disable 'hylafax.timer' #rm -f "${_hyhome}/bin"/{pdf2fax,ps2fax} "${_hyhome}/dev/null" _print_remove + /usr/share/libalpm/scripts/hylafax-ps2afm.sh destroy set +u } diff --git a/localnxxtoregex.sh b/localnxxtoregex.sh index 8c9a85babd6c..9b90c12ab5b9 100755 --- a/localnxxtoregex.sh +++ b/localnxxtoregex.sh @@ -6,56 +6,96 @@ set -u set -e +g_area='517' + if [ -z "${1:-}" ]; then - echo "Usage: $(basename "$0") nnx.txt > nnxmytown.txt" + echo "Usage: $(basename "$0") npamytown-date.txt > npamytown.txt" echo "Create nnx.txt from local nnx listing at" echo "http://localcallingguide.com/" echo "Search, Area Code/Prefix, ..., ..., Local prefixes" exit 1 fi -message='! local NNX list generated by localnxxtoregex.sh from Arch Linux HylaFax+ package' - -_fn_display() { +_fn_proc() { if [ ! -z "${nx}" ]; then - if [ ! -z "${message}" ]; then - echo "${message}" - message='' - fi + #if [ ! -z "${message}" ]; then + # echo "${message}" + # message='' + #fi local tx if [ "${#x}" -gt 1 ]; then x="[${x}]" - tx="(${nx}${x})" + tx="${nx}${x}" + nxt+=("") else - tx="(${nx}${x})\t" # keep tabs lined up + tx="${nx}${x}" + nxt+=($'\t') # keep tabs lined up fi - local _tx="(${nx}${x})" - echo -e '^${Country}${Area}'"${tx}\t= \1\t\t! USA NNX/NXX local ${npas[2]} calls" + #local _tx="(${nx}${x})" + nxn+=("${tx}") + nxl+=("${npas[2]}") + nxa+=("${npas[0]}") nx='' x='' fi } -readarray -t npalist < <(grep '^[0-9]' "$1" | LC_ALL=C sort) -#declare -p npalist - -nx='' -x='' -# 555 & 556 will be coalesced into 55[56] -#NPA;NXX;Rate Centre;Region;Plan Type;Call Type;Monthly Limit;Note;Effective -#517;555;Operator;MI;;;;; -#517;556;Operator;MI;;;;; -#517;560;Operator;MI;;;;; -#517;570;Operator;MI;;;;; -for npaline in "${npalist[@]}"; do - IFS=';' read -r -a npas <<<"${npaline}" - nnx="${npas[1]}" - if [ "${nnx#${nx}}" = "${nnx}" ]; then - _fn_display - nx="${nnx: 0:2}" - x="${nnx: 2:1}" - else - x+="${nnx: 2:1}" - fi +_fn_print() { + # output dialrules regex, no longer useful now that 10 digit dialing is required + local dt="$(date +'%F %T')" + printf '\n' + printf '! local dialrules NNX list\n' + printf '! generated %s by localnxxtoregex.sh %s from Arch Linux HylaFax+ package\n' "${dt}" "$1" + printf '! As of October 24, 2021 no more 7 digit dialing\n' + local k a + for k in "${!nxn[@]}"; do + a="${nxa[k]}" + if [ "${a}" = "${g_area}" ]; then + a='${Area}' + fi + printf '! ^${Country}%s(%s)%s\t= \\1\t\t! USA NNX/NXX local %s calls\n' "${a}" "${nxn[k]}" "${nxt[k]}" "${nxl[k]}" + done + # output jobcontrol-local case shell match statement + printf '\n # local jobcontrol-local NNX list generated %s by localnxxtoregex.sh %s from Arch Linux HylaFax+ package\n' "${dt}" "$1" + printf ' ' + local bar='' + for k in "${!nxn[@]}"; do + printf '%s%s%s*' "${bar}" "${nxa[k]}" "${nxn[k]}" + bar='|' + done + printf ')\n' +} + +while [ "$#" -gt 0 ]; do + readarray -t npalist < <(grep '^[0-9]' "$1" | LC_ALL=C sort) + #declare -p npalist + + nxl=() # list of city names + nxn=() # list of nnx 55[567] + nxa=() # list of area codes 517 + nxt=() # list of tab or not tab + nx='' + x='' + # 555 & 556 will be coalesced into 55[56] + #NPA;NXX;Rate Centre;Region;Plan Type;Call Type;Monthly Limit;Note;Effective + #517;555;Operator;MI;;;;; + #517;556;Operator;MI;;;;; + #517;560;Operator;MI;;;;; + #517;570;Operator;MI;;;;; + for npaline in "${npalist[@]}"; do + IFS=';' read -r -a npas <<<"${npaline}" + nnx="${npas[1]}" + if [ "${nnx#${nx}}" != "${nnx}" ]; then + x+="${nnx: 2:1}" + else + _fn_proc + nx="${nnx: 0:2}" + x="${nnx: 2:1}" + fi + done + _fn_proc + unset npalist nx x npaline npas nnx + #set > x + _fn_print "$1" + shift done -_fn_display |