#! @SCRIPT_SH@ # $Id$ # # @WARNING@ # # HylaFAX Facsimile Software # # Copyright (c) 1990-1996 Sam Leffler # Copyright (c) 1991-1996 Silicon Graphics, Inc. # HylaFAX is a trademark of Silicon Graphics # # Permission to use, copy, modify, distribute, and sell this software and # its documentation for any purpose is hereby granted without fee, provided # that (i) the above copyright notices and this permission notice appear in # all copies of the software and related documentation, and (ii) the names of # Sam Leffler and Silicon Graphics may not be used in any advertising or # publicity relating to the software without the specific, prior written # permission of Sam Leffler and Silicon Graphics. # # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. # # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE # OF THIS SOFTWARE. # # # VERSION: @VERSION@ # DATE: @DATE@ # TARGET: @TARGET@ # # # faxsetup [options] # # This script interactively prepares and verifies # a HylaFAX client and/or server machine for use. # PATH=/bin:/usr/bin:/etc test -d /usr/ucb && PATH=$PATH:/usr/ucb # Sun and others test -d /usr/bsd && PATH=$PATH:/usr/bsd # Silicon Graphics test -d /usr/5bin && PATH=/usr/5bin:$PATH:/usr/etc # Sun and others test -d /usr/sbin && PATH=/usr/sbin:$PATH # 4.4BSD-derived test -d /usr/local/bin && PATH=$PATH:/usr/local/bin # for GNU tools AWK=@AWK@ # awk for use below CAT=@CAT@ # cat command for use below CHGRP=@CHGRP@ # change file group for use below CHMOD=@CHMOD@ # change file mode for use below CHOWN=@CHOWN@ # change file owner for use below CP=@CP@ # cp command for use below ECHO=@ECHO@ # echo command for use below ENCODING=@ENCODING@ # encoding style for uuencode/mimencode FUSER=@FUSER@ # fuser command to dump in setup.cache GREP=@GREP@ # grep command for use below LN=@LN@ # ln command for use below LN_S=@LN_S@ # ln option for creating a symbolic link MKFIFO=@MKFIFO@ # FIFO creation program for use below MV=@MV@ # move file for use below PCL6CMD=@PCL6CMD@ # pcl6 (GhostPCL) program RMCMD=@RM@ # remove file for use below SCRIPT_SH=@SCRIPT_SH@ # shell for use below SED=@SED@ # sed for use below TIFF2PDF=@TIFF2PDF@ # tiff-to-pdf conversion tool TTYCMD=@TTYCMD@ # tty for error output BASE64ENCODE="@BASE64ENCODE@" # base64encode command to dump in setup.cache MIMENCODE="@MIMENCODE@" # mimeencode command to dump in setup.cache for old notifys QPENCODE="@QPENCODE@" # qpencode command to dump in setup.cache UUENCODE="@UUENCODE@" # uuencode command to dump in setup.cache FAX=@FAXUID@ # identity of the fax user SERVICES=/etc/services # location of services database INETDCONF=/usr/etc/inetd.conf # default location of inetd configuration file ALIASES=/usr/lib/aliases # default location of mail aliases database file PASSWD=/etc/passwd # where to go for password entries PROTOUID=@FAXUID@ # user who's uid we use for FAX user defPROTOUID=3 # use this uid if PROTOUID doesn't exist GROUP=/etc/group # where to go for group entries PROTOGID=@FAXGID@ # group who's gid we use for FAX user defPROTOGID=10 # use this gid if PROTOGID doesn't exist VERSION="@VERSION@" # configured version DATE="@DATE@" # data software was configured TARGET="@TARGET@" # configured target PATH_AFM=@FONTPATH@ # directory for Adobe Font Metric files PATH_FONTMAP=@FONTMAP@ # directory for FontMap files DIR_BIN=@BIN@ # directory for client applications DIR_LIBDATA=@LIBDATA@ # directory for client data files DIR_LIBEXEC=@LIBEXEC@ # directory where servers are located DIR_LOCKS=@UUCP_LOCKDIR@ # UUCP locking directory DIR_MAN=@MANDIR@ # directory for manual pages DIR_SBIN=@SBIN@ # directory for server applications DIR_SPOOL=@SPOOL@ # top of fax spooling tree TIFFBIN=@TIFFBIN@ # TIFF tools LOCKS=@UUCP_LOCKTYPE@ # UUCP lock type PATH_GETTY=@PATHGETTY@ # pathname for getty program PATH_SENDMAIL=@SENDMAIL@ # pathname for sendmail PATH_VGETTY=@PATHVGETTY@ # pathname for voice getty program PATH_EGETTY=@PATHEGETTY@ # pathname for external getty program PS=@PSPACKAGE@ # default PostScript RIP package PATH_GSRIP=@GSRIP@ # pathname of Ghostscript RIP PATH_DPSRIP=@DPSRIP@ # pathname of old IRIX DPS RIP PATH_IMPRIP=@IMPRIP@ # pathname of IRIX Impressario RIP POSIXLY_CORRECT=1; export POSIXLY_CORRECT # disable GNU extensions # # Location of sysv init script # DIR_SYSVINIT=@SYSVINITDIR@ FAXQ_SERVER=@FAXQ_SERVER@ HFAXD_SERVER=@HFAXD_SERVER@ HFAXD_SNPP_SERVER=@HFAXD_SNPP_SERVER@ # # These are the configuration parameters written to the # setup.cache file and read in by all the HylaFAX scripts. # # We use the same names used by configure for consistency # (but some confusion within this script). # VARS="SCRIPT_SH FONTPATH PATH_AFM AWK BASE64ENCODE BIN DIR_BIN CAT CHGRP CHMOD CHOWN CP DPSRIP PATH_DPSRIP ECHO ENCODING FAXQ_SERVER FUSER GREP GSRIP PATH_GSRIP HFAXD_SERVER HFAXD_SNPP_SERVER IMPRIP PATH_IMPRIP LIBDATA DIR_LIBDATA LIBEXEC DIR_LIBEXEC LN MANDIR DIR_MAN MIMENCODE MKFIFO MV PATH PATHGETTY PATH_GETTY PATHVGETTY PATH_VGETTY PATHEGETTY PATH_EGETTY PCL6CMD PSPACKAGE PS QPENCODE RM RMCMD SBIN DIR_SBIN SED SENDMAIL PATH_SENDMAIL SPOOL DIR_SPOOL SYSVINIT TIFF2PDF TIFFBIN TARGET TTYCMD UUENCODE UUCP_LOCKDIR DIR_LOCKS UUCP_LOCKTYPE LOCKS" dumpvals() { echo "$VARS" | while read a b; do eval c=\$${b:-$a}; echo "$a='$c'"; done } # # Find the full pathname of an executable; # supply a default if nothing is found. # findAppDef() { app=$1; path=$2; def=$3 case $app in /*) test -x $app && { echo $app; return; };; esac IFS=: for i in $path; do test -x $i/$app && { echo $i/$app; return; } done echo $def } # # Error diagnostics that should go to the terminal are # done with this interface or cat. # bitch() { echo "$@" 1>&2 } # # This is the preferred interface for # configure to terminate abnormally. # boom() { $RM $JUNK # boom can be called before TMPDIR is set if test x$TMPDIR != x; then $RM -r $TMPDIR fi exit 1 } usage() { cat</dev/null # chuck messages else exec 4>&1 # messages go to stdout fi Note() { echo "$@" 1>&4 } capture() { (eval "set -x; $*") > /dev/null 2>&1 return } Note "" Note "Setup program for HylaFAX (tm) $VERSION." Note "" Note "Created for $TARGET on $DATE." Note "" CPU=`expr $TARGET : '\([^\-]*\)'` || CPU=unknown VENDOR=`expr $TARGET : '[^\-]*-\([^\-]*\)'` || VENDOR=unknown OS=`expr $TARGET : '[^\-]*-[^\-]*-\([a-zA-Z]*\).*'` || OS=unknown RELEASE=`(uname -r) 2>/dev/null` || RELEASE=unknown # # Read in any site, target, vendor, os, or os-release # specific setup work. Note that we read stuff here # so that configuration parameters can be altered. We # use some pre-defined function names below to provide # hooks for other actions. # # # Hooks for additional client+server checks # otherBasicServerChecks() { true } otherBasicClientChecks() { true } # # Hook for adding stuff to setup.modem # dumpOtherModemFuncs() { true } # # Figure out which brand of echo we have and define prompt # and printf shell functions accordingly. Note that we # assume that if the System V-style echo is not present, # then the BSD printf program is available. These functions # are defined here so that they can be tailored on a per-site, # etc. basis. # if [ `echo foo\\\c`@ = "foo@" ]; then # System V-style echo supports \r # and \c which is all that we need prompt() { echo "$* \\c" } printf() { echo "$*\\c" } dumpPromptFuncs() { cat<<-'EOF' prompt() { echo "$* \\c" } printf() { echo "$*\\c" } EOF } elif [ "`echo -n foo`@" = "foo@" ]; then # BSD-style echo; use echo -n to get # a line without the trailing newline prompt() { echo -n "$* " } dumpPromptFuncs() { cat<<-'EOF' prompt() { echo -n "$* " } EOF } else # something else; do without prompt() { echo "$*" } dumpPromptFuncs() { cat<<-'EOF' prompt() { echo "$*" } EOF } fi if onServer; then # # Setup the password file manipulation functions according # to whether we have System-V style support through the # passmgmt program, or BSD style support through the chpass # program, or for SCO boxes through pwconv, or SVR4 style support # through useradd. If none are found, we setup functions that # will cause us to abort if we need to munge the password file. # # NB: some systems override these function definitions through # per-os faxsetup files # if [ -f /bin/passmgmt ] || [ -f /usr/sbin/passmgmt ]; then addPasswd() { passmgmt -o -a -c 'Facsimile Agent' -h $4 -u $2 -g $3 $1 } deletePasswd() { passmgmt -d $1 } modifyPasswd() { passmgmt -m -h $4 -u $2 -o -g $3 $1 } lockPasswd() { passwd -l $1 } elif [ -f /usr/bin/chpass ]; then addPasswd() { chpass -a "$1:*:$2:$3::0:0:Facsimile Agent:$4:" } modifyPasswd() { chpass -a "$1:*:$2:$3::0:0:Facsimile Agent:$4:" } lockPasswd() { return 0 # entries are always locked } elif [ -f /etc/pwconv ]; then # could be a SCO box addPasswd() { echo "${1}:NOLOGIN:${2}:${3}:Facsimile Agent:${4}:/bin/false" >> ${PASSWD} /etc/pwconv } lockPasswd() { return 0 # entries are always locked } modifyPasswd() { OLD_HOME=`grep "^${1}:" ${PASSWD} | awk -F: '{print $6}'` ed - $PASSWD <<_EOF g~^$1:~s~${OLD_HOME}~$4~ w q _EOF } elif [ -f /usr/sbin/useradd ] || [ -f /etc/useradd ]; then addPasswd() { useradd -c 'Facsimile Agent' -d $4 -u $2 -o -g $3 $1 } deletePasswd() { userdel $1 } modifyPasswd() { usermod -m -d $4 -u $2 -o -g $3 $1 } lockPasswd() { passwd -l $1 } else addPasswd() { cat >&2 <&2 </dev/null 2>&1 && speeds="\$speeds \$s" done fi echo \$speeds } EOF } ;; *) dumpSTTYFuncs() { cat</dev/null 2>&1 && speeds="\$speeds \$s" done fi echo \$speeds } EOF } ;; esac machdepPasswdWork() { true } # # Default values for new scheduler config files # defaultLogFacility=daemon defaultCountryCode=1 defaultAreaCode= defaultLongDistancePrefix=1 defaultInternationalPrefix=011 defaultDialStringRules=\"etc/dialrules\" defaultServerTracing=1 defaultContCoverPage= defaultContCoverCmd=\"bin/mkcover\" defaultMaxConcurrentCalls=1 defaultMaxDials=12 defaultMaxSendPages=0xffffffff defaultMaxTries=3 defaultModemGroup= defaultPostScriptTimeout=180 defaultPS2FaxCmd=\"bin/ps2fax\" defaultSendFaxCmd=\"bin/faxsend\" defaultSendPageCmd=\"bin/pagesend\" defaultSendUUCPCmd=\"bin/uucpsend\" defaultSessionTracing=0xffffffff defaultTimeOfDay=\"Any\" defaultUse2D=Yes defaultNotifyCmd=\"bin/notify\" defaultUUCPLockDir=\"$DIR_LOCKS\" defaultUUCPLockTimeout=30 defaultUUCPLockType=\"$LOCKS\" fi CONFIG_FILES= if [ -f $DIR_SBIN/faxsetup.local ]; then . $DIR_SBIN/faxsetup.local CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.local" elif [ -f $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}${RELEASE} ]; then . $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}${RELEASE} CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}${RELEASE}" elif [ -f $DIR_SBIN/faxsetup.${VENDOR}-${OS}${RELEASE} ]; then . $DIR_SBIN/faxsetup.${VENDOR}-${OS}${RELEASE} CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${VENDOR}-${OS}${RELEASE}" elif [ -f $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS} ]; then . $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS} CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}" elif [ -f $DIR_SBIN/faxsetup.${VENDOR}-${OS} ]; then . $DIR_SBIN/faxsetup.${VENDOR}-${OS} CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${VENDOR}-${OS}" elif [ -f $DIR_SBIN/faxsetup.${CPU}-${VENDOR} ]; then . $DIR_SBIN/faxsetup.${CPU}-${VENDOR} CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${CPU}-${VENDOR}" elif [ -f $DIR_SBIN/faxsetup.${VENDOR} ]; then . $DIR_SBIN/faxsetup.${VENDOR} CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${VENDOR}" elif [ -f $DIR_SBIN/faxsetup.${OS} ]; then . $DIR_SBIN/faxsetup.${OS} CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${OS}" fi # # Flush cached values if something was specified on the # command line # if onServer; then REASON= if [ $WITHARGS = yes ]; then REASON="of command line parameters" elif [ "$CONFIG_FILES" ]; then REASON=`find $CONFIG_FILES -newer $DIR_SPOOL/etc/setup.cache -print 2>/dev/null` test "$REASON" && REASON="$REASON has been updated" fi if [ "$REASON" ] && [ -f $DIR_SPOOL/etc/setup.cache ]; then Note "Flushing cached parameters because $REASON." Note "" rm -f $DIR_SPOOL/etc/setup.cache fi if [ -f $DIR_SPOOL/etc/setup.cache ]; then Note "Reading cached parameters from $DIR_SPOOL/etc/setup.cache." Note "" . $DIR_SPOOL/etc/setup.cache fi fi # # Double-check these settings... # if [ ! -x "$TIFF2PDF" ] || [ "$TIFF2PDF" = "bin/tiff2pdf" ]; then TIFF2PDF=`findAppDef tiff2pdf $PATH bin/tiff2pdf` if [ "$TIFF2PDF" != "bin/tiff2pdf" ]; then test -x "$TIFF2PDF" && Note "Found converter: $TIFF2PDF" fi fi test -x "$PCL6CMD" || { PCL6CMD=`findAppDef pcl6 $PATH pcl6` test -x "$PCL6CMD" && Note "Found PCL converter: $PCL6CMD" } test -x "$UUENCODE" || { UUENCODE=`findAppDef uuencode $PATH uuencode` test -x "$UUENCODE" && Note "Found uuencode encoder: $UUENCODE" } # $BASE64ENCODE may contain parameters cmd=`echo "$BASE64ENCODE" | $SED -e "s/^ *//" -e "s/ .*$//"` test -x "$cmd" || BASE64ENCODE=`findAppDef mimencode $PATH mimencode` test -x "$BASE64ENCODE" || BASE64ENCODE=`findAppDef base64-encode $PATH base64-encode` test -x "$BASE64ENCODE" || BASE64ENCODE=`findAppDef base64 $PATH base64` test -x "$BASE64ENCODE" || { if [ -x "$UUENCODE" ]; then if capture "$UUENCODE -m $PASSWD foo"; then BASE64ENCODE="$UUENCODE -m ==== | $GREP -v ====" fi fi } test -n "$BASE64ENCODE" && Note "Found base64 encoder: $BASE64ENCODE" # $QPENCODE may contain parameters cmd=`echo $QPENCODE | $SED -e "s/^ *//" -e "s/ .*$//"` test -x "$cmd" || { cmd=`findAppDef mimencode $PATH mimencode` QPENCODE="$cmd -q" test -x $cmd || { QPENCODE=`findAppDef qp-encode $PATH qp-encode` } } test -n "$QPENCODE" && Note "Found Quoted-Printable encoder: $QPENCODE" if [ -n "$BASE64ENCODE" ]; then if [ "$ENCODING" != "base64" ]; then ENCODING=base64 Note "Looks like $BASE64ENCODE supports base64 encoding." fi elif [ -x "$UUENCODE" ]; then if [ "$ENCODING" != "x-uuencode" ]; then ENCODING=x-uuencode Note "Looks like $UUENCODE does not support base64 encoding." fi fi # $MIMENCODE may contain parameters cmd=`echo "$MIMENCODE" | $SED -e "s/^ *//" -e "s/ .*$//"` test -x "$cmd" || { MIMENCODE=`findAppDef mimencode $PATH mimencode` } test -n "$MIMENCODE" && Note "Found mimencode for compatibilty: $MIMENCODE" RM="$RMCMD -f" # remove file for use below # # Deduce the effective user id: # 1. POSIX-style, the id program # 2. the old whoami program # 3. last gasp, check if we have write permission on /dev # euid=`id|$SED -e 's/.*uid=[0-9]*(\([^)]*\)).*/\1/'` test -z "$euid" && euid=`(whoami) 2>/dev/null` test -z "$euid" && test -w /dev && euid=root if [ "$euid" != "root" ]; then bitch "Sorry, but you must run this script as the super-user!" boom fi onClient && Note "Checking system for proper client configuration." onServer && Note "Checking system for proper server configuration." # # Verify configuration parameters are correct. # dirMisConfigured() { cat >&2 <&2 <<-EOF FATAL ERROR: $DIR_SPOOL does not exist or is not a directory! The HylaFAX spooling area $DIR_SPOOL does not exist or this file is not a directory. If the HylaFAX software is not yet installed you must do so before running this script. If the software is installed but is configured for use in a different location than this script expects then you may override the default pathname by running this script with a -with-DIR_SPOOL option; e.g. faxsetup -with-DIR_SPOOL=/var/spool/someplace_unexpected EOF boom } cd $DIR_SPOOL DIRS="archive bin client config dev docq doneq etc info log\ pollq recvq sendq status tmp" for i in $DIRS; do test -d $i || dirMisConfigured $DIR_SPOOL/$i done # # XXX should check permission and ownership of sensitive dirs # # Setup TMPDIR before anything can trap and rm it TMPDIR=`(mktemp -d /tmp/.faxsetup.XXXXXX) 2>/dev/null` if test x$TMPDIR = x; then TMPDIR=/tmp/.faxsetup$$ fi $RM -rf $TMPDIR (umask 077 ; mkdir $TMPDIR) || exit 1 JUNK="etc/setup.tmp" trap "$RM \$JUNK; $RM -r \$TMPDIR; exit 1" 1 2 15 exec 5>etc/setup.tmp echo '# Warning, this file was automatically generated by faxsetup' >&5 echo '# on' `date` "for ${USER:-$euid}" >&5 fi # # Basic client installation. # if onClient; then test -d $DIR_BIN || dirMisConfigured $DIR_BIN for file in sendfax sendpage faxstat faxalter faxcover faxmail faxrm; do test -x $DIR_BIN/$file || { cat >&2 <&2 <&2 <&2 <&2 <&2 <&4 <&2 <&2 </dev/null 2>&1; then true elif test -r conffifo; then # NB: not everyone has test -p true else cat >&2 </dev/null 2>&1 return } CheckAwk $AWK || { cat >&2 </dev/null | $AWK -F '[ ]' ' BEGIN { start = 0; } /Search path:/ { start = 1 } { if (start == 1) { if ($1 == "") { gsub(" ","") gsub("^[.]","") gsub("^:","") printf "%s", $0 } else if ($1 != "Search") start = 0 } } ' } genFontmap() { FONTMAP_FILE=$1 Note "" Note "Generating Fontmap $FONTMAP_FILE." Note "" echo "% HylaFAX FontMap file generated by faxsetup on `date 2>/dev/null`" > $FONTMAP_FILE for d in `echo $2 | $SED 's/:/ /g'`; do if [ -d "$d" ]; then cd $d for f in `ls | grep '\.afm'`; do $AWK -F '[ ]' '/FontName/ {print "/"$2"\t("FILENAME")\t;"; exit}; // {}' $f >> $FONTMAP_FILE done fi done } validateFont() { FONTNAME=$1 FONTMAP_PATH=$2 FONT_PATH=$3 # Note "" # Note "Searching for a font named $FONTNAME." # Note "" ALIAS=$FONTNAME while [ "$ALIAS" != "$LAST_ALIAS" ]; do LAST_ALIAS=$ALIAS for d in `echo $FONTMAP_PATH | $SED 's/:/ /g'`; do if [ -d "$d" ]; then cd $d for f in Fontmap Fontmap.GS Fontmap.HylaFAX; do if [ -f $f ]; then OUTPUT=`$SED -n -e 's/^\/'$ALIAS'[ ]*\((\([^)]*\))\|\/\([^ ;]*\)\).*/\2\3/p' $f` if [ -n "$OUTPUT" ]; then # Allow later files to overwrite previous definitions ALIAS=$OUTPUT fi fi done fi done done FONTFILE=`echo $ALIAS | sed -e 's/\.[^./]*$//'` for d in `echo $FONT_PATH | $SED 's/:/ /g'`; do if [ -f "$d/$FONTFILE.afm" ] || [ -f "$d/$FONTFILE" ]; then echo $FONTNAME return fi done } getDefaultFont() { FONTNAME=$1 FONTMAP_PATH=$2 FONT_PATH=$3 FONTNAME=`validateFont $FONTNAME $FONTMAP_PATH $FONT_PATH` if [ -n "$FONTNAME" ]; then echo $FONTNAME return fi # Requested font not found, searching for Courier FONTNAME=`validateFont Courier $FONTMAP_PATH $FONT_PATH` if [ -n "$FONTNAME" ]; then echo $FONTNAME return fi Note "" Note "Searching for a default font." Note "" # Courier font not found, searching for any font, with a # preference for fixed, non-italic, non-bold font. MAX=-1 for d in `echo $FONT_PATH | $SED 's/:/ /g'`; do if [ -d "$d" ]; then cd $d for f in `ls | grep '\.afm'`; do VAL=`$AWK -F '[ ]' ' /^IsFixedPitch / {count++; if (tolower($2) == "true") val += 100} /^ItalicAngle / {count++; if ($2 == 0) val += 10} /^Weight / {count++; if (tolower($2) == "regular") val += 5; if (tolower($2) == "normal") val += 4; if (tolower($2) == "roman") val += 3; if (tolower($2) == "medium") val += 2; if (tolower($2) == "book") val += 1} // {if (count >= 3) exit} BEGIN {val = count = 0} END {print val} ' $f` if [ $VAL -gt $MAX ]; then MAX=$VAL FONTNAME=`echo $f | sed -e 's/\.[^./]*$//'` fi done fi done echo $FONTNAME return } if [ -f $DIR_LIBDATA/hyla.conf ]; then CONFIGURED_PATH_AFM=`$SED -n -e 's/^FontPath:[ ]*\(.*\)/\1/p' $DIR_LIBDATA/hyla.conf` CONFIGURED_PATH_FONTMAP=`$SED -n -e 's/^FontMap:[ ]*\(.*\)/\1/p' $DIR_LIBDATA/hyla.conf` CONFIGURED_TEXTFONT=`$SED -n -e 's/^TextFont:[ ]*\(.*\)/\1/p' $DIR_LIBDATA/hyla.conf` fi if [ -n "$CONFIGURED_TEXTFONT" ]; then FONTNAME=$CONFIGURED_TEXTFONT else FONTNAME=Courier fi if [ -n "$CONFIGURED_PATH_FONTMAP" ]; then FONTMAP_PATH=$CONFIGURED_PATH_FONTMAP else FONTMAP_PATH=$PATH_AFM fi if [ -n "$CONFIGURED_PATH_AFM" ]; then FONT_PATH=$CONFIGURED_PATH_AFM else FONT_PATH=$PATH_AFM fi FOUND_FONTNAME=`getDefaultFont $FONTNAME $FONTMAP_PATH $FONT_PATH` if [ "$FOUND_FONTNAME" != "$FONTNAME" ]; then genFontmap $DIR_LIBDATA/Fontmap.HylaFAX $FONT_PATH FOUND_FONTNAME=`getDefaultFont $FONTNAME $FONTMAP_PATH:$DIR_LIBDATA $FONT_PATH` if [ "$FOUND_FONTNAME" = "$FONTNAME" ]; then # Font was found using our local Fontmap file FONTMAP_PATH=$FONTMAP_PATH:$DIR_LIBDATA else RUNTIME_PATH_AFM=`getGSFonts` if [ -n "$RUNTIME_PATH_AFM" ] && \ ( [ "$RUNTIME_PATH_AFM" != "$FONTMAP_PATH" ] || \ [ "$RUNTIME_PATH_AFM" != "$FONT_PATH" ] ); then FONTMAP_PATH=$RUNTIME_PATH_AFM FONT_PATH=$RUNTIME_PATH_AFM FOUND_FONTNAME=`getDefaultFont $FONTNAME $FONTMAP_PATH $FONT_PATH` if [ "$FOUND_FONTNAME" != "$FONTNAME" ]; then FOUND_FONTNAME=`getDefaultFont $FONTNAME $FONTMAP_PATH:$DIR_LIBDATA $FONT_PATH` if [ -n "$FOUND_FONTNAME" ]; then # Font was found using our local Fontmap file FONTMAP_PATH=$FONTMAP_PATH:$DIR_LIBDATA fi fi fi fi fi if [ -n "$FOUND_FONTNAME" ] && [ "$FOUND_FONTNAME" != "$FONTNAME" ]; then # Requested font not found # Setting default font to the best one found FONTNAME=$FOUND_FONTNAME fi if [ -n "$FONTNAME" ]; then Note "" Note "Found $FONTNAME to use as default font." Note "" else Note "" Note "Found no font to use as default font. You will most probably" Note "have to specify a font on textfmt command line." Note "" fi if [ -n "$FONTMAP_PATH" ] && \ ( [ "$CONFIGURED_PATH_FONTMAP" != "$FONTMAP_PATH" ] || \ [ "$CONFIGURED_PATH_AFM" != "$FONT_PATH" ] || \ [ "$CONFIGURED_TEXTFONT" != "$FONTNAME" ] ); then if [ -f $DIR_LIBDATA/hyla.conf ]; then $AWK '!/^FontMap|^FontPath|^TextFont|\/FontPath added by|^# Font configuration added by/ { print }' \ $DIR_LIBDATA/hyla.conf > $DIR_LIBDATA/hyla.conf.tmp fi if [ -n "$FONTMAP_PATH" ] && \ ( [ "$PATH_FONTMAP" != "$FONTMAP_PATH" ] || \ [ "$PATH_AFM" != "$FONT_PATH" ] || \ [ "Courier" != "$FONTNAME" ] ); then Note "" Note "Setting font configuration in $DIR_LIBDATA/hyla.conf." Note "" echo "# Font configuration added by faxsetup (`date 2>/dev/null`)" \ >> $DIR_LIBDATA/hyla.conf.tmp fi if [ -n "$FONTMAP_PATH" ] && [ "$PATH_FONTMAP" != "$FONTMAP_PATH" ]; then echo "FontMap: $FONTMAP_PATH" >> $DIR_LIBDATA/hyla.conf.tmp PATH_FONTMAP=$FONTMAP_PATH fi if [ -n "$FONT_PATH" ] && [ "$PATH_AFM" != "$FONT_PATH" ]; then echo "FontPath: $FONT_PATH" >> $DIR_LIBDATA/hyla.conf.tmp PATH_AFM=$FONT_PATH fi if [ -n "$FONTNAME" ] && [ "Courier" != "$FONTNAME" ]; then echo "TextFont: $FONTNAME" >> $DIR_LIBDATA/hyla.conf.tmp fi $MV $DIR_LIBDATA/hyla.conf.tmp $DIR_LIBDATA/hyla.conf fi # # Installation of Adobe Font Metric files # if [ -z "$FONT_PATH" ];then cat >&4 <&1 | grep tiffg3 >/dev/null 2>&1 || { cat >&2 <&2 </dev/null 2>&1 if [ $? -eq 2 ]; then if expr $RELEASE \>= 6.2 >/dev/null; then cat >&2 <= 6.2 >/dev/null; then cat >&2 </dev/null` if [ "$t" != hello ]; then cat >&2 <