diff options
author | jmz <jmz@FreeBSD.org> | 1996-03-13 08:37:08 +0800 |
---|---|---|
committer | jmz <jmz@FreeBSD.org> | 1996-03-13 08:37:08 +0800 |
commit | 642bc911ec4c5d217380fd1dd9cc8945bf187263 (patch) | |
tree | 198ddc6e372c244cb6a50284c3e8b7f4c9c4cd0f /comms/mgetty+sendfax | |
parent | 424db8439b977945b8250adafc6f8d030b26ee0e (diff) | |
download | freebsd-ports-gnome-642bc911ec4c5d217380fd1dd9cc8945bf187263.tar.gz freebsd-ports-gnome-642bc911ec4c5d217380fd1dd9cc8945bf187263.tar.zst freebsd-ports-gnome-642bc911ec4c5d217380fd1dd9cc8945bf187263.zip |
Upgrade to the latest official release (version 0.98)
Diffstat (limited to 'comms/mgetty+sendfax')
-rw-r--r-- | comms/mgetty+sendfax/Makefile | 22 | ||||
-rw-r--r-- | comms/mgetty+sendfax/distinfo | 2 | ||||
-rw-r--r-- | comms/mgetty+sendfax/files/mgettycfg.in | 515 | ||||
-rw-r--r-- | comms/mgetty+sendfax/files/patch-aa | 26 | ||||
-rw-r--r-- | comms/mgetty+sendfax/files/patch-ab | 114 | ||||
-rw-r--r-- | comms/mgetty+sendfax/files/patch-ac | 35 | ||||
-rw-r--r-- | comms/mgetty+sendfax/pkg-install | 515 | ||||
-rw-r--r-- | comms/mgetty+sendfax/pkg-plist | 46 | ||||
-rw-r--r-- | comms/mgetty+sendfax/scripts/configure | 379 |
9 files changed, 1249 insertions, 405 deletions
diff --git a/comms/mgetty+sendfax/Makefile b/comms/mgetty+sendfax/Makefile index 14b5bea8e696..83397a6205de 100644 --- a/comms/mgetty+sendfax/Makefile +++ b/comms/mgetty+sendfax/Makefile @@ -1,28 +1,26 @@ # New ports collection makefile for: mgetty+sendfax -# Version required: 0.22 +# Version required: 0.98 # Date created: 21 September 1994 # Whom: jmz # -# $Id$ +# $Id: Makefile,v 1.8 1995/04/15 04:58:59 asami Exp $ # -DISTNAME= mgetty-0.22 +DISTNAME= mgetty-0.98 CATEGORIES+= comms -MASTER_SITES= ftp://hpsystem2.informatik.tu-muenchen.de/pub/comp/networking/communication/modem/mgetty/ -DISTFILES= mgetty+sendfax-0.22.tar.gz +MASTER_SITES= ftp://ftp.leo.org/pub/comp/networking/communication/modem/mgetty/ +DISTFILES= mgetty+sendfax-0.98.tar.gz MAINTAINER= jmz@FreeBSD.org -MAKE_FLAGS= CC=cc spool=/var/spool LDFLAGS=-lutil prefix=${PREFIX} -f -USE_GMAKE= yes +MAKE_FLAGS= prefix=${PREFIX} -f + IS_INTERACTIVE= yes pre-install: - @mkdir -p ${PREFIX}/bin - @mkdir -p ${PREFIX}/lib - @mkdir -p ${PREFIX}/info - @mkdir -p ${PREFIX}/man/man1 - @mkdir -p ${PREFIX}/man/man4 @(cd ${WRKSRC}/doc; ${GMAKE} manpages) +post-install: + @(cd ${PKGDIR}; export PKG_PREFIX=${PREFIX}; /usr/bin/perl INSTALL _ POST-INSTALL) + .include <bsd.port.mk> diff --git a/comms/mgetty+sendfax/distinfo b/comms/mgetty+sendfax/distinfo index d2e174ae3a52..1766cba7dc21 100644 --- a/comms/mgetty+sendfax/distinfo +++ b/comms/mgetty+sendfax/distinfo @@ -1 +1 @@ -MD5 (mgetty+sendfax-0.22.tar.gz) = 78932610ba4accc7d8eb20c9410387fa +MD5 (mgetty+sendfax-0.98.tar.gz) = b2f2a1ef828ce50aa685224e4aad7a77 diff --git a/comms/mgetty+sendfax/files/mgettycfg.in b/comms/mgetty+sendfax/files/mgettycfg.in new file mode 100644 index 000000000000..a66446a02119 --- /dev/null +++ b/comms/mgetty+sendfax/files/mgettycfg.in @@ -0,0 +1,515 @@ +#!/usr/bin/perl + +exit 0 if $ARGV[1] ne "POST-INSTALL"; + +print STDERR "\n\n\n =========== mgetty+sendfax configuration ================\n\n"; +$prefix = $ENV{'PKG_PREFIX'}; +$sep = "~"; + +&read_config ("$prefix/etc/mgetty+sendfax/mgetty.config"); + +$a = 1; +$devices = $var{'ports'} ? $var{'ports'} : "cuaa1"; +while ($a) { + $devices = &ask ("list of devices", $devices); + + $_ = $devices; + $w = 0; + foreach (split) { + if (! -c "/dev/$_" ) { + print STDERR "warning: device file /dev/$_ does not exist!\n"; + $w++; + } + } + if ($w) { + $a = 0 if (&yesno ("are you sure?" , "n") eq "y"); + } else { + $a = 0; + } +} + +open (TMP, ">/tmp/mgetty.config.$$") || die "$!\n"; +$_ = join (":", $devices); +print TMP "fax-devices $_\n\n"; + +$_ = $devices; + +foreach $port (split) { + print STDERR "\n\n *** Configuring for port $port ***\n\n"; + print TMP "\nport $_\n"; + &setdef ($port); +again: + &inq; + goto again if (&confirm ($port) ne "y"); + &write_tmp; +} + +close (TMP); +if ( -e "$prefix/etc/mgetty+sendfax/mgetty.config") { + system ("mv -f $prefix/etc/mgetty+sendfax/mgetty.config $prefix/etc/mgetty+sendfax/mgetty.config.old"); +} +system ("mv -f /tmp/mgetty.config.$$ $prefix/etc/mgetty+sendfax/mgetty.config"); +system ("ln -sf $prefix/etc/mgetty+sendfax/mgetty.config $prefix/etc/mgetty+sendfax/sendfax.config"); + +open (F, ">$prefix/etc/mgetty+sendfax/faxheader"); +print F "\n FAX FROM: **not configured** $def{fax-id} TO: @T@ PAGE: @P@ OF @M@ \n"; +close (F); + + +print STDERR "\n\nediting /etc/ttys...\n"; + +open (F, "/etc/ttys"); +@ttys = <F>; +close (F); + +foreach $tty (@ttys) { + $_ = $devices; + foreach $port (split) { + if ($tty =~ /^\s*$port/) { + print STDERR "replacing line $tty"; + $tty = "$port\t\"$prefix/sbin/mgetty\"\tunknown on secure\n"; + $replaced{$port} = 1; + } + } +} +$_ = $devices; +foreach $port (split) { + if (!$replaced{$port}) { + print STDERR "adding port $port\n"; + push (@ttys, "$port\t\"$prefix/sbin/mgetty\"\tunknown on secure\n"); + } +} +system ("mv -f /etc/ttys /etc/ttys.old"); +open (F, ">/etc/ttys"); +print F @ttys; +close (F); + + +exit 0; + +sub confirm { + $_ = shift; + print STDERR "\n\n\tSettings for port $_\n\t------------------------\n"; + $_ = $settings; + foreach (split) { + print STDERR "\t$_ $def{$_}\n" if ($def{$_}); + } + return &yesno ("OK?", "y"); +} + +sub write_tmp { + $_ = $settings; + foreach (split) { + print TMP "$_ $def{$_}\n" if ($def{$_}); + } +} + +sub inq { + $settings = "debug"; + $def{'debug'} = 4 if !$def{'debug'}; + $def{'debug'} = &ask (" - `debug' + This sets the amount of logging `mgetty' will do. A good value is + 4, more details are seen with `5', and `9' is really noisy. Try + it! The log data is written to the file `/tmp/log_mg.cuaxx'.", $def{'debug'}); + + $settings .= " fax-id"; + $def{'fax-id'} = "00 00 000000" if ! $def{'fax-id'}; + $def{'fax-id'} = &ask (" - `fax-id' + This sets the fax station ID used in fax mode to identify your + site to the caller (usually this is simply your fax phone number). + ", $def{'fax-id'}); + + $settings .= " speed"; + $def{'speed'} = 38400 if !$def{'speed'}; + $def{'speed'} = &ask (" - `speed' + Specify, as integer value, the port speed to use. Default is + 38400. If the given speed is not valid, `mgetty' complains loudly + and exits.", $def{'speed'}); + + $settings .= " modem-init"; + $def{'modem-init'} = &ask (" - `modem-init' + Specifies an `AT...' command that is to be sent to the modem right + at the *beginning* of all modem talk (even before setting the modem + into fax mode, so this could be an `ATZ' if you want to reset the + modem).", ""); + + $settings .= " modem-handshake"; + $def{'modem-handshake'} = "AT&H3" if !$def{'modem-handshake'}; + $def{'modem-handshake'} = &ask (" - `modem-handshake' + Specifies an `AT...' command that will be sent to the modem at the + *end* of the modem initialization, right before dialing. *Do not + use ATZ or such here*, since resetting the modem will switch off + fax mode.", $def{'modem-handshake'}); + + $settings .= " max-tries"; + $def{'max-tries'} = 3 if !$def{'max-tries'}; + $def{'max-tries'} = &ask (" - `max-tries' + Specify the maximum number of tries per page if the receiving end + reports reception errors. If NNN tries do not suffice to + successfully transmit a page, `sendfax' will give up or simply go + on, depending on the setting of `max-tries-continue' (see below). + If this is set to `0', `sendfax' will ignore retransmission + requests and simply go on.", $def{'max-tries'}); + + $settings .= " max-tries-continue"; + $def{'max-tries-continue'} = "YES" if !$def{'max-tries-continue'}; + $def{'max-tries-continue'} = &ask (" - `max-tries-continue' + After the maximum number of tries for one page are reached, + `sendfax' can report an error and abort (`max-tries-continue NO'), + or go on with the next page (YES). + + For \"mission critical\" faxes, I'd set it to NO, but since the page + quality is most often quite good even if reported as \"page bad\", + the default is YES.", $def{'max-tries-continue'}); + + $settings .= " dial-prefix"; + $def{'dial-prefix'} = "ATD" if !$def{'dial-prefix'}; + $def{'dial-prefix'} = &ask (" - `dial-prefix' + This is the command used for dialing out. Usually this will be + something simple, as `ATD' or `ATDP', but if you have an unusual + setup, it could also be something like `ATX0DP0;X4DT' (meaning: + switch off dial-tone detection, pulse-dial `0', back to command + mode, switch on dial-tone detection, and go ahead dialing with + touch tones). The phone number will be sent right after the + `dial-prefix'.", $def{'dial-prefix'}); + + $settings .= " poll-dir"; + $def{'poll-dir'} = "./" if !$def{'poll-dir'}; + $def{'poll-dir'} = &ask (" - `poll-dir' + This is used to specify a directory where polled faxes (wheather + maps and such) are to be saved into. Default is the current + directory.", $def{'poll-dir'}); + + $settings .= " normal-res"; + $def{'normal-res'} = "NO" if !$def{'normal-res'}; + $def{'normal-res'} = &ask (" - `normal-res' + If set to `yes' or `true' (boolean), `sendfax' won't attempt to + make a fax connection in \"fine resolution\" mode. Normally you + won't need to use that option, since `faxrunq' will set the `-n' + switch if needed.", $def{'normal-res'}); + + $settings .= " verbose"; + $def{'verbose'} = "NO" if !$def{'verbose'}; + $def{'verbose'} = &ask (" - `verbose' + If set to `yes' or `true', `sendfax' will output progress reports + on stdout, if set to `no', `sendfax' will only print error and + warning messages.", $def{'verbose'}); + + + + $settings .= " switchbd"; + $def{'switchbd'} = &ask (" - `switchbd' + Some modems, mainly Rockwell chipsets, switch to 19200 bps when + entering fax mode. Others may need other speed switches (but I + know none). If your modem is Rockwell based, try `switchbd 19200' + if fax reception doesn't work. (*Warning:* if this is set wrongly, + fax reception will definitely fail. For most sane modems, you do + *not need* this.). Reply YES or NO", $def{'switchbd'}); + + $settings .= " direct"; + $def{'direct'} = "NO" if !$def{'direct'}; + $def{'direct'} = &ask (" - `direct' + Tells mgetty that it is running on a direct line. Mgetty won't try + to initialize any modem, nor will it wait for `RING'. It will just + wait for any character, and then output the issue file and login + prompt. This option is used if you want to connect to machines via + nullmodem cable.", $def{'direct'}); + + $settings .= " blocking"; + $def{'blocking'} = "NO" if !$def{'blocking'}; + $def{'blocking'} = &ask (" - `blocking' + Tells mgetty to open the device in `blocking' mode, that is, the + `open()' system call won't succeed until carrier detect is set. + This is set if `mgetty' is called as `getty'. I'm not sure whether + it's very useful, but I include it for completeness", $def{'blocking'}); + + $settings .= " port-owner"; + $def{'port-owner'} = "uucp" if !$def{'port-owner'}; + $def{'port-owner'} = &ask (" - `port-owner' + If set, mgetty will `chown' the tty line to the given username (you + can specify a string or an integer uid, but the integer must be + valid). This is highly recommended for security purposes: only + give port access to those users you trust not to misuse your modem + lines!", $def{'port-owner'}); + + $settings .= " port-group"; + $def{'port-group'} = "modem" if !$def{'port-group'}; + $def{'port-group'} = &ask (" - `port-group' + If set, mgetty will `chgrp' the tty line to this group id (which + can be given as group name, or as integer gid). If it's not given, + or not valid, the primary group id of `port-owner' + will be used.", $def{'port-group'}); + + $settings .= " port-mode"; + $def{'port-mode'} = "0660" if !$def{'port-mode'}; + $def{'port-mode'} = &ask (" - `port-mode' + Specifies the permissions to `chmod' the device to. + *Never* make a modem device world-accessible, better use `0660' + or even `0600'.", $def{'port-mode'} ); + + $settings .= " toggle-dtr"; + $def{'toggle-dtr'} = "YES" if !$def{'toggle-dtr'}; + $def{'toggle-dtr'} = &ask (" - `toggle-dtr' + Tells mgetty whether it should lower the DTR line upon startup to + reset modem. Default is `yes', but some (few) modems react + allergic to that and crash.", $def{'toggle-dtr'}); + + $settings .= " toggle-dtr-waittime"; + $def{'toggle-dtr-waittime'} = 500 if !$def{'toggle-dtr-waittime'}; + $def{'toggle-dtr-waittime'} = &ask (" - `toggle-dtr-waittime' + Specifies the time (in ms) to hold the DTR line low.", $def{'toggle-dtr-waittime'} ); + + $settings .= " data-only"; + $def{'data-only'} = "NO" if !$def{'data-only'}; + $def{'data-only'} =&ask (" - `data-only' + Tells `mgetty' to forget about faxing and only use the data part of + the modem. Default is `false'. You need this if your modem can't + distinguish incoming fax and data calls.", $def{'data-only'} ); + + $settings .= " fax-only"; + $def{'fax-only'} = "NO" if !$def{'fax-only'}; + $def{'fax-only'} = &ask (" - `fax-only' + Tells `mgetty' to put the modem in fax-only mode. You need this if + your modem can't distinguish incoming fax and data calls, but you + need fax more important than data; and you need it if you want to + disable data calls for security reasons (this could be achieved + via `login.config' as well)", $def{'fax-only'}); + + $settings .= " modem-type"; + $def{'modem-type'} = "auto" if ! $def{'modem-type'}; + $def{'modem-type'} = &ask (" - `modem-type' + Specifies the kind of modem connected to the port. Valid options are: + * auto + Mgetty will detect the modem type itself (which may occasionally + be not desirable, or it may fail on old modem equipment). + * c2.0 + Modem is a CLASS 2.0 fax mode. Works better than class 2, if + both are available, because its better standardized. Known to + work with USR and ZyXEL. + * cls2 + Modem is a CLASS 2 fax modem, mgetty will not try class 2.0. + * data + Do not try fax initialization + There is no way (yet) to tell mgetty to use *only* fax mode and + refuse data calls with this option, use the `fax-only true' + statement for that.", $def{'modem-type'}); + + $settings .= " init-chat"; + $def{'init-chat'} = '"" ATS0=0Q0&D3&C1 OK' if ! $def{'init-chat'}; + $def{'init-chat'} = &ask (" - `init-chat' + Tells mgetty the chat sequence to use for initializing the modem. + *Warning*: the sequence starts with *expect*, which will in most + cases be `\"\"' (nothing). This ordering was chosen because UUCP + does it this way, and I wanted to avoid confusion here. + + Example: + + \"\" \\d\\d\\d+++\\d\\d\\dATQ0E1V1H0 OK ATL0M0S0=0 OK AT&K3 OK + init sequence", $def{'init-chat'}); + + $settings .= " modem-check-time"; + $def{'modem-check-time'} = 3600 if ! $def{'modem-check-time'}; + $def{'modem-check-time'} = &ask (" - `modem-check-time' + Some modems have the nasty tendency to crash silently. With this + option, you tell `mgetty' to check every SECONDS seconds with a + simple `AT...OK' sequence whether the modem still reacts. If not, + `mgetty' will restart itself and do a full modem reset.", $def{'modem-check-time'}); + + $settings .= " rings"; + $def{'rings'} = 1 if !$def{'rings'}; + $def{'rings'} = &ask (" - `rings' + Sets the number of `RING' messages to wait for, before mgetty + picks up the phone. *Warning:* if your modem auto-answers, for + whatever reason, set this to something *different* than the + value set with `ATS0=mmm', otherwise the modems autoanswer and + mgettys manual answer will collide (most modems hang up if a + command is received during auto-answer)", $def{'rings'}); + + $settings .= " answer-chat"; + $def{'answer-chat'} = '"" ATA CONNECT \c \r' if !$def{'answer-chat'}; + $def{'answer-chat'} =&ask (" - `answer-chat' + This is the command sequence that is used to answer a phone call. + Usually you can leave it at the default ` \"\" ATA CONNECT \\c \\r ', + but for some modems you need `ATS0=1' in place of `ATA' (ATA not + allowed). The extra `\\r' expect string is needed that the code can + grab the full CONNECT XYZ\\R string. It will work without the \\r, + but then the logging information will be less detailed. *Right now, + \\r won't work at all, it's not implemented yet. Don't use it.* + ", $def{'answer-chat'} ); + + $settings .= " answer-chat-timeout"; + $def{'answer-chat-timeout'} = 80 if !$def{'answer-chat-timeout'}; + $def{'answer-chat-timeout'} = &ask (" - `answer-chat-timeout' + During the ANSWER-CHAT, each \"expect\" string must be seen in the + time specified here. Default is 80 seconds. This time should be at + least some 5 seconds longer than the time set with the `ATS7=...' + modem setup command.", $def{'answer-chat-timeout'}); + + $settings .= " autobauding"; + $def{'autobauding'} = "YES" if !$def{'autobauding'}; + $def{'autobauding'} = &ask (" - `autobauding' + Some modems switch their DTE line speed to the communication line + speed after connecting, e.g., after sending `CONNECT 2400', the + modem switches to 2400 bps. Newer modems usually have a switch to + \"lock\" a DTE baud rate, which is strongly recommended. If your + modem insists on doing this speed switch, setting `autobauding' to + YES will make mgetty behave accordingly.", $def{'autobauding'}); + + $settings .= " ringback"; + $def{'ringback'} = "NO" if !$def{'ringback'} ; + $def{'ringback'} = &ask (" - `ringback' + If you have to put your modem and your telephone on the same phone + line, you can switch on \"ringback\" or \"ring-twice\". This means, + mgetty won't answer the phone on the first call, but remember the + call, and pick up on the second call (if it comes in the time + specified by `ringback-time').", $def{'ringback'} ); + + $settings .= " ringback-time"; + $def{'ringback-time'} = "30" if !$def{'ringback-time'} ; + $def{'ringback-time'} = &ask (" - `ringback-time' + This setting specifies how much time may pass between the first + and the second call if \"ringback\" is active.", $def{'ringback-time'}); + + $settings .= " issue-file"; + $def{'issue-file'} = "/etc/issue" if !$def{'issue-file'} ; + $def{'issue-file'} = &ask (" - `issue-file' + This is the file printed before the login prompt.", $def{'issue-file'}); + + $settings .= " prompt-waittime"; + $def{'prompt-waittime'} = "500" if !$def{'prompt-waittime'} ; + $def{'prompt-waittime'} = &ask (" - `prompt-waittime' + This specifies how long `mgetty' will wait for modem and line to + settle down (in ms) before printing issue file and login prompt", + $def{'prompt-waittime'}); + + $settings .= " login-prompt"; + $def{'login-prompt'} = "@!login: " if !$def{'login-prompt'} ; + $def{'login-prompt'} = &ask(" - `login-prompt' + This specifies the login prompt that mgetty will output. Some + special characters in this string (and in the issue file, btw) are + recognized and replaced by something else: + * @ system name + * \\n newline + * \\r carriage return + * \\g bell + * \\b backspace (ascii 010) + * \\f form feed (ascii 013) + * \\t TAB + * \\P (and \\L) port name (e.g. ttyS0) + * \\C date and time, in \"ctime()\" format + * \\I Connection string (e.g. 2400/REL) + * \\N (and \\U) number of users currently logged in + * \\S Port speed (e.g. 38400) + * \\D current date in dd/mm/yy format + * \\T current time in hh:mm:ss format + * \\DIGIT character with the specified octal code + + The maximum lenght of the login prompt is limited to 140 + characters (after expansion).", $def{'login-prompt'}); + + + $settings .= " fax-server-file"; + $def{'fax-server-file'} = &ask (" - `fax-server-file' + Specifies the fax file(s) that is to be sent if someone else calls + your modem in *fax polling mode*, that is, the caller *receives* a + document. + + Normally, the file given is a text file, containing the list of G3 + files to send to the calling machine, one file per line. Comment + lines (starting with \"#\") are ignored. For backward compatibility, + `mgetty' does check whether the named file is a G3 file itself, in + which case this file is sent directly (but then, you can only send + one page). + + Not all modems support fax poll *server* mode, I know that the + ZyXEL and MultiTech do.", $def{'fax-server-file'}); + + $settings .= " diskspace"; + $def{'diskspace'} = 1024 if !$def{'diskspace'}; + $def{'diskspace'} = &ask (" - `diskspace' + This setting tells mgetty the minimum amount of disk space (in KB) that + has to be available in the fax spool directory for fax reception + to be allowed.", $def{'diskspace'}); + + $settings .= " notify"; + $def{'notify'} = "faxadmin" if !$def{'notify'}; + $def{'notify'} = &ask (" - `notify' + This is the address that will get mails if a fax is received. Not + fully tested.", $def{'notify'}); + + $settings .= " fax-owner"; + $def{'fax-owner'} = "uucp" if !$def{'fax-owner'}; + $def{'fax-owner'} = &ask (" - `fax-owner' + If set, mgetty will `chown' the received files to the given username + (you can specify a string or an integer uid, but the integer must be + valid).", $def{'fax-owner'}); + + $settings .= " fax-group"; + $def{'fax-group'} = "modem" if !$def{'fax-group'}; + $def{'fax-group'} = &ask (" - `fax-group' + If set, mgetty will `chgrp' the received files to this group id + (which can be given as group name, or as integer gid).", $def{'fax-group'}); + + $settings .= " fax-mode"; + $def{'fax-mode'} = "0660" if !$def{'fax-mode'}; + $def{'fax-mode'} = &ask (" - `fax-mode' + Specifies the permissions to `chmod' the received files.", $def{'fax-mode'}); + + +} +sub setdef { + local ($port, $l); + $port = shift; + $l = length ($port) + 1; + foreach (keys(%var)) { + $def{$_} = substr ($var{$_}, $l) if ($var{$_} =~ /^$port$sep/); + } + foreach (keys(%var)) { + $def{$_} = substr ($var{$_}, 1) if (!$def{$_} && $var{$_} =~ /^$sep/); + } +} +sub ask { + ($info, $default, $x) = @_; + print STDERR "$info: "; + print STDERR "[$default] " if ($default); + $_ = <STDIN>; + s/^\s*//; + chop; + return $_ ? $_ : $default; +} +sub read_config { + local ($conf, $port, $a, $b); + + $conf = shift; + $port = $sep; + foreach (keys(%var)) { + delete $var{$_}; + } + if ( -f $conf) { + open (F, $conf) || die "$!\n"; + while (<F>) { + chop; + s/^\s*//; + next if /^#/; + next if /^$/; + ($a, $b) = split (/[ \t\n]+/, $_, 2); + if ($a eq "port") { + $port = $b; + $var{'ports'} .= "$port "; + } else { + $var{$a} = "$port $b"; + } + } + close F; + } +} + +sub yesno { + print STDERR "$_[0]: "; + print STDERR "[$_[1]] " if ($_[1]); + $_ = <STDIN>; + chop; + $_ = $_[1] if ! $_; + return "y" if /^[Yy].*/; + return "n"; +} diff --git a/comms/mgetty+sendfax/files/patch-aa b/comms/mgetty+sendfax/files/patch-aa new file mode 100644 index 000000000000..6e9ac65b7c16 --- /dev/null +++ b/comms/mgetty+sendfax/files/patch-aa @@ -0,0 +1,26 @@ +*** fax/faxspool.in~ Wed Aug 30 12:41:17 1995 +--- fax/faxspool.in Mon Mar 11 04:43:21 1996 +*************** +*** 287,297 **** + # user name (for authentification) + ########## + +! if user=`logname 2>/dev/null` +! then : + else +! id=`id` +! user=`expr "$id" : "[^( ]*(\([^)]*\)"` + fi + test -z "$user" && user=$LOGNAME + test -z "$user" && user=$USER +--- 287,296 ---- + # user name (for authentification) + ########## + +! if [ `id -u` = 0 ]; then +! user=root + else +! user=`logname` + fi + test -z "$user" && user=$LOGNAME + test -z "$user" && user=$USER diff --git a/comms/mgetty+sendfax/files/patch-ab b/comms/mgetty+sendfax/files/patch-ab new file mode 100644 index 000000000000..78d30fdd53a9 --- /dev/null +++ b/comms/mgetty+sendfax/files/patch-ab @@ -0,0 +1,114 @@ +*** Makefile.orig Wed Aug 30 12:47:16 1995 +--- Makefile Tue Mar 12 02:57:34 1996 +*************** +*** 4,11 **** + # + # this is the C compiler to use (on SunOS, the standard "cc" does not + # grok my code, so please use gcc there. On ISC 4.0, use "icc".). +! CC=gcc +! #CC=cc + # + #### C Compiler Flags #### + # +--- 4,11 ---- + # + # this is the C compiler to use (on SunOS, the standard "cc" does not + # grok my code, so please use gcc there. On ISC 4.0, use "icc".). +! #CC=gcc +! CC=cc + # + #### C Compiler Flags #### + # +*************** +*** 96,102 **** + # USTAT - ustat(), no statfs etc. + # + #CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL +! CFLAGS=-O2 -Wall -pipe + #CFLAGS=-O -DSVR4 + #CFLAGS=-O -DSVR4 -DSVR42 + #CFLAGS=-O -DUSE_POLL +--- 96,102 ---- + # USTAT - ustat(), no statfs etc. + # + #CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL +! #CFLAGS=-O2 -Wall -pipe + #CFLAGS=-O -DSVR4 + #CFLAGS=-O -DSVR4 -DSVR42 + #CFLAGS=-O -DUSE_POLL +*************** +*** 132,138 **** + # For FreeBSD, add "-lutil" if the linker complains about + # "utmp.o: unresolved symbod _login" + # +! LDFLAGS= + #LDFLAGS=-lprot -lsocket + #LDFLAGS=-s -shlib + #LDFLAGS=-lsocket +--- 132,138 ---- + # For FreeBSD, add "-lutil" if the linker complains about + # "utmp.o: unresolved symbod _login" + # +! LDFLAGS=-lutil + #LDFLAGS=-lprot -lsocket + #LDFLAGS=-s -shlib + #LDFLAGS=-lsocket +*************** +*** 227,235 **** + # please use the "mg.echo" program provided in the compat/ subdirectory. + # Set ECHO="mg.echo" and INSTALL_MECHO to mg.echo + # +! ECHO="echo" + # +! # INSTALL_MECHO=mg.echo + + # + # for mgetty, that's it. If you want to use Klaus Weidner's voice +--- 227,235 ---- + # please use the "mg.echo" program provided in the compat/ subdirectory. + # Set ECHO="mg.echo" and INSTALL_MECHO to mg.echo + # +! ECHO="mg.echo" + # +! INSTALL_MECHO=mg.echo + + # + # for mgetty, that's it. If you want to use Klaus Weidner's voice +*************** +*** 530,536 **** + + install: install-bin install-doc + +! install-bin: mgetty sendfax login.config mgetty.config sendfax.config + # + # binaries + # +--- 530,536 ---- + + install: install-bin install-doc + +! install-bin: mgetty sendfax login.config #mgetty.config sendfax.config + # + # binaries + # +*************** +*** 547,555 **** + # data files + directories + # + test -d $(LIBDIR) || \ +! ( mkdir `dirname $(LIBDIR)` $(LIBDIR) ; chmod 755 $(LIBDIR) ) + test -d $(CONFDIR) || \ +! ( mkdir `dirname $(CONFDIR)` $(CONFDIR); chmod 755 $(CONFDIR)) + test -f $(CONFDIR)/login.config || \ + $(INSTALL) -o root -m 600 login.config $(CONFDIR)/ + test -f $(CONFDIR)/mgetty.config || \ +--- 547,555 ---- + # data files + directories + # + test -d $(LIBDIR) || \ +! ( mkdir -p `dirname $(LIBDIR)` $(LIBDIR) ; chmod 755 $(LIBDIR) ) + test -d $(CONFDIR) || \ +! ( mkdir -p `dirname $(CONFDIR)` $(CONFDIR); chmod 755 $(CONFDIR)) + test -f $(CONFDIR)/login.config || \ + $(INSTALL) -o root -m 600 login.config $(CONFDIR)/ + test -f $(CONFDIR)/mgetty.config || \ diff --git a/comms/mgetty+sendfax/files/patch-ac b/comms/mgetty+sendfax/files/patch-ac new file mode 100644 index 000000000000..0c6485fce78a --- /dev/null +++ b/comms/mgetty+sendfax/files/patch-ac @@ -0,0 +1,35 @@ +*** kvg~ Tue May 30 21:54:12 1995 +--- kvg Tue Mar 12 03:27:45 1996 +*************** +*** 7,21 **** + + if [ $# -ne 1 ] ; then + echo "$0: kill mgetty/vgetty process on a given tty" >&2 +! echo "syntax: kvg [signal] tty<x>" >&2 + exit 1 + fi + +! if [ ! -f /etc/mg-pid.tty$1 ] ; then +! echo "no mgetty/vgetty on tty /dev/tty$1" >&2 + exit 2; + fi + +! pid=`cat /etc/mg-pid.tty$1` +! echo "killing mgetty/vgetty on tty$1, pid $pid, with signal $SIG..." + kill $SIG $pid +--- 7,21 ---- + + if [ $# -ne 1 ] ; then + echo "$0: kill mgetty/vgetty process on a given tty" >&2 +! echo "syntax: kvg [signal] cuaa<x>" >&2 + exit 1 + fi + +! if [ ! -f /var/run/mg-pid.cuaa$1 ] ; then +! echo "no mgetty/vgetty on tty /dev/cuaa$1" >&2 + exit 2; + fi + +! pid=`cat /var/run/mg-pid.cuaa$1` +! echo "killing mgetty/vgetty on cuaa$1, pid $pid, with signal $SIG..." + kill $SIG $pid diff --git a/comms/mgetty+sendfax/pkg-install b/comms/mgetty+sendfax/pkg-install new file mode 100644 index 000000000000..a66446a02119 --- /dev/null +++ b/comms/mgetty+sendfax/pkg-install @@ -0,0 +1,515 @@ +#!/usr/bin/perl + +exit 0 if $ARGV[1] ne "POST-INSTALL"; + +print STDERR "\n\n\n =========== mgetty+sendfax configuration ================\n\n"; +$prefix = $ENV{'PKG_PREFIX'}; +$sep = "~"; + +&read_config ("$prefix/etc/mgetty+sendfax/mgetty.config"); + +$a = 1; +$devices = $var{'ports'} ? $var{'ports'} : "cuaa1"; +while ($a) { + $devices = &ask ("list of devices", $devices); + + $_ = $devices; + $w = 0; + foreach (split) { + if (! -c "/dev/$_" ) { + print STDERR "warning: device file /dev/$_ does not exist!\n"; + $w++; + } + } + if ($w) { + $a = 0 if (&yesno ("are you sure?" , "n") eq "y"); + } else { + $a = 0; + } +} + +open (TMP, ">/tmp/mgetty.config.$$") || die "$!\n"; +$_ = join (":", $devices); +print TMP "fax-devices $_\n\n"; + +$_ = $devices; + +foreach $port (split) { + print STDERR "\n\n *** Configuring for port $port ***\n\n"; + print TMP "\nport $_\n"; + &setdef ($port); +again: + &inq; + goto again if (&confirm ($port) ne "y"); + &write_tmp; +} + +close (TMP); +if ( -e "$prefix/etc/mgetty+sendfax/mgetty.config") { + system ("mv -f $prefix/etc/mgetty+sendfax/mgetty.config $prefix/etc/mgetty+sendfax/mgetty.config.old"); +} +system ("mv -f /tmp/mgetty.config.$$ $prefix/etc/mgetty+sendfax/mgetty.config"); +system ("ln -sf $prefix/etc/mgetty+sendfax/mgetty.config $prefix/etc/mgetty+sendfax/sendfax.config"); + +open (F, ">$prefix/etc/mgetty+sendfax/faxheader"); +print F "\n FAX FROM: **not configured** $def{fax-id} TO: @T@ PAGE: @P@ OF @M@ \n"; +close (F); + + +print STDERR "\n\nediting /etc/ttys...\n"; + +open (F, "/etc/ttys"); +@ttys = <F>; +close (F); + +foreach $tty (@ttys) { + $_ = $devices; + foreach $port (split) { + if ($tty =~ /^\s*$port/) { + print STDERR "replacing line $tty"; + $tty = "$port\t\"$prefix/sbin/mgetty\"\tunknown on secure\n"; + $replaced{$port} = 1; + } + } +} +$_ = $devices; +foreach $port (split) { + if (!$replaced{$port}) { + print STDERR "adding port $port\n"; + push (@ttys, "$port\t\"$prefix/sbin/mgetty\"\tunknown on secure\n"); + } +} +system ("mv -f /etc/ttys /etc/ttys.old"); +open (F, ">/etc/ttys"); +print F @ttys; +close (F); + + +exit 0; + +sub confirm { + $_ = shift; + print STDERR "\n\n\tSettings for port $_\n\t------------------------\n"; + $_ = $settings; + foreach (split) { + print STDERR "\t$_ $def{$_}\n" if ($def{$_}); + } + return &yesno ("OK?", "y"); +} + +sub write_tmp { + $_ = $settings; + foreach (split) { + print TMP "$_ $def{$_}\n" if ($def{$_}); + } +} + +sub inq { + $settings = "debug"; + $def{'debug'} = 4 if !$def{'debug'}; + $def{'debug'} = &ask (" - `debug' + This sets the amount of logging `mgetty' will do. A good value is + 4, more details are seen with `5', and `9' is really noisy. Try + it! The log data is written to the file `/tmp/log_mg.cuaxx'.", $def{'debug'}); + + $settings .= " fax-id"; + $def{'fax-id'} = "00 00 000000" if ! $def{'fax-id'}; + $def{'fax-id'} = &ask (" - `fax-id' + This sets the fax station ID used in fax mode to identify your + site to the caller (usually this is simply your fax phone number). + ", $def{'fax-id'}); + + $settings .= " speed"; + $def{'speed'} = 38400 if !$def{'speed'}; + $def{'speed'} = &ask (" - `speed' + Specify, as integer value, the port speed to use. Default is + 38400. If the given speed is not valid, `mgetty' complains loudly + and exits.", $def{'speed'}); + + $settings .= " modem-init"; + $def{'modem-init'} = &ask (" - `modem-init' + Specifies an `AT...' command that is to be sent to the modem right + at the *beginning* of all modem talk (even before setting the modem + into fax mode, so this could be an `ATZ' if you want to reset the + modem).", ""); + + $settings .= " modem-handshake"; + $def{'modem-handshake'} = "AT&H3" if !$def{'modem-handshake'}; + $def{'modem-handshake'} = &ask (" - `modem-handshake' + Specifies an `AT...' command that will be sent to the modem at the + *end* of the modem initialization, right before dialing. *Do not + use ATZ or such here*, since resetting the modem will switch off + fax mode.", $def{'modem-handshake'}); + + $settings .= " max-tries"; + $def{'max-tries'} = 3 if !$def{'max-tries'}; + $def{'max-tries'} = &ask (" - `max-tries' + Specify the maximum number of tries per page if the receiving end + reports reception errors. If NNN tries do not suffice to + successfully transmit a page, `sendfax' will give up or simply go + on, depending on the setting of `max-tries-continue' (see below). + If this is set to `0', `sendfax' will ignore retransmission + requests and simply go on.", $def{'max-tries'}); + + $settings .= " max-tries-continue"; + $def{'max-tries-continue'} = "YES" if !$def{'max-tries-continue'}; + $def{'max-tries-continue'} = &ask (" - `max-tries-continue' + After the maximum number of tries for one page are reached, + `sendfax' can report an error and abort (`max-tries-continue NO'), + or go on with the next page (YES). + + For \"mission critical\" faxes, I'd set it to NO, but since the page + quality is most often quite good even if reported as \"page bad\", + the default is YES.", $def{'max-tries-continue'}); + + $settings .= " dial-prefix"; + $def{'dial-prefix'} = "ATD" if !$def{'dial-prefix'}; + $def{'dial-prefix'} = &ask (" - `dial-prefix' + This is the command used for dialing out. Usually this will be + something simple, as `ATD' or `ATDP', but if you have an unusual + setup, it could also be something like `ATX0DP0;X4DT' (meaning: + switch off dial-tone detection, pulse-dial `0', back to command + mode, switch on dial-tone detection, and go ahead dialing with + touch tones). The phone number will be sent right after the + `dial-prefix'.", $def{'dial-prefix'}); + + $settings .= " poll-dir"; + $def{'poll-dir'} = "./" if !$def{'poll-dir'}; + $def{'poll-dir'} = &ask (" - `poll-dir' + This is used to specify a directory where polled faxes (wheather + maps and such) are to be saved into. Default is the current + directory.", $def{'poll-dir'}); + + $settings .= " normal-res"; + $def{'normal-res'} = "NO" if !$def{'normal-res'}; + $def{'normal-res'} = &ask (" - `normal-res' + If set to `yes' or `true' (boolean), `sendfax' won't attempt to + make a fax connection in \"fine resolution\" mode. Normally you + won't need to use that option, since `faxrunq' will set the `-n' + switch if needed.", $def{'normal-res'}); + + $settings .= " verbose"; + $def{'verbose'} = "NO" if !$def{'verbose'}; + $def{'verbose'} = &ask (" - `verbose' + If set to `yes' or `true', `sendfax' will output progress reports + on stdout, if set to `no', `sendfax' will only print error and + warning messages.", $def{'verbose'}); + + + + $settings .= " switchbd"; + $def{'switchbd'} = &ask (" - `switchbd' + Some modems, mainly Rockwell chipsets, switch to 19200 bps when + entering fax mode. Others may need other speed switches (but I + know none). If your modem is Rockwell based, try `switchbd 19200' + if fax reception doesn't work. (*Warning:* if this is set wrongly, + fax reception will definitely fail. For most sane modems, you do + *not need* this.). Reply YES or NO", $def{'switchbd'}); + + $settings .= " direct"; + $def{'direct'} = "NO" if !$def{'direct'}; + $def{'direct'} = &ask (" - `direct' + Tells mgetty that it is running on a direct line. Mgetty won't try + to initialize any modem, nor will it wait for `RING'. It will just + wait for any character, and then output the issue file and login + prompt. This option is used if you want to connect to machines via + nullmodem cable.", $def{'direct'}); + + $settings .= " blocking"; + $def{'blocking'} = "NO" if !$def{'blocking'}; + $def{'blocking'} = &ask (" - `blocking' + Tells mgetty to open the device in `blocking' mode, that is, the + `open()' system call won't succeed until carrier detect is set. + This is set if `mgetty' is called as `getty'. I'm not sure whether + it's very useful, but I include it for completeness", $def{'blocking'}); + + $settings .= " port-owner"; + $def{'port-owner'} = "uucp" if !$def{'port-owner'}; + $def{'port-owner'} = &ask (" - `port-owner' + If set, mgetty will `chown' the tty line to the given username (you + can specify a string or an integer uid, but the integer must be + valid). This is highly recommended for security purposes: only + give port access to those users you trust not to misuse your modem + lines!", $def{'port-owner'}); + + $settings .= " port-group"; + $def{'port-group'} = "modem" if !$def{'port-group'}; + $def{'port-group'} = &ask (" - `port-group' + If set, mgetty will `chgrp' the tty line to this group id (which + can be given as group name, or as integer gid). If it's not given, + or not valid, the primary group id of `port-owner' + will be used.", $def{'port-group'}); + + $settings .= " port-mode"; + $def{'port-mode'} = "0660" if !$def{'port-mode'}; + $def{'port-mode'} = &ask (" - `port-mode' + Specifies the permissions to `chmod' the device to. + *Never* make a modem device world-accessible, better use `0660' + or even `0600'.", $def{'port-mode'} ); + + $settings .= " toggle-dtr"; + $def{'toggle-dtr'} = "YES" if !$def{'toggle-dtr'}; + $def{'toggle-dtr'} = &ask (" - `toggle-dtr' + Tells mgetty whether it should lower the DTR line upon startup to + reset modem. Default is `yes', but some (few) modems react + allergic to that and crash.", $def{'toggle-dtr'}); + + $settings .= " toggle-dtr-waittime"; + $def{'toggle-dtr-waittime'} = 500 if !$def{'toggle-dtr-waittime'}; + $def{'toggle-dtr-waittime'} = &ask (" - `toggle-dtr-waittime' + Specifies the time (in ms) to hold the DTR line low.", $def{'toggle-dtr-waittime'} ); + + $settings .= " data-only"; + $def{'data-only'} = "NO" if !$def{'data-only'}; + $def{'data-only'} =&ask (" - `data-only' + Tells `mgetty' to forget about faxing and only use the data part of + the modem. Default is `false'. You need this if your modem can't + distinguish incoming fax and data calls.", $def{'data-only'} ); + + $settings .= " fax-only"; + $def{'fax-only'} = "NO" if !$def{'fax-only'}; + $def{'fax-only'} = &ask (" - `fax-only' + Tells `mgetty' to put the modem in fax-only mode. You need this if + your modem can't distinguish incoming fax and data calls, but you + need fax more important than data; and you need it if you want to + disable data calls for security reasons (this could be achieved + via `login.config' as well)", $def{'fax-only'}); + + $settings .= " modem-type"; + $def{'modem-type'} = "auto" if ! $def{'modem-type'}; + $def{'modem-type'} = &ask (" - `modem-type' + Specifies the kind of modem connected to the port. Valid options are: + * auto + Mgetty will detect the modem type itself (which may occasionally + be not desirable, or it may fail on old modem equipment). + * c2.0 + Modem is a CLASS 2.0 fax mode. Works better than class 2, if + both are available, because its better standardized. Known to + work with USR and ZyXEL. + * cls2 + Modem is a CLASS 2 fax modem, mgetty will not try class 2.0. + * data + Do not try fax initialization + There is no way (yet) to tell mgetty to use *only* fax mode and + refuse data calls with this option, use the `fax-only true' + statement for that.", $def{'modem-type'}); + + $settings .= " init-chat"; + $def{'init-chat'} = '"" ATS0=0Q0&D3&C1 OK' if ! $def{'init-chat'}; + $def{'init-chat'} = &ask (" - `init-chat' + Tells mgetty the chat sequence to use for initializing the modem. + *Warning*: the sequence starts with *expect*, which will in most + cases be `\"\"' (nothing). This ordering was chosen because UUCP + does it this way, and I wanted to avoid confusion here. + + Example: + + \"\" \\d\\d\\d+++\\d\\d\\dATQ0E1V1H0 OK ATL0M0S0=0 OK AT&K3 OK + init sequence", $def{'init-chat'}); + + $settings .= " modem-check-time"; + $def{'modem-check-time'} = 3600 if ! $def{'modem-check-time'}; + $def{'modem-check-time'} = &ask (" - `modem-check-time' + Some modems have the nasty tendency to crash silently. With this + option, you tell `mgetty' to check every SECONDS seconds with a + simple `AT...OK' sequence whether the modem still reacts. If not, + `mgetty' will restart itself and do a full modem reset.", $def{'modem-check-time'}); + + $settings .= " rings"; + $def{'rings'} = 1 if !$def{'rings'}; + $def{'rings'} = &ask (" - `rings' + Sets the number of `RING' messages to wait for, before mgetty + picks up the phone. *Warning:* if your modem auto-answers, for + whatever reason, set this to something *different* than the + value set with `ATS0=mmm', otherwise the modems autoanswer and + mgettys manual answer will collide (most modems hang up if a + command is received during auto-answer)", $def{'rings'}); + + $settings .= " answer-chat"; + $def{'answer-chat'} = '"" ATA CONNECT \c \r' if !$def{'answer-chat'}; + $def{'answer-chat'} =&ask (" - `answer-chat' + This is the command sequence that is used to answer a phone call. + Usually you can leave it at the default ` \"\" ATA CONNECT \\c \\r ', + but for some modems you need `ATS0=1' in place of `ATA' (ATA not + allowed). The extra `\\r' expect string is needed that the code can + grab the full CONNECT XYZ\\R string. It will work without the \\r, + but then the logging information will be less detailed. *Right now, + \\r won't work at all, it's not implemented yet. Don't use it.* + ", $def{'answer-chat'} ); + + $settings .= " answer-chat-timeout"; + $def{'answer-chat-timeout'} = 80 if !$def{'answer-chat-timeout'}; + $def{'answer-chat-timeout'} = &ask (" - `answer-chat-timeout' + During the ANSWER-CHAT, each \"expect\" string must be seen in the + time specified here. Default is 80 seconds. This time should be at + least some 5 seconds longer than the time set with the `ATS7=...' + modem setup command.", $def{'answer-chat-timeout'}); + + $settings .= " autobauding"; + $def{'autobauding'} = "YES" if !$def{'autobauding'}; + $def{'autobauding'} = &ask (" - `autobauding' + Some modems switch their DTE line speed to the communication line + speed after connecting, e.g., after sending `CONNECT 2400', the + modem switches to 2400 bps. Newer modems usually have a switch to + \"lock\" a DTE baud rate, which is strongly recommended. If your + modem insists on doing this speed switch, setting `autobauding' to + YES will make mgetty behave accordingly.", $def{'autobauding'}); + + $settings .= " ringback"; + $def{'ringback'} = "NO" if !$def{'ringback'} ; + $def{'ringback'} = &ask (" - `ringback' + If you have to put your modem and your telephone on the same phone + line, you can switch on \"ringback\" or \"ring-twice\". This means, + mgetty won't answer the phone on the first call, but remember the + call, and pick up on the second call (if it comes in the time + specified by `ringback-time').", $def{'ringback'} ); + + $settings .= " ringback-time"; + $def{'ringback-time'} = "30" if !$def{'ringback-time'} ; + $def{'ringback-time'} = &ask (" - `ringback-time' + This setting specifies how much time may pass between the first + and the second call if \"ringback\" is active.", $def{'ringback-time'}); + + $settings .= " issue-file"; + $def{'issue-file'} = "/etc/issue" if !$def{'issue-file'} ; + $def{'issue-file'} = &ask (" - `issue-file' + This is the file printed before the login prompt.", $def{'issue-file'}); + + $settings .= " prompt-waittime"; + $def{'prompt-waittime'} = "500" if !$def{'prompt-waittime'} ; + $def{'prompt-waittime'} = &ask (" - `prompt-waittime' + This specifies how long `mgetty' will wait for modem and line to + settle down (in ms) before printing issue file and login prompt", + $def{'prompt-waittime'}); + + $settings .= " login-prompt"; + $def{'login-prompt'} = "@!login: " if !$def{'login-prompt'} ; + $def{'login-prompt'} = &ask(" - `login-prompt' + This specifies the login prompt that mgetty will output. Some + special characters in this string (and in the issue file, btw) are + recognized and replaced by something else: + * @ system name + * \\n newline + * \\r carriage return + * \\g bell + * \\b backspace (ascii 010) + * \\f form feed (ascii 013) + * \\t TAB + * \\P (and \\L) port name (e.g. ttyS0) + * \\C date and time, in \"ctime()\" format + * \\I Connection string (e.g. 2400/REL) + * \\N (and \\U) number of users currently logged in + * \\S Port speed (e.g. 38400) + * \\D current date in dd/mm/yy format + * \\T current time in hh:mm:ss format + * \\DIGIT character with the specified octal code + + The maximum lenght of the login prompt is limited to 140 + characters (after expansion).", $def{'login-prompt'}); + + + $settings .= " fax-server-file"; + $def{'fax-server-file'} = &ask (" - `fax-server-file' + Specifies the fax file(s) that is to be sent if someone else calls + your modem in *fax polling mode*, that is, the caller *receives* a + document. + + Normally, the file given is a text file, containing the list of G3 + files to send to the calling machine, one file per line. Comment + lines (starting with \"#\") are ignored. For backward compatibility, + `mgetty' does check whether the named file is a G3 file itself, in + which case this file is sent directly (but then, you can only send + one page). + + Not all modems support fax poll *server* mode, I know that the + ZyXEL and MultiTech do.", $def{'fax-server-file'}); + + $settings .= " diskspace"; + $def{'diskspace'} = 1024 if !$def{'diskspace'}; + $def{'diskspace'} = &ask (" - `diskspace' + This setting tells mgetty the minimum amount of disk space (in KB) that + has to be available in the fax spool directory for fax reception + to be allowed.", $def{'diskspace'}); + + $settings .= " notify"; + $def{'notify'} = "faxadmin" if !$def{'notify'}; + $def{'notify'} = &ask (" - `notify' + This is the address that will get mails if a fax is received. Not + fully tested.", $def{'notify'}); + + $settings .= " fax-owner"; + $def{'fax-owner'} = "uucp" if !$def{'fax-owner'}; + $def{'fax-owner'} = &ask (" - `fax-owner' + If set, mgetty will `chown' the received files to the given username + (you can specify a string or an integer uid, but the integer must be + valid).", $def{'fax-owner'}); + + $settings .= " fax-group"; + $def{'fax-group'} = "modem" if !$def{'fax-group'}; + $def{'fax-group'} = &ask (" - `fax-group' + If set, mgetty will `chgrp' the received files to this group id + (which can be given as group name, or as integer gid).", $def{'fax-group'}); + + $settings .= " fax-mode"; + $def{'fax-mode'} = "0660" if !$def{'fax-mode'}; + $def{'fax-mode'} = &ask (" - `fax-mode' + Specifies the permissions to `chmod' the received files.", $def{'fax-mode'}); + + +} +sub setdef { + local ($port, $l); + $port = shift; + $l = length ($port) + 1; + foreach (keys(%var)) { + $def{$_} = substr ($var{$_}, $l) if ($var{$_} =~ /^$port$sep/); + } + foreach (keys(%var)) { + $def{$_} = substr ($var{$_}, 1) if (!$def{$_} && $var{$_} =~ /^$sep/); + } +} +sub ask { + ($info, $default, $x) = @_; + print STDERR "$info: "; + print STDERR "[$default] " if ($default); + $_ = <STDIN>; + s/^\s*//; + chop; + return $_ ? $_ : $default; +} +sub read_config { + local ($conf, $port, $a, $b); + + $conf = shift; + $port = $sep; + foreach (keys(%var)) { + delete $var{$_}; + } + if ( -f $conf) { + open (F, $conf) || die "$!\n"; + while (<F>) { + chop; + s/^\s*//; + next if /^#/; + next if /^$/; + ($a, $b) = split (/[ \t\n]+/, $_, 2); + if ($a eq "port") { + $port = $b; + $var{'ports'} .= "$port "; + } else { + $var{$a} = "$port $b"; + } + } + close F; + } +} + +sub yesno { + print STDERR "$_[0]: "; + print STDERR "[$_[1]] " if ($_[1]); + $_ = <STDIN>; + chop; + $_ = $_[1] if ! $_; + return "y" if /^[Yy].*/; + return "n"; +} diff --git a/comms/mgetty+sendfax/pkg-plist b/comms/mgetty+sendfax/pkg-plist index 9108fe4984ff..ab1502b58ec3 100644 --- a/comms/mgetty+sendfax/pkg-plist +++ b/comms/mgetty+sendfax/pkg-plist @@ -1,43 +1,35 @@ -@cd /usr/local -@mode 775 -@owner bin -@group bin bin/faxspool bin/faxq bin/faxrm +bin/faxrunq +bin/g3cat bin/g3topbm +bin/kvg +bin/mg.echo bin/pbmtog3 -bin/g3cat -@mode 700 -bin/faxrunq -sbin/mgetty -sbin/sendfax -@owner root -@mode 600 -lib/mgetty+sendfax/dialin.config -lib/mgetty+sendfax/login.config -@owner bin -@mode 644 -lib/mgetty+sendfax/faxheader +etc/mgetty+sendfax/dialin.config +info/mgetty.info +info/mgetty.info-1 +info/mgetty.info-2 +info/mgetty.info-3 +info/mgetty.info-4 lib/mgetty+sendfax/cour25.pbm lib/mgetty+sendfax/cour25n.pbm -man/man1/g3topbm.1 -man/man1/pbmtog3.1 -man/man1/g3cat.1 -man/man1/faxspool.1 -man/man1/faxrunq.1 +man/man1/coverpg.1 +man/man1/fax.1 man/man1/faxq.1 man/man1/faxrm.1 -man/man1/fax.1 -man/man1/coverpg.1 +man/man1/faxrunq.1 +man/man1/faxspool.1 +man/man1/g3cat.1 +man/man1/g3topbm.1 +man/man1/pbmtog3.1 man/man4/mgettydefs.4 man/man5/faxqueue.5 man/man8/sendfax.8 man/man8/mgetty.8 -info/mgetty.info -info/mgetty.info-1 -info/mgetty.info-2 -info/mgetty.info-3 +sbin/mgetty +sbin/sendfax @cd /var/spool @exec mkdir -p %D/fax/incoming @exec mkdir -p %D/fax/outgoing diff --git a/comms/mgetty+sendfax/scripts/configure b/comms/mgetty+sendfax/scripts/configure index 26d113975821..e5cc709d8b75 100644 --- a/comms/mgetty+sendfax/scripts/configure +++ b/comms/mgetty+sendfax/scripts/configure @@ -1,378 +1,27 @@ #!/bin/sh +cd $WRKSRC || exit 1 +cp policy.h-dist policy.h -H=$WRKSRC/policy.h -trap "rm -f $H; exit 1" 1 2 3 -cp $WRKSRC/policy.h-dist $H || exit 1 +cat >> policy.h <<END +#undef DEFAULT_LOGIN_PROGRAM +#define DEFAULT_LOGIN_PROGRAM "/usr/bin/login" -ww () { - echo "#undef $1" >>$H - echo "#define $1 $2" >>$H -} -wq () { - echo -n "$1 [$2] " - read answ; if [ "$answ" = "" ]; then answ=$2; fi - ww $3 "\"$answ\"" - echo "---------------------------------------------------------------------" ; echo -} -wd () { - echo -n "$1 [$2] " - read answ; if [ "$answ" = "" ]; then answ=$2; fi - ww $3 "$answ" - echo "---------------------------------------------------------------------" ; echo -} -wb () { - echo -n "$1 [$2] " - read answ; if [ "$answ" = "" ]; then answ=$2; fi - ww $3 $4$answ - echo "---------------------------------------------------------------------" ; echo -} -wa () { - echo -n "$1 [$2] " - read answ; if [ "$answ" = "" ]; then answ=$2; fi - if [ $answ = "y" ]; then - echo "#define $3 $4" >>$H - fi - echo "---------------------------------------------------------------------" ; echo -} -wn () { - echo -n "$1 " - read answ; if [ "$answ" != "" ]; then - echo "#define $2 \""$answ"\"" >>$H - fi - echo "---------------------------------------------------------------------" ; echo -} +#define CNDFILE "dialin.config" -# our PID files used to live under /var/run, do not bloat /etc -ww MGETTY_PID_FILE \"/var/run/mgetty.%s.pid\" +#undef MGETTY_PID_FILE +#define MGETTY_PID_FILE "/var/run/mg-pid.%s" +#undef LOCK +#define LOCK "/var/spool/lock/LCK..%s" -cat <<END +#undef FAX_LOG +#define FAX_LOG "/var/spool/fax/Faxlog" +#undef MAILER +#define MAILER "/usr/sbin/sendmail" - login dispatcher config file - - In this file, you can configure which "login" program (default /bin/login) - to call for what user name. - - You could use it to call "uucico" for all users starting with "U*" - (works only with Taylor UUCP 1.04 with my patch), or to call a fido - mailer for fido calls (only if -DFIDO defined)... - See the samples in the example login.config file (built from login.cfg.in). - - WARNING: make sure that this file isn't world-accessable (SECURITY!) - - If you want to call /usr/bin/login in any case, do not define this -END -echo "#undef LOGIN_CFG_FILE" >>$H -wn "config file:" LOGIN_CFG_FILE - -ww DEFAULT_LOGIN_PROGRAM \"/usr/bin/login\" - - -cat <<END - user id of the "uucp" user. The tty device will be owned by this user, - so parallel dial-out of uucico will be possible -END -wq "uucp user:" uucp UUCPID - -cat <<END - access mode for the line while getty has it - it should be accessible - by uucp / uucp, but not by others (imagine someone dialing into your - system and using another modem to dial to another country...) -END -wd "access mode:" 0660 FILE_MODE - -cat <<END - Name of the mgetty log file - e.g. "/usr/spool/log/mgetty.log.%s" - a "%s" will be replaced by the device name, e.g. "tty2a" -END -wq "log file:" /tmp/log_mg.%s LOG_PATH - -cat <<END - Default log error level threshold. Possible error levels are - L_FATAL, L_ERROR, L_WARN, L_AUDIT, L_MESG, L_NOISE, L_JUNK (see mgetty.h) -END -wd level: L_MESG LOG_LEVEL - -cat <<END - System administrator - if a severe error happens (lprintf called - with log_level L_FATAL) and writing to CONSOLE is not possible, - the logfile will be mailed to him -END -wq "system administrator:" root ADMIN - -cat <<END - Syslog - - If you want logging messages of type L_AUDIT, L_ERROR and L_FATAL - to go to the "syslog", define this. - mgetty will use the facility "LOG_AUTH", and the priorities - LOG_NOTICE, LOG_ERR and LOG_ALERT, respectively. -END -wa "do you want logging messages?" n SYSLOG "" - -cat <<END - System name - printed at login prompt - If you do not define this, the uname() call will be used -END -wn "system name:" SYSTEM - -cat <<END - Login prompt - The "@", "\\D" and "\\T" escapes will be replaced by SYSTEM, the - current date and time, respectively. - override with "-p <prompt>" switch -END -wq "login prompt:" "@!login: " LOGIN_PROMPT - -cat <<END - Maximum time before login name has to be entered (in seconds) - (after that time a warning will be issued, after that, the call is - dropped). -END -wd "max login time:" 240 MAX_LOGIN_TIME - -cat <<END - nologin file - - If that file exists, a ringing phone won't be answered (see manual). - "%s" will be replaced by the device name. -END -wq "login file:" /etc/nologin.%s NOLOGIN_FILE - -ww LOCK \"/var/spool/lock/LCK..%s\" - -cat <<END - Set this to "1" if your system uses binary lock files (i.e., the pid - as four byte integer in host byte order written to the lock file) - If it is "0", HDB locking will be used - the PID will be written as - 10 byte ascii, with a trailing newline - (Just check "LOCK" while uucico or pcomm or ... are running to find - out what lock files are used on your system) -END -wd "blocks binary:" 0 LOCKS_BINARY - -cat <<END - the default speed used by mgetty - override it with "-s <speed>" - - WARNING: ZyXELs *can* do faxreceive with 38400, but a lot other modems, - especially such based on the rockwell chipset can *not*. So, if - your fax receive fails mysteriously, timing out waiting for "OK", try - setting this to 19200 -END - -wb speed: 38400 DEFAULT_PORTSPEED B - -cat <<END - the modem initialization string - - this sample string is for ZyXELs, for other modems you'll have to - replace &H3 (rts/cts flow control), &K4 (enable v42bis) and &N0 - (answer with all known protocols). - For instructions how to setup various other modems, look into - mgetty.texi ("modems" section) and check your modem manual - For some modems, an initial "\d" is needed. - If you need a "\" in the modem command, give it as "\\\\". - If you wish to use ZyXEL callerid, add "S40.2=1" - The modem must answer with "OK" (!!!) - otherwise, change mgetty.c -END -wq "initialization string:" "ATS0=0Q0&D3&H3&N0&K4" MODEM_INIT_STRING - -cat <<END - command termination string - - for most modems, terminating the AT... command with "\r" is - sufficient and "\r\n" also works without doing harm. - Unfortunately, for the Courier HST, you've to use *only* \r, - otherwise ATA won't work (immediate NO CARRIER), and for some - ZyXELs, you have to use \r\n (no OK otherwise). - So, try one, and if it doesn't work, try the other. -END -wq "suffix:" "\r" MODEM_CMD_SUFFIX - -cat <<END - "keep alive" - - mgetty can periodically check whether the modem is still alive - by issueing an "AT\r" command and checking for the "OK" - Define here, in seconds, how often mgetty should check. For normal - reliable modems, once an hour should be sufficient... - If you use "-1", mgetty won't check. -END -wd "check time" 3600 MODEM_CHECK_TIME - - -cat <<END - modem mode - - specify the default way mgetty+sendfax handle a faxmodem. - You have four choices: - "data" - data only, no faxing available (for sendfax, equal to "auto") - "cls2" - use AT+FCLASS=2 - "c2.0" - use AT+FCLASS=2.0 - "auto" - try "2.0", then "2", then fall to "data". - - Normally, you can leave this to "auto", but if you have a modem that - can do class 2.0 and class 2, and 2.0 doesn't work, then you could try - setting it to "cls2". - You can override this define with the "-C <mode>" switch. -END -wq "modem mode:" auto DEFAULT_MODEMTYPE - - -cat <<END - some modems are a little bit slow - after sending a response (OK) - to the host, it will take some time before they can accept the next - command - specify the amount needed in data mode here (in - milliseconds). Normally, 50 ms should be sufficient. (On a slow - machine it may even work without any delay at all) - - Be warned: if your machine isn't able to sleep for less than one - second, this may cause problems. - and this is the delay before sending each command while in fax mode -END -wd delay: 50 DO_CHAT_SEND_DELAY - -cat <<END - incoming faxes will be chmod()ed to this mode - (if you do not define this, the file mode will be controlled by - mgetty's umask) -END -wd "fax file mode:" 0660 FAX_FILE_MODE - -cat <<END - if your faxmodem switches to 19200 bps just after sending the "+FCON" - message to the host, define this. (Not important if you have the - portspeed set to 19200 anyway). - Some Tornado and Supra modems are know to do this. - ZyXELs do *not* do this, except if explicitely told to do so. - - You can see if this happens if mgetty gets the "+FCON" response, - starts the fax receiver, and times out waiting for OK, receiving - nothing or just junk. -END -wa "do your faxmodem switches to 19200?" n FAX_RECEIVE_USE_B19200 - -wa "do you have a US Robotics?" n FAX_USRobotics "" - -cat <<END -local station ID - - 20 character string, most faxmodem allow all ascii characters 32..127, - but some do only allow digits and blank - AT+FLID=? should tell you what's allowed and what not. -END -wq "station id:" "00 00 0000000" FAX_STATION_ID - -cat <<END - ------ sendfax-specific stuff follows here -------- - --------------------------------------------------- - - the baudrate used for *sending* faxes. ZyXELs can handle 38400, - SUPRAs (and other rockwell-based faxmodems) do not - I recommend 38400, since 19200 may be to slow for 14400 bps faxmodems! END -wb "baud rate:" 38400 FAX_SEND_BAUD B - -cat <<END - switch baud rate after +FCLASS=2 - - some weird modems require that you initialize the modem with one - baud rate (e.g. 2400 or 9600 for cheap 2400+fax modems, or "smart" - modems that insist on staying locked to 38400 (ELSA!)), but switch - to another baud rate, typically 19200, immediately after receiving - the "AT+FCLASS=2" command. - - If the following is defined, sendfax will switch to the speed given - here after sending AT+FCLASS=2. - - Only try fiddling with this if sendfax times out during modem - initialization, receiving junk instead of "OK" or "ERROR" (logfile!) -END -wa "switch to 19200?" n FAX_SEND_SWITCHBD B19200 - -cat <<END -this is the command to set the modem to use the desired flow control. - For hardware handshake, this could be &H3 for the ZyXEL, &K3 for - Rockwell-Based modems or \\Q3&S0 for Exar-Based Modems (i.e. some GVC's) -END -wq command: "AT&H3" FAX_MODEM_HANDSHAKE - -cat <<END - When sending a fax, if the other side says "page bad, retrain - requested", sendfax will retry the page. Specifiy here the maximum - number of retries (I recommend 3) before hanging up. - - If you set it to "0", sendfax will *never* retransmit a page (only - do this if you know that your modem returns +FPTS:2 even if the - page arrived properly, but be warned - you wont' be able to react - properly to transmission errors!) -END -wd "max tries:" 3 FAX_SEND_MAX_TRIES - -cat <<END - the device(s) used for faxing - multiple devices can be separated by ":", e.g. "tty1a:tty2a" - (without (!) leading /dev/) -END -wq devices: cuaa1 FAX_MODEM_TTYS - -cat <<END - some modems, notably some GVC modems and the german telecom approved - ZyXEL EG+ have the annoying behaviour of lowering and raising the - DCD line during the pre- and post-page handshake (when sending). - - If your modem does this, sendfax will terminate immediately after - starting to send the first page, or between the first and second - page, and the fax log file will show something like - "read failed, I/O error". - - If you define this, sendfax will (try to) ignore that line -END -wa define? n FAX_SEND_IGNORE_CARRIER "" - -cat <<END - Xon or not? - - the first issues of the class 2 drafts required that the program waits - for an Xon character before sending the page data. Later versions - removed that. Sendfax can do both, default is to wait for it. - - If you get an error message "... waiting for XON" when trying to - send a fax, try this one. Some ELSA modems are know to need it. -END -wa "Xon ?" n FAXSEND_NO_XON "" - -cat <<END - where to send notify mail about incoming faxes to - (remember to create an mail alias if no such user exists!) -END -wq "send to:" faxadmin MAIL_TO - -cat <<END - after a fax has arrived, mgetty can call a program for further - processing of this fax. - - (e.g.: printing of the fax, sending as MIME mail, displaying in an X - window (the latter one could be tricky) ...) - - It will be called as: - <program> <result code> "<sender_id>" <#pgs> <pg1> <pg2>... - - Define the name of this program here - If you don't want this type of service, do not define it at all -END -wn "program name (eg /usr/local/lib/mgetty+sendfax/new_fax): " FAX_NOTIFY_PROGRAM - -cat <<END - if this file exists, it can be used to control what callers - are allowed in. If undefined, the functionality is omitted. -END -wn "file (eg /usr/local/lib/mgetty+sendfax/dialin.config):" CNDFILE - -ww MAILER \"/usr/sbin/sendmail\" exit 0 |