diff options
author | Jean-Marc Zucconi <jmz@FreeBSD.org> | 1997-04-05 03:56:17 +0000 |
---|---|---|
committer | Jean-Marc Zucconi <jmz@FreeBSD.org> | 1997-04-05 03:56:17 +0000 |
commit | 85a09f9b1de6e0ec35f7f4e44ed7fbda80447ce4 (patch) | |
tree | 589336f43f8b56de6ac0a05603e7584327bc8809 /comms/mgetty+sendfax/pkg-install | |
parent | 058aae6cab66712246a6dae5f2675036f48c3ac3 (diff) | |
download | ports-85a09f9b1de6e0ec35f7f4e44ed7fbda80447ce4.tar.gz ports-85a09f9b1de6e0ec35f7f4e44ed7fbda80447ce4.zip |
Notes
Diffstat (limited to 'comms/mgetty+sendfax/pkg-install')
-rw-r--r-- | comms/mgetty+sendfax/pkg-install | 296 |
1 files changed, 198 insertions, 98 deletions
diff --git a/comms/mgetty+sendfax/pkg-install b/comms/mgetty+sendfax/pkg-install index f014f400acfb..c1dfb6106cdf 100644 --- a/comms/mgetty+sendfax/pkg-install +++ b/comms/mgetty+sendfax/pkg-install @@ -7,6 +7,14 @@ $prefix = $ENV{'PKG_PREFIX'}; $sep = "~"; &read_config ("$prefix/etc/mgetty+sendfax/mgetty.config"); +foreach (keys(%var)) { + $var_m{$_} = $var{$_}; + delete $var{$_}; +} +&read_config ("$prefix/etc/mgetty+sendfax/sendfax.config"); +foreach (keys(%var)) { + $var_f{$_} = $var{$_}; +} $a = 1; $devices = $var{'ports'} ? $var{'ports'} : "cuaa1"; @@ -28,28 +36,39 @@ while ($a) { } } -open (TMP, ">/tmp/mgetty.config.$$") || die "$!\n"; +open (TMP1, ">/tmp/mgetty.config.$$") || die "$!\n"; +open (TMP2, ">/tmp/sendfax.config.$$") || die "$!\n"; $_ = join (":", $devices); -print TMP "fax-devices $_\n\n"; +print TMP2 "fax-devices $_\n\n"; $_ = $devices; foreach $port (split) { print STDERR "\n\n *** Configuring for port $port ***\n\n"; - print TMP "\nport $_\n"; + print TMP1 "\nport $port\n"; + print TMP2 "\nport $port\n"; &setdef ($port); again: - &inq; + &inq_m; + $settings_m = $settings; + &inq_f; + $settings_f = "fax-id modem-type switchbd $settings"; goto again if (&confirm ($port) ne "y"); &write_tmp; } -close (TMP); +close (TMP1); +close (TMP2); 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 ("rm -f $prefix/etc/mgetty+sendfax/mgetty.config"); +} +if ( -e "$prefix/etc/mgetty+sendfax/sendfax.config") { + system ("mv -f $prefix/etc/mgetty+sendfax/sendfax.config $prefix/etc/mgetty+sendfax/sendfax.config.old"); + system ("rm -f $prefix/etc/mgetty+sendfax/sendfax.config"); } 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"); +system ("mv -f /tmp/sendfax.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"; @@ -90,34 +109,44 @@ exit 0; sub confirm { $_ = shift; print STDERR "\n\n\tSettings for port $_\n\t------------------------\n"; - $_ = $settings; + $_ = $settings_m; foreach (split) { print STDERR "\t$_ $def{$_}\n" if ($def{$_}); } + $_ = $settings_f; + foreach (split) { + print STDERR "\t$_ $def_f{$_}\n" if ($def_f{$_}); + } return &yesno ("OK?", "y"); } sub write_tmp { - $_ = $settings; + $_ = $settings_m; + foreach (split) { + print TMP1 "$_ $def{$_}\n" if ($def{$_}); + } + $_ = $settings_f; foreach (split) { - print TMP "$_ $def{$_}\n" if ($def{$_}); + print TMP2 "$_ $def_f{$_}\n" if ($def_f{$_}); } } -sub inq { +sub inq_m { $settings = "debug"; $def{'debug'} = 4 if !$def{'debug'}; - $def{'debug'} = &ask (" - `debug' + $def{'debug'} = &ask (" - `debug (mgetty)' 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'}); + 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'}); + ", $def{'fax-id'}) ; + $def_f{'fax-id'} = $def{'fax-id'} ; $settings .= " speed"; $def{'speed'} = 38400 if !$def{'speed'}; @@ -126,85 +155,16 @@ sub inq { 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'} = 0 if !$def{'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'}); + *not need* this.). Set speed or `0'", $def{'switchbd'}); + $def_f{'switchbd'} = $def{'switchbd'}; $settings .= " direct"; $def{'direct'} = "NO" if !$def{'direct'}; @@ -293,6 +253,7 @@ sub inq { 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'}); + $def_f{'modem-type'} = $def{'modem-type'}; $settings .= " init-chat"; $def{'init-chat'} = '"" ATS0=0Q0&D3&C1 OK' if ! $def{'init-chat'}; @@ -306,7 +267,29 @@ sub inq { \"\" \\d\\d\\d+++\\d\\d\\dATQ0E1V1H0 OK ATL0M0S0=0 OK AT&K3 OK init sequence", $def{'init-chat'}); - + + $settings .= " force-init-chat"; + $def{'force-init-chat'} = "" if !$def{'force-init-chat'}; + $def{'force-init-chat'} = &ask (" - `force-init-chat' + In some cases, the modem can get stuck in a mode where it won't + react to a simple `AT' command. Usually this happens because the + modem is set to ignore a DTR drop and still has a data connection + to the other side. If you use a voice modem, it could be stuck in + voice mode. + + In these situations, the normal `init-chat' will time out, because + the modem won't send the proper responses back. + + To get the modem back into a sane state, you can use the + `force-init-chat' chat sequence. The default setup will send the + DLE ETX characters, to get voice modems back to life, and then the + `(pause)+++(pause)ATH0' sequence to get the modem back from data + mode to command mode. + + You could prepend this sequence to `init-chat' (it wouldn't harm), + but especially the pauses around the +++ sequence makes this + undesirable slow.", $def{'force-init-chat'}); + $settings .= " modem-check-time"; $def{'modem-check-time'} = 3600 if ! $def{'modem-check-time'}; $def{'modem-check-time'} = &ask (" - `modem-check-time' @@ -325,6 +308,7 @@ sub inq { 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' @@ -370,6 +354,25 @@ sub inq { This setting specifies how much time may pass between the first and the second call if \"ringback\" is active.", $def{'ringback-time'}); + $settings .= " ignore-carrier"; + $def{'ignore-carrier'} = "false" if !$def{'ignore-carrier'} ; + $def{'ignore-carrier'} = &ask (" - `ignore-carrier' + + If your Modem does not assert the DCD (carrier detect) line, or the + serial port or cable or serial driver is broken, it is possible + that `mgetty' or `login' will block after a successful CONNECT + (that means: everything seems to work, but suddenly nothing is sent + to the port anymore. Depending on the operating system used, this + can be before printing the `/etc/issue' file or not before printing + the `password:' prompt. + + To work around this, you can switch off the carrier detection in + software: set `ignore-carrier true'. Default is `false'. + + *WARNING:* If you use this, your system won't be able to detect + when a caller just hangs up instead of cleanly logging out. This + may result in hanging modems, etc.", $def{'ignore-carrier'}); + $settings .= " issue-file"; $def{'issue-file'} = "/etc/issue" if !$def{'issue-file'} ; $def{'issue-file'} = &ask (" - `issue-file' @@ -407,6 +410,12 @@ sub inq { The maximum lenght of the login prompt is limited to 140 characters (after expansion).", $def{'login-prompt'}); + $settings .= " login-time"; + $def{'login-time'} = 240 if !$def{'login-time'}; + $def{'login-time'} = &ask (" - `login-time' + This specifies the maximum time the user can take to log in. If no + login has occured after that time, `mgetty' will hang up.", + $def{'login-time'}); $settings .= " fax-server-file"; $def{'fax-server-file'} = &ask (" - `fax-server-file' @@ -454,37 +463,128 @@ sub inq { $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 inq_f { + $settings = "debug"; + $def_f{'debug'} = 4 if !$def_f{'debug'}; + $def_f{'debug'} = &ask (" - `debug (sendfax)' + controls the amount of information written into the fax log file. + `0' means \"totally silent\" (not even errors are written), `9' + is really noisy. I usually use `3' or `4' in normal use, and `6' + for debugging.", $def_f{'debug'}); + + $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_f{'modem-handshake'} = "AT&H3" if !$def_f{'modem-handshake'}; + $def_f{'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_f{'modem-handshake'}); + + $settings .= " max-tries"; + $def_f{'max-tries'} = 3 if !$def_f{'max-tries'}; + $def_f{'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_f{'max-tries'}); + + $settings .= " max-tries-continue"; + $def_f{'max-tries-continue'} = "YES" if !$def_f{'max-tries-continue'}; + $def_f{'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_f{'max-tries-continue'}); + + $settings .= " speed (fax)"; + $def_f{'speed'} = 38000 if ! $def_f{'speed'}; + $def_f{'speed'} = &ask (" - `speed' + Set the port speed to use for fax send operations. Usually, + `38400' is a good choice, but a few dumb modems (for example, some + based on rockwell chipsets) need `19200' or even `9600'. A few + modems can go higher, but `sendfax' may not support it, and it may + not always work.", $def_f{'speed'}); + + $settings .= " dial-prefix"; + $def_f{'dial-prefix'} = "ATD" if !$def_f{'dial-prefix'}; + $def_f{'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_f{'dial-prefix'}); + $settings .= " poll-dir"; + $def_f{'poll-dir'} = "./" if !$def_f{'poll-dir'}; + $def_f{'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_f{'poll-dir'}); + + $settings .= " normal-res"; + $def_f{'normal-res'} = "NO" if !$def_f{'normal-res'}; + $def_f{'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_f{'normal-res'}); + $settings .= " verbose"; + $def_f{'verbose'} = "NO" if !$def_f{'verbose'}; + $def_f{'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_f{'verbose'}); } sub setdef { - local ($port, $l); - $port = shift; - $l = length ($port) + 1; - foreach (keys(%var)) { - $def{$_} = substr ($var{$_}, $l) if ($var{$_} =~ /^$port$sep/); + local ($p, $l); + $p = shift; + $l = length ($p) + 1; + foreach (keys(%var_m)) { + $def{$_} = substr ($var_m{$_}, $l) if ($var_m{$_} =~ /^$p/); + } + foreach (keys(%var_m)) { + $def{$_} = substr ($var_m{$_}, 1) if (!$def{$_} && $var_m{$_} =~ /^$sep/); } - foreach (keys(%var)) { - $def{$_} = substr ($var{$_}, 1) if (!$def{$_} && $var{$_} =~ /^$sep/); + foreach (keys(%var_f)) { + $def_f{$_} = substr ($var_f{$_}, $l) if ($var_f{$_} =~ /^$p/); + } + foreach (keys(%var_m)) { + $def_f{$_} = substr ($var_f{$_}, 1) if (!$def_f{$_} && $var_f{$_} =~ /^$sep/); } } sub ask { ($info, $default, $x) = @_; - print STDERR "$info: "; + print STDERR "\n$info: "; print STDERR "[$default] " if ($default); $_ = <STDIN>; s/^\s*//; chop; - return $_ ? $_ : $default; + if ($_ eq "") { + return $default; + } + return $_; } 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>) { |