#!/bin/sh FILE_NAME="axinstall" CAT_NAME="axis" PROD_TYPE="Print Server" # # # Installation script for UNIX environments. # # (C) Copyright 1993-1994, Axis Communications AB, LUND, SWEDEN # # REVISION="1.8.2 Oct 24, 1995" # # ----------------------------------------------------------------------------- PROD_TYPES=$PROD_TYPE"s" # --- if we do have a /bin/sh5 then use that instead test $# = 0 && test -f /bin/sh5 && exec /bin/sh5 $0 use_sh5 # --- if we're running HP-UX, use ksh instead OSNAME= test -f /usr/bin/uname && OSNAME=`/usr/bin/uname -sr` test -f /bin/uname && OSNAME=`/bin/uname -sr` OSVERSION= test -f /usr/bin/uname && OSVERSION=`/usr/bin/uname -v` echo $OSNAME | grep "HP-UX" >/dev/null test $? = 0 && test $# = 0 && test -f /bin/ksh && exec /bin/ksh $0 use_ksh # ----------------------------------------------------------------------------- test -f /usr/bsd/clear && clear=/usr/bsd/clear test -f /usr/ucb/clear && clear=/usr/ucb/clear test -f /bin/clear && clear=/bin/clear test -f /usr/bin/clear && clear=/usr/bin/clear test -f /usr/etc/mknod && mknod=/usr/etc/mknod test -f /etc/mknod && mknod=/etc/mknod test -f /etc/sbin/mknod && mknod=/etc/sbin/mknod test -f /sbin/mknod && mknod=/sbin/mknod test -f /usr/bin/cut && cut=/usr/bin/cut test -f /bin/cut && cut=/bin/cut test -f /usr/bin/tee && tee=/usr/bin/tee test -f /bin/tee && tee=/bin/tee ftp= test -f /usr/bsd/ftp && ftp=/usr/bsd/ftp test -f /usr/ucb/ftp && ftp=/usr/ucb/ftp test -f /usr/bin/ftp && ftp=/usr/bin/ftp test -f /bin/ftp && ftp=/bin/ftp HOSTNAME= test -f /bin/uname && HOSTNAME=`/bin/uname -n` test -f /usr/bin/hostname && HOSTNAME=`/usr/bin/hostname` test -f /bin/hostname && HOSTNAME=`/bin/hostname` test -f /usr/bin/uname && HOSTNAME=`/usr/bin/uname -n` # --- Functions and procedures. ----------------------------------------------- # --- echo come in many colours. ---------------------------------------------- echo_n=NO test X`echo -n` = X && echo_n=YES myecho() { if test X"$1" = "X-n"; then shift test $echo_n = YES && echo -n "$*" test $echo_n = NO && echo "$*" '\c' else echo $* fi } # --- Prompt with default for a yes or no answer. ----------------------------- # --- Leave answer in yes_or_no. yes_or_no= yes_or_noP() # $1 is prompt string. # $2 is default answer (yes/no). { yes_or_no= while true; do myecho -n "$1 [yn] ? (default $2): "; read yes_or_no test "X$yes_or_no" = "X" && yes_or_no=$2 case $yes_or_no in y | Y | yes | Yes | YES) yes_or_no=YES break # out of the while loop ;; n | N | no | No | NO) yes_or_no=NO break # out of the while loop ;; *) yes_or_no= ;; esac done } # --- Simple prompt with default for a text string answer. # --- Leave answer in variable answer. answer= answerP() # $1 is prompt string. # $2 is default answer. { answer= if test "X$2" != "X"; then myecho -n "$1 (default $2): "; read answer else myecho -n "$1":; read answer fi test "X$answer" = "X" && answer=$2 } # --- Simple prompt with default for a file path and name. # --- The path MUST begin with a / # --- Leave answer in variable path_answer. path_answer= path_answerP() # $1 is prompt string. # $2 is default answer. { path_answer= while true; do if test "X$2" != "X"; then myecho -n "$1 (default $2): "; read path_answer else myecho -n "$1":; read path_answer fi test "X$path_answer" = "X" && path_answer=$2 case $path_answer in /*) # Valid path. break ;; *) # missing / at beginning. path_answer= ;; esac done } # --- Prompt for one character of a given character class. # --- Leave answer in variable range_answer range_answer= range_answerP() # $1 is prompt string. # $2 is allowed answer characters class, in range [1-X], X>9. # $3 is default answer (must belong to class in $2). { range_answer= while true; do if test "X$3" != "X"; then myecho -n "$1" "$2" "(default $3): "; read range_answer else myecho -n "$1 $2: "; read range_answer fi test "X$range_answer" = "X" && range_answer=$3 low=`echo $2 | cut -c2` hi=`echo $2 | cut -c4,5` if test $low -le $range_answer -a $range_answer -le $hi; then break # out of the while loop. else range_answer= fi done } # --- Prompt for one character of a given character class. # --- Leave answer in variable class_answer class_answer= class_answerP() # $1 is prompt string. # $2 is allowed answer characters class, e.g. [0-9] for one of the digits. # $3 is default answer (must belong to class in $2). { class_answer= while true; do if test "X$3" != "X"; then myecho -n "$1" "$2" "(default $3): "; read class_answer else myecho -n "$1 $2: "; read class_answer fi test "X$class_answer" = "X" && class_answer=$3 case $class_answer in $2) break # out of the while loop. ;; *) class_answer= ;; esac done } # --- Say not if the parameter = NO say_not() { test "X$1" = "XNO" && echo " NOT" } # --- Say y or n when $1 is YES or NO. say_y_or_n() { test "X$1" = "XYES" && echo y test "X$1" = "XNO" && echo n } # --- Say i or o when $1 is if or of. say_io() { test "X$1" = "Xif" && echo i test "X$1" = "Xof" && echo o } # --- Say in or out when $1 is if or of. say_in_or_out() { test "X$1" = "Xif" && echo input test "X$1" = "Xof" && echo output } # --- Test if we hawe write permission in the directory. has_permission() # $1 is path to test { if test ! -d $1; then has_permission `dirname $1`; return elif test -w $1; then true; return else false; return fi } # --- not do boolean negation on return value of . not() { if $*; then false; return else true; return fi } # --- Welcome. Here start the main program. ------------------------------------ umask 022 $clear cat << WELCOME_END ================================================================================ $FILE_NAME, version $REVISION. Welcome to the $PROD_TYPE installation program for TCP/IP under UNIX. This program will lead you through a procedure to install $PROD_TYPES on your system. You can stop this program with the interrupt key at any time, and an installation log will be saved to a file. $FILE_NAME requiers that your $PROD_TYPE's IP address is defined. Before installation of each printer you will be able to accept or reject the installation. ================================================================================ WELCOME_END yes_or_noP "Do you want to continue" y test $yes_or_no = NO && exit 0 if test "X`id | tr '()' '::' | cut -f2 -d:`" != "Xroot"; then echo "You are not running as root." echo "It is likely that you have to be root to complete the installation" echo "(e.g. if you get error messages such as 'Cannot create ...' or" echo "'Permission denied ...')." echo yes_or_noP "Do you want to quit now" y test $yes_or_no = YES && exit 0 fi if test "X$ftp" = "X"; then echo "Cannot find your FTP program." path_answerP "Please enter the full path name of your FTP program: " ftp=$path_answer if test "X$ftp" = "X"; then echo "Cannot install without FTP program." exit 1 # ERROR fi echo fi if test "X$HOSTNAME" = "X"; then echo "Cannot find out the network name of this host." answerP "Please enter host name: " HOSTNAME=$answer if test "X$HOSTNAME" = "X"; then echo "Cannot install any network utilities without a host name." exit 1 # ERROR fi echo fi # --- create a log file in /tmp instalog=/tmp/$CAT_NAME"_$$_log" cat > $instalog << INSTALOG_HEAD_END ===================== $PROD_TYPE installation log ====================== INSTALOG_HEAD_END #$clear cat << START_MSG_END -------------------------------------------------------------------------------- $FILE_NAME An installation log will be saved in the file $instalog -------------------------------------------------------------------------------- START_MSG_END # ------------------------------------- Find out what kind of UNIX this is. --- # Supported systems SUN4_sys="SunOS 4 (SUN BSD, Solaris 1.x)" SUN5_sys="SunOS 5 (SUN SYS V, Solaris 2.x)" AIX_sys="AIX (IBM RS/6000, BULL DPX 20)" HPUX_sys="HP-UX (HP 9000)" BOS_sys="BOS (BULL DPX 2)" OSF1_sys="DEC OSF/1 (Digital Equipment, Alpha)" ULTRIX_sys="ULTRIX (Digital Equipment, DEC)" SGI_sys="IRIX (Silicon Graphics, SGI)" SCO_sys="SCO UNIX (Santa Cruz Operation)" FreeBSD_sys="FreeBSD (Berkeley UNIX)" # Generic systems BSD_sys="Generic BSD (Berkeley UNIX)" SYSV3_sys="Generic SYS V R3 (UNIX System V Release 3)" SYSV4_sys="Generic SYS V R4 (UNIX System V Release 4)" osfound=NO altlist="SunOS 4zSunOS 5zAIXzHP-UXzB.O.S. zOSF1zULTRIXzIRIXzFreeBSD" num_alts=9 oscnt=1 OSNAME= test -f /usr/bin/uname && OSNAME=`/usr/bin/uname -sr` test -f /bin/uname && OSNAME=`/bin/uname -sr` while test $osfound != YES -a $oscnt -le $num_alts; do sys_type=`echo $altlist | cut -f$oscnt -d'z'` echo $OSNAME | grep "$sys_type" >/dev/null if test $? = 0; then osfound=YES else oscnt=`expr $oscnt + 1` fi done if test $osfound = NO; then test -f /etc/printcap && osfound=YES test -x /usr/lib/lpadmin && osfound=NO test $osfound = YES && sys_type=BSD fi # SCO UNIX cannot be found with the uname command if test $osfound = NO; then if test -f /boot; then grep "SCO " /boot > /dev/null if test $? = 0; then osfound=YES sys_type=SCO fi fi fi if test $osfound = NO; then test -x /usr/lib/lpadmin && osfound=YES test -f /etc/printcap && osfound=NO if test $osfound = YES; then sys_type=SYSV3 test -f /etc/lp/Systems && sys_type=SYSV4 fi fi if test $osfound = YES; then echo str1="Your system is identified as being a" case $sys_type in "SunOS 4") str2=$SUN4_sys sys_type=1 ;; "SunOS 5") str2=$SUN5_sys sys_type=2 ;; "AIX") str2=$AIX_sys sys_type=3 ;; "HP-UX") str2=$HPUX_sys sys_type=4 ;; "B.O.S. ") str2=$BOS_sys sys_type=5 ;; "OSF1") str2=$OSF1_sys sys_type=6 ;; "ULTRIX") str2=$ULTRIX_sys sys_type=7 ;; "IRIX") str2=$SGI_sys sys_type=8 ;; "SCO") str2=$SCO_sys sys_type=9 ;; "FreeBSD") str2=$FreeBSD_sys sys_type=10 ;; "BSD") str2=$BSD_sys sys_type=11 ;; "SYSV3") str2=$SYSV3_sys sys_type=12 ;; "SYSV4") str2=$SYSV4_sys sys_type=13 ;; *) osfound=NO ;; esac echo "$str1 $str2" echo yes_or_noP "Is this correct" y test $yes_or_no = "NO" && osfound=NO fi if test $osfound != YES; then cat << SYS_TYPE_END Which of the systems below are you running? 1....$SUN4_sys 2....$SUN5_sys 3....$AIX_sys 4....$HPUX_sys 5....$BOS_sys 6....$OSF1_sys 7....$ULTRIX_sys 8....$SGI_sys 9....$SCO_sys 10...$FreeBSD_sys 11...$BSD_sys 12...$SYSV3_sys 13...$SYSV4_sys 14...Quit this program SYS_TYPE_END range_answerP "Enter choice" '[1-14]' 14 sys_type=$range_answer fi # SGI may have a BSD spooler as well if test $sys_type = 8; then if test -x /usr/etc/lpc -a -x /usr/bsd/lpr; then cat << SGI_BSD_END Your system seems to have BSD lpr spooler installed. Do you want to make the installation in the BSD spool system or in the SYS V spool system ? 1......Use SYS V spool system (lp print command). 2......Use BSD spool system (lpr print command). SGI_BSD_END class_answerP "Enter choice" '[1-2]' 1 if test $class_answer = 2; then sys_type=1 echo "Will use the BSD spool system" >> $instalog else echo "Will use the SYS V spool system" >> $instalog fi fi fi case $sys_type in 1|6|11) # Sun OS 4, OSF1, BSD sys_family=bsd sys_type=bsd filt_name=bsd ULTRIXFIX= stoplp=NO ;; 2) # Sun OS 5 sys_family=sysv sys_type=sun5 filt_name=sysv SHELL=/bin/sh # for the benefit of lpadmin. HPFIX=" " MODEL="standard" stoplp=NO ;; 3) # AIX (IBM AIX 3) sys_family=aix sys_type=aix filt_name=piobe stoplp=NO ;; 4) # HP-UX sys_family=sysv sys_type=hpux filt_name=sysv SHELL=/bin/sh HPFIX= # no ' ' between lpadmin's options and values MODEL="dumb" stoplp=YES ;; 5) # BOS (BULL DPX 2) sys_family=sysv sys_type=bos filt_name=sysv SHELL=/bin/sh HPFIX= MODEL="dumb" stoplp=YES ;; 7) # ULTRIX # test $# = 0 && test -f /bin/ksh && exec /bin/ksh $0 use_ksh (move up) sys_family=bsd sys_type=bsd filt_name=bsd stoplp=NO ULTRIXFIX="of=xf" # A line in the printcap entry for PROS A (OBS no ":" here). ;; 8) # SGI sys_family=sysv sys_type=sgi filt_name=sysv SHELL=/bin/sh HPFIX= MODEL="dumb" stoplp=YES ;; 10) # FreeBSD sys_family=bsd sys_type=freebsd filt_name=bsd ULTRIXFIX= stoplp=NO mkfifo /tmp/nisse_$$ 2>/dev/null if test $? != 0; then sys_type=bsd_nopipe echo echo " Your systems kernel is not supporting FIFOs, PROS A cannot be used." else rm /tmp/nisse_$$ fi ;; 9|12) # SYS V3, SCO sys_family=sysv sys_type=sysv3 filt_name=sysv SHELL=/bin/sh HPFIX=" " MODEL="standard" stoplp=YES ;; 13) # SYS V4 sys_family=sysv sys_type=sysv4 filt_name=sysv SHELL=/bin/sh HPFIX=" " MODEL="standard" stoplp=NO ;; 14) # Other (unknown). echo "Please refer to your technical reference for manual installation." exit 1 ;; esac # ------------------------------------------------------ Installation loop. --- saved_pcap=NO # Not saved yet. REM_HOST_NAME= PROSHOME= more_printers=YES while test $more_printers = "YES"; do case $sys_type in bsd|sysv4|hpux|freebsd) cat <<- LIST_BSD Select a print method from the list below. The recommended basic print method is LPD, for more advanced functionality and status feedback use PROS. 1.........LPD 2.........FTP 3.........PROS B 4.........PROS A LIST_BSD class_answerP "Enter choice" '[1-4]' 1 case $class_answer in 1) print_method=lpd ;; 2) print_method=ftp ;; 3) print_method=prosB ;; 4) print_method=prosA ;; esac ;; sun5|bsd_nopipe) cat <<- LIST_SUN5 Select a print method from the list below. The recommended basic print method is LPD, for more advanced functionality and status feedback use PROS. 1.........LPD 2.........FTP 3.........PROS B LIST_SUN5 class_answerP "Enter choice" '[1-3]' 1 case $class_answer in 1) print_method=lpd ;; 2) print_method=ftp ;; 3) print_method=prosB ;; # 4) # print_method=prosA # ;; esac ;; sysv3|sgi|bos) cat <<- LIST_SYSV3 Select a print method from the list below. The recommended basic print method is FTP, for more advanced functionality and status feedback use PROS. 1.........FTP 2.........PROS B 3.........PROS A LIST_SYSV3 class_answerP "Enter choice" '[1-3]' 1 case $class_answer in 1) print_method=ftp ;; 2) print_method=prosB ;; 3) print_method=prosA ;; esac ;; aix) cat <<- LIST_AIX Select a print method from the list below. The recommended basic print method is LPD, for more advanced functionality and status feedback use PROS. 1.........LPD 2.........FTP 3.........PROS LIST_AIX class_answerP "Enter choice" '[1-3]' 1 case $class_answer in 1) print_method=lpd ;; 2) print_method=ftp ;; 3) print_method=prosB ;; esac ;; esac # --- Common variables. # REM_HOST_NAME & PROSHOME are initialized outside more_printers loop # so we remember their values. REM_HOST_PRINTER=1 PRINTER= SPOOLDIR= # BSD only LOGFILE= # BSD only PRINTCAP=/etc/printcap # BSD only PROSDEV= PROSLOG= PROSPWD=netprinter # Neither asked for nor changed. # --- Common control variables. case $sys_family in bsd) create_pcap=NO edit_pcap=YES create_spooldir=YES create_logfile=YES ;; sysv) create_pcap=NO edit_pcap=NO create_spooldir=NO create_logfile=NO ;; aix) create_pcap=NO edit_pcap=NO create_spooldir=NO create_logfile=NO aix_data_type=1 if test "X$OSVERSION" = "X4"; then aix_printer="generic" else aix_printer="printer" fi aix_stream="asc" ;; esac # --- Print method specific control variables. case $print_method in prosA) compile_pros=YES create_proshome=YES create_proslog=YES create_prosdev=YES start_prosd=YES ;; prosB) compile_pros=YES create_proshome=YES create_proslog=NO if test $sys_family = aix; then aix_log_mode=1 fi create_prosdev=NO start_prosd=NO if_or_of=of ;; ftp) compile_pros=YES create_proshome=YES create_proslog=NO create_prosdev=NO start_prosd=NO if_or_of=of ;; lpd) compile_pros=NO create_proshome=NO create_proslog=NO create_prosdev=NO start_prosd=NO ;; esac more_changes=YES while test $more_changes = "YES"; do echo if test "X$REM_HOST_NAME" = "X"; then while test "X$REM_HOST_NAME" = "X"; do answerP "Enter the host name of your $PROD_TYPE" REM_HOST_NAME=$answer done else answerP "Enter the host name of your $PROD_TYPE" $REM_HOST_NAME REM_HOST_NAME=$answer fi echo echo "If you want to print using LPT1 with the default parameter values," echo "choose logical printer '1' for straight-through printing." echo "Choose '5' for printing with UNIX New Line to CR+LF conversion." echo class_answerP "Enter logical printer number" '[1-8]' $REM_HOST_PRINTER REM_HOST_PRINTER="$class_answer" if test X$PRINTER = X; then test $sys_family = bsd && PRINTER=${REM_HOST_NAME}-pr test $sys_family = sysv && PRINTER=${REM_HOST_NAME}_pr test $sys_family = aix && PRINTER=${REM_HOST_NAME}_pr fi echo answerP "Enter printer name" $PRINTER PRINTER=$answer if test $sys_family = bsd; then test X$SPOOLDIR = X && SPOOLDIR=/var/spool/lpd/$PRINTER path_answerP "Enter spool directory name" $SPOOLDIR test $SPOOLDIR != $path_answer && create_spooldir=YES SPOOLDIR=$path_answer test X$LOGFILE = X && LOGFILE=$SPOOLDIR/log path_answerP "Enter log file name" $LOGFILE test $LOGFILE != $path_answer && create_logfile=YES LOGFILE=$path_answer path_answerP "Enter printcap file name" $PRINTCAP PRINTCAP=$path_answer test ! -f $PRINTCAP && create_pcap=YES fi # BSD if test X$PROSHOME = X; then PROSHOME=/usr/local/lib/$CAT_NAME test $sys_family = aix && PROSHOME=/usr/lpd/$CAT_NAME fi case $print_method in prosA) if test $sys_family = sysv; then echo "The PROS A method allows the use of any printer model script in the" echo "'/usr/spool/lp/model/' directory." answerP "Enter model script name" $MODEL MODEL=$answer fi path_answerP "Enter PROS daemon directory" $PROSHOME test X$PROSHOME != X$path_answer && create_proshome=YES PROSHOME=$path_answer if test $sys_type = bos; then PROSDEV=/dev/$REM_HOST_NAME.pr$REM_HOST_PRINTER else path_answerP "Enter PROS daemon pipe: " /dev/$REM_HOST_NAME.pr$REM_HOST_PRINTER test X$PROSDEV != X$path_answer && create_prosdev=YES PROSDEV=$path_answer fi PROSLOG=$PROSHOME/prosd-log path_answerP "Enter PROS log file: " $PROSLOG test $PROSLOG != $path_answer && create_proslog=YES PROSLOG=$path_answer yes_or_noP "Compile the PROS daemon" `say_y_or_n $compile_pros` compile_pros=$yes_or_no yes_or_noP "Start the PROS daemon" `say_y_or_n $start_prosd` start_prosd=$yes_or_no ;; prosB) path_answerP "Enter PROS filter directory: " $PROSHOME test X$PROSHOME != X$path_answer && create_proshome=YES PROSHOME=$path_answer if test $sys_family = bsd; then class_answerP "Is PROS filter input or output?" '[io]' `say_io $if_or_of` if_or_of=${class_answer}f fi # always compile pros driver # yes_or_noP "Compile the PROS filter" `say_y_or_n $compile_pros` # compile_pros=$yes_or_no if test $sys_family = aix; then cat << AIX_LOG_MODE_END Put print job info in log file or mail user? 1.........USE LOG FILE 2.........MAIL USER AIX_LOG_MODE_END class_answerP "Enter choice" '[1-2]' $aix_log_mode aix_log_mode=$class_answer case $aix_log_mode in 1) create_proslog=YES path_answerP "Enter PROS log file: " $PROSLOG PROSLOG=$path_answer ;; 2) create_proslog=NO PROSLOG= ;; esac fi ;; ftp) path_answerP "Enter FTP filter directory: " $PROSHOME test X$PROSHOME != X$path_answer && create_proshome=YES PROSHOME=$path_answer ;; esac if test $sys_family = aix && test $print_method != lpd; then cat << AIX_DATA_TYPE_END Which emulation does the printer support? 1.........ASCII 2.........POSTSCRIPT 3.........HP-PCL (HP LaserJet II emulation) 4.........HP-PCL (HP LaserJet III emulation) 5.........HP-PCL (HP LaserJet IV emulation) 6.........HP-GL (Plotter) 7.........Other AIX_DATA_TYPE_END class_answerP "Enter choice" '[1-7]' $aix_data_type aix_data_type=$class_answer if test $aix_data_type = 7; then answerP "Enter Printer Colon File" $aix_printer.$aix_stream aix_printer=$answer fi fi echo # --- BARF SETUP --------------------------------------------------------------- $clear cat << SETUP_0_END ------------------------------- Printer setup ---------------------------------- $PROD_TYPE host name: $REM_HOST_NAME Logical printer: pr$REM_HOST_PRINTER Printer name: $PRINTER SETUP_0_END if test $sys_family = bsd; then cat << SETUP_1_END Spool directory: $SPOOLDIR Log file: $LOGFILE Printcap file: $PRINTCAP SETUP_1_END fi case $print_method in prosA) cat << SETUP_2_END PROS daemon directory: $PROSHOME PROS daemon pipe: $PROSDEV PROS daemon log file: $PROSLOG SETUP_2_END ;; prosB) cat << SETUP_3_END PROS filter directory: $PROSHOME SETUP_3_END if test $sys_family = bsd; then echo " PROS filter is `say_in_or_out $if_or_of` filter" fi if test $sys_family = aix; then case $aix_log_mode in 1) echo " PROS log file: "$PROSLOG ;; 2) echo " PROS log file: none, will mail user" ;; esac fi ;; ftp) cat << SETUP_4_END FTP filter directory: $PROSHOME SETUP_4_END ;; esac if test $sys_family = aix && test $print_method != lpd; then case $aix_data_type in 1) aix_data_setup="ASCII" if test "X$OSVERSION" = "X4"; then aix_printer="generic" else aix_printer="printer" fi aix_stream="asc" ;; 2) aix_data_setup="POSTSCRIPT" if test "X$OSVERSION" = "X4"; then aix_printer="generic" else aix_printer="postscript" fi aix_stream="ps" ;; 3) aix_data_setup="HP-PCL (HP LaserJet II emulation)" aix_printer="hplj-2" aix_stream="pcl" ;; 4) aix_data_setup="HP-PCL (HP LaserJet III emulation)" aix_printer="hplj-3" aix_stream="pcl" ;; 5) aix_data_setup="HP-PCL (HP LaserJet IV emulation)" aix_printer="hplj-4" aix_stream="pcl" ;; 6) aix_data_setup="HP-GL (Plotter)" if test "X$OSVERSION" = "X4"; then aix_printer="generic" else aix_printer="plotter" fi aix_stream="gl" ;; 7) aix_data_setup="Other" aix_stream=`echo $aix_printer | cut -f2 -d"."` aix_printer=`echo $aix_printer | cut -f1 -d"."` ;; esac cat << SETUP_5_END Printer emulation: $aix_data_setup (Printer Colon File : $aix_printer.$aix_stream) SETUP_5_END fi echo if test $sys_family = bsd; then if test $create_pcap = YES; then echo " The printcap file will be created" else echo " The printcap file will be modified" fi cat << IWILL_1_END The spool directory will`say_not $create_spooldir` be created The log file will`say_not $create_logfile` be created IWILL_1_END fi case $print_method in prosA) cat << IWILL_2_END The PROS daemon directory will`say_not $create_proshome` be created The PROS daemon pipe will`say_not $create_pipe` be created The PROS daemon log file will`say_not $create_proslog` be created The PROS daemon will`say_not $compile_pros` be compiled The PROS daemon will`say_not $start_prosd` be started IWILL_2_END ;; prosB) if test $sys_family = aix; then cat << IWILL_2B_END The PROS filter log file will`say_not $create_proslog` be created. IWILL_2B_END fi # (move down if needed) The PROS filter will`say_not $compile_pros` be compiled. cat << IWILL_3_END The PROS filter directory will`say_not $create_proshome` be created. IWILL_3_END ;; ftp) cat << IWILL_4_END The FTP filter directory will`say_not $create_proshome` be created. IWILL_4_END ;; esac cat << SETUP_5_END -------------------------------------------------------------------------------- SETUP_5_END yes_or_noP "Do you want to install this printer " y if test $yes_or_no = "NO"; then # --- Edit the setup. more_changes=YES else # --- Check the setup and permissions if user satisfied. echo echo "Checking setup, wait ..." more_changes=NO # --- Initially assume everything is OK. ftp_err=/tmp/err_$$ ftp_msg=/tmp/msg_$$ $ftp -nv $REM_HOST_NAME <<- TEST_FTP_END 2> $ftp_err 1> $ftp_msg quit TEST_FTP_END err=`cat $ftp_err` msg=`grep -i "FTP Printer Server " $ftp_msg` rm $ftp_err $ftp_msg if test "X${err:+mumble}" != "X"; then more_changes=YES echo "The $PROD_TYPE \"$REM_HOST_NAME\" is not responding" echo "Check your host table" elif test "X${msg:+mumble}" = "X"; then more_changes=YES echo "The host \"$REM_HOST_NAME\" is not recognized as a $PROD_TYPE" echo "Check your host table" fi case $sys_type in bsd|freebsd|bsd_nopipe) if test $create_spooldir = YES && test -d $SPOOLDIR; then echo "The spool directory $SPOOLDIR already exists" yes_or_noP "Do you want to use the existing spool directory" n if test $yes_or_no = YES; then create_spooldir=NO else more_changes=YES fi fi if test $create_logfile = YES && test -f $LOGFILE; then echo "The log file $LOGFILE already exists" yes_or_noP "Do you want to use the existing log file" n if test $yes_or_no = YES; then create_logfile=NO else more_changes=YES fi fi if test -f $PRINTCAP; then sedcmd="/^$PRINTER|.*:/p;/^.*|$PRINTER|.*:/p;/^.*|$PRINTER:/p" pcap_entry=`sed -n -e $sedcmd $PRINTCAP` if test ! -w $PRINTCAP; then echo "No permission to modify the printcap file $PRINTCAP." more_changes=YES edit_pcap=NO elif test X${pcap_entry:+mumble} != X; then echo "There is already an entry in the $PRINTCAP file for $PRINTER." echo "The $PRINTCAP file will NOT be modified" more_changes=YES edit_pcap=NO else edit_pcap=YES fi elif test $create_pcap = NO; then echo echo "The $PRINTCAP file does not exists." yes_or_noP "Do you want to create the $PRINTCAP file" n create_pcap=$yes_or_no if test $create_pcap = YES; then if has_permission `dirname $PRINTCAP`; then edit_pcap=YES else echo "No permission to create the printcap file $PRINTCAP." create_pcap=NO more_changes=YES fi fi fi # create_pcap ;; sysv3 | sysv4 | sun5 | hpux | sgi | bos) lpstat_err=/tmp/err_$$ /usr/bin/lpstat -p$HPFIX$PRINTER 2> $lpstat_err 1> /dev/null err=`cat $lpstat_err | grep lpstat` rm $lpstat_err if test "X${err:+mumble}" = "X"; then echo "Printer $PRINTER is already present in the system" more_changes=YES fi ;; aix) qchk -P$PRINTER 2> /dev/null 1> /dev/null if test $? = 0; then echo "Printer $PRINTER is already present in the system" more_changes=YES fi if test ! -f /usr/lpd/pio/predef/$aix_printer.$aix_stream; then echo "Printer Colon File /usr/lpd/pio/predef/$aix_printer.$aix_stream not present." more_changes=YES fi ;; esac if test $create_proshome = YES && test -d $PROSHOME; then case $print_method in prosA) echo "The PROS daemon directory $PROSHOME already exists" ;; prosB) echo "The PROS filter directory $PROSHOME already exists" ;; ftp) echo "The FTP filter directory $PROSHOME already exists" ;; esac yes_or_noP "Do you want to use the existing directory" y if test $yes_or_no = YES; then create_proshome=NO else more_changes=YES fi fi if test $create_proshome = YES && not has_permission `dirname $PROSHOME`; then case $print_method in prosA) echo "No permission to create the PROS daemon directory $PROSHOME" ;; prosB) echo "No permission to create the PROS filter directory $PROSHOME" ;; ftp) echo "No permission to create the FTP filter directory $PROSHOME" ;; esac create_proshome=NO more_changes=YES fi if test $create_prosdev = YES && test -p $PROSDEV; then echo "The pros daemon pipe $PROSDEV already exists" yes_or_noP "Do you want to use the existing pipe" n if test $yes_or_no = YES; then create_prosdev=NO else more_changes=YES fi fi if test $create_prosdev = YES && not has_permission `dirname $PROSDEV`; then echo "No permission to create the pipe $PROSDEV" create_prosdev=NO more_changes=YES fi if test $create_proslog = YES && test -f $PROSLOG; then echo "The pros log file $PROSLOG already exists" yes_or_noP "Do you want to use the existing pros log file" n if test $yes_or_no = YES; then create_proslog=NO else more_changes=YES fi fi if test $create_proslog = YES && not has_permission `dirname $PROSLOG`; then create_proslog=NO more_changes=YES echo "No permission to create the pros log file $PROSLOG" fi if test $compile_pros = YES; then case $print_method in prosA) if test -f $PROSHOME/prosd; then echo "The PROS daemon in directory $PROSHOME already exists" yes_or_noP "Do you want to use the existing PROS daemon" y if test $yes_or_no = YES; then compile_pros=NO else more_changes=YES fi fi ;; prosB) if test -f $PROSHOME/pros_${PRINTER}; then echo "The PROS filter in directory $PROSHOME already exists" more_changes=YES compile_pros=NO fi ;; ftp) if test -f $PROSHOME/ftp_${PRINTER}; then echo "The FTP filter in directory $PROSHOME already exists" more_changes=YES compile_pros=NO fi ;; esac fi if test $more_changes = NO; then echo "No conflicts found" else echo "*** Conflicts found! ***" echo "Printer $PRINTER will NOT be installed" fi echo "Setup check done." echo fi # yes_or_no more_changes done # while $more_changes if test $more_changes = "NO"; then error=NO echo "Installing printer $PRINTER." >> $instalog echo "Installing printer $PRINTER..." if test $sys_family = bsd; then if test $create_pcap = YES; then if test ! -d `dirname $PRINTCAP`; then mkdir -p `dirname $PRINTCAP` test $? != 0 && error=YES fi cat <<- PCAP_HEADER_END > $PRINTCAP # --- This printcap was created by the $PROD_TYPE installation script. --- # PCAP_HEADER_END test $? != 0 && error=YES elif test $saved_pcap = NO; then # --- It is wise to save the printcap. saved_pcap_file=/tmp/$$_saved_pcap cp $PRINTCAP $saved_pcap_file test $? != 0 && error=YES echo "saved file $PRINTCAP in file $saved_pcap_file." >> $instalog fi if test $edit_pcap = YES ; then myecho -n "Modifying printcap file $PRINTCAP, " >> $instalog echo "installed following printcap entry:" >> $instalog echo >> $instalog case $print_method in prosA) # PROS A cat <<- PROSA_PCAP_ENTRY_END | $tee -a $PRINTCAP >> $instalog $PRINTER| Network printer on $PROD_TYPE $REM_HOST_NAME using PROS A:\\ :lp=$PROSDEV:\\ :sd=$SPOOLDIR:\\ :lf=$LOGFILE:\\ :$ULTRIXFIX:\\ :sh: PROSA_PCAP_ENTRY_END test $? != 0 && error=YES ;; prosB) # PROS B cat <<- PROSB_PCAP_ENTRY_END | $tee -a $PRINTCAP >> $instalog $PRINTER| Network printer on $PROD_TYPE $REM_HOST_NAME using PROS B:\\ :lp=$SPOOLDIR/null:\\ :sd=$SPOOLDIR:\\ :lf=$LOGFILE:\\ :$if_or_of=$PROSHOME/pros_$PRINTER:\\ :ff=\\r\\f:\\ :sh: PROSB_PCAP_ENTRY_END test $? != 0 && error=YES ;; ftp) # FTP cat <<- FTP_PCAP_ENTRY_END | $tee -a $PRINTCAP >> $instalog $PRINTER| Network printer on $PROD_TYPE $REM_HOST_NAME using FTP:\\ :lp=$SPOOLDIR/null:\\ :sd=$SPOOLDIR:\\ :lf=$LOGFILE:\\ :of=$PROSHOME/ftp_$PRINTER:\\ :ff=\\r\\f:\\ :sh: FTP_PCAP_ENTRY_END test $? != 0 && error=YES ;; lpd) # LPD cat <<- LPD_PCAP_ENTRY_END | $tee -a $PRINTCAP >> $instalog $PRINTER| Network printer on $PROD_TYPE $REM_HOST_NAME:\\ :lp=:\\ :sd=$SPOOLDIR:\\ :lf=$LOGFILE:\\ :rm=$REM_HOST_NAME:\\ :rp=pr$REM_HOST_PRINTER: LPD_PCAP_ENTRY_END test $? != 0 && error=YES ;; esac echo >> $instalog fi if test $create_spooldir = YES; then mkdir -p $SPOOLDIR test $? != 0 && error=YES echo "Created spool directory $SPOOLDIR." >> $instalog if test $sys_type = freebsd -o $sys_type = bsd_nopipe; then chown bin $SPOOLDIR chmod 744 $SPOOLDIR fi case $print_method in prosB|ftp) # PROS B and FTP need dummy devices. touch $SPOOLDIR/null test $? != 0 && error=YES echo "Created dummy device $SPOOLDIR/null." >> $instalog if test $sys_type = freebsd -o $sys_type = bsd_nopipe; then chown bin $SPOOLDIR/null chmod 744 $SPOOLDIR/null fi ;; esac fi if test $create_logfile = YES; then if not test -d `dirname $LOGFILE`; then mkdir -p `dirname $LOGFILE` test $? != 0 && error=YES echo "Created directory `dirname $LOGFILE`." >> $instalog if test $sys_type = freebsd -o $sys_type = bsd_nopipe; then chown bin `dirname $LOGFILE` chmod 744 `dirname $LOGFILE` fi fi touch $LOGFILE test $? != 0 && error=YES echo "Created log file $LOGFILE." >> $instalog if test $sys_type = freebsd -o $sys_type = bsd_nopipe; then chown bin $LOGFILE chmod 744 $LOGFILE fi fi fi if test $compile_pros = YES; then if test $create_proshome = YES -a ! -f $PROSHOME; then mkdir -p $PROSHOME test $? != 0 && error=YES echo "Created directory $PROSHOME." >> $instalog fi prosd_options="$HOSTNAME $PROSDEV $REM_HOST_NAME pr$REM_HOST_PRINTER $PROSPWD" pwd=`pwd`; cd $PROSHOME case $print_method in prosA) # PROS A $ftp -n $REM_HOST_NAME <<- FTP_END user ftp void cd npipe binary get prosd.c quit FTP_END test $? != 0 && error=YES # --- Compilatilon of prosd differ from BSD to SYSV, and even # --- worse, it differ from one SYSV to another. case $sys_family in bsd) cc $ALWAYS_OPEN $LINK_OPT -o prosd prosd.c if test $? != 0; then error=YES start_prosd=NO else cat <<- BSD_LOGNOTE_END | cat >> $instalog Compiled prosd in directory $PROSHOME. If you want the PROS daemon to start automatically at system reboot then add the following line to /etc/rc.local: $PROSHOME/prosd $prosd_options 2> $PROSLOG 1>&2 & BSD_LOGNOTE_END fi ;; sysv) CC=cc compile_error=FirstTime altlist=" : -lsocket : -lsocket -lnsl : -linet " num_alts=4 counter=1 while test $compile_error != NO -a $counter -le $num_alts; do # --- Select one alternative of load libraries. LOADLIBES=`echo $altlist | cut -f$counter -d\:` echo "Compiling..." # --- First make a try with load libraries after source # --- and if that fail then try with them before source. $CC -o prosd prosd.c $LOADLIBES 2> /dev/null if test $? != 0; then $CC -o prosd $LOADLIBES prosd.c 2> /dev/null if test $? != 0; then compile_error=YES else compile_error=NO fi else compile_error=NO fi counter=`expr $counter + 1` done if test $compile_error != NO; then error=YES start_prosd=NO else cat <<- SYSV_LOGNOTE_END | cat >> $instalog Compiled prosd in directory $PROSHOME. If you want the PROS daemon to start automatically at system reboot then add the following line to /etc/inittab: id01::respawn:$PROSHOME/prosd $prosd_options 2> $PROSLOG 1>&2 Note! The ID string 'id01' must be four (4) characters long and individual for every entry in /etc/inittab. On some systems, the /etc/inittab file is recreated each time the system is booted, erasing the entries you just added. To cure this problem, put the added lines in a separate file in the /etc/conf/init.d directory as well. Any file name will do, such as /etc/conf/init.d/printer-init. SYSV_LOGNOTE_END fi ;; esac ;; prosB) # PROS B $ftp -n $REM_HOST_NAME <<- FTP_END user anonymous void cd $sys_family binary get pros$sys_family.c quit FTP_END test $? != 0 && error=YES case $sys_family in bsd) CC=cc CFLAGS="-DHOSTNAME=\"$HOSTNAME\" -DBOXNAME=\"$REM_HOST_NAME\" -DPRINTERNAME=\"pr$REM_HOST_PRINTER\"" $CC $CFLAGS -o pros_${PRINTER} prosbsd.c test $? != 0 && error=YES ;; sysv) CC=cc CFLAGS="-DHOSTNAME=\"$HOSTNAME\" -DBOXNAME=\"$REM_HOST_NAME\" -DPRINTERNAME=\"pr$REM_HOST_PRINTER\"" compile_error=FirstTime altlist=" : -lsocket : -lsocket -lnsl : -linet " num_alts=4 counter=1 while test $compile_error != NO -a $counter -le $num_alts; do # --- Select one alternative of load libraries. LOADLIBES=`echo $altlist | cut -f$counter -d\:` echo "Compiling..." # --- First make a try with load libraries after source # --- and if that fail then try with them before source. $CC -o pros_$PRINTER $CFLAGS prossysv.c $LOADLIBES 2> /dev/null if test $? != 0; then $CC -o pros_$PRINTER $CFLAGS $LOADLIBES prossysv.c 2> /dev/null if test $? != 0; then compile_error=YES else compile_error=NO fi else compile_error=NO fi counter=`expr $counter + 1` done test $compile_error != NO && error=YES ;; aix) cc -o prosaix -DTRY_FOREVER prosaix.c ;; esac rm -f pros${sys_family}.c if test $sys_family = aix; then echo "Compiled pros${sys_family} in directory $PROSHOME." >> $instalog else echo "Compiled pros_${PRINTER} in directory $PROSHOME." >> $instalog fi ;; ftp) # FTP $ftp -n $REM_HOST_NAME <<- FTP_END user anonymous void binary cd $sys_family get ftp_$filt_name quit FTP_END test $? != 0 && error=YES # Patch ftp filter with binary grep "binary" ftp_$filt_name > /dev/null if test $? != 0; then ed ftp_$filt_name <<- ED_END > /dev/null 1 /^user/a binary . w q ED_END fi sedcmd="/^internet_address=.*/s/.*/internet_address=$REM_HOST_NAME/" sedcmd="$sedcmd;/^logical_printer=.*/s/.*/logical_printer=pr$REM_HOST_PRINTER/" sedcmd="$sedcmd;/^ftp_path=.*/s+.*+ftp_path=$ftp+" sed -e "$sedcmd" ftp_$filt_name > ftp_${PRINTER} test $? != 0 && error=YES rm -f ftp_$filt_name chmod 755 ftp_${PRINTER} # rwx r-x r-x echo "Placed ftp_${PRINTER} in directory $PROSHOME." >> $instalog ;; esac cd $pwd fi # compile_pros if test $sys_family = aix && test $print_method = prosB; then pwd=`pwd`; cd $PROSHOME $ftp -n $REM_HOST_NAME <<- FTP_END user anonymous void cd $sys_family binary get pros_piobe quit FTP_END PROSPATH=$PROSHOME"/prosaix" sedcmd="/^internet_address=.*/s/.*/internet_address=$REM_HOST_NAME/" sedcmd="$sedcmd;/^logical_printer=.*/s/.*/logical_printer=pr$REM_HOST_PRINTER/" sedcmd="$sedcmd;/^pros_path=.*/s+.*+pros_path=$PROSPATH+" sedcmd="$sedcmd;/^hostname=.*/s/.*/hostname=$HOSTNAME/" sedcmd="$sedcmd;/^logfile=.*/s+.*+logfile=$PROSLOG+" sed -e "$sedcmd" pros_piobe > pros_${PRINTER} test $? != 0 && error=YES rm -f pros_piobe chmod 755 pros_${PRINTER} echo "Placed pros_${PRINTER} in directory $PROSHOME." >> $instalog cd $pwd fi if test $create_proslog = YES; then case $print_method in prosA) logsource="pros daemon" ;; prosB) logsource="pros filter" ;; ftp) logsource="ftp filter" ;; esac if test ! -d `dirname $PROSLOG`; then mkdir -p `dirname $PROSLOG` test $? != 0 && error=YES echo "Created $logsource log file directory `dirname $PROSLOG`. " >> $instalog fi touch $PROSLOG test $? != 0 && error=YES echo "Created $logsource log file $PROSLOG." >> $instalog if test $sys_family = aix; then chmod 666 $PROSLOG fi fi if test $create_prosdev = YES; then if test ! -d `dirname $PROSDEV`; then mkdir -p `dirname $PROSDEV` test $? != 0 && error=YES echo "Created prosd pipe directory `dirname $PROSDEV`. " >> $instalog fi if test $sys_type != freebsd; then $mknod $PROSDEV p else /usr/bin/mkfifo $PROSDEV fi test $? != 0 && error=YES case $sys_family in bsd) chmod 660 $PROSDEV # rw- rw- --- ;; sysv) chmod 600 $PROSDEV # rw- --- --- chown lp $PROSDEV ;; esac echo "Made prosd pipe $PROSDEV." >> $instalog fi if test $start_prosd = YES; then prosd_options="$HOSTNAME $PROSDEV $REM_HOST_NAME pr$REM_HOST_PRINTER $PROSPWD" nohup $PROSHOME/prosd $prosd_options 2> $PROSLOG 1>&2 & test $? != 0 && error=YES echo "Started prosd for device $PROSDEV." >> $instalog cat <<- PROSD_LOGNOTE_END | cat >> $instalog Started prosd in directory $PROSHOME with command: nohup $PROSHOME/prosd $prosd_options 2> $PROSLOG 1>&2 & PROSD_LOGNOTE_END if test $sys_family=sysv; then cat <<-PROSD_SYSV_STRT_END | cat >> $instalog If you want the PROS daemon to start automatically at system reboot then add the following line to /etc/inittab: id01::respawn:$PROSHOME/prosd $prosd_options 2> $PROSLOG 1>&2 PROSD_SYSV_STRT_END fi echo "Started prosd for device $PROSDEV." echo "See log file for more information." # --- Install the prosd startup line in /etc/inittab and place a # --- line in /etc/conf/init.d/$CAT_NAME-init. fi # start_prosd if test $stoplp = YES; then /usr/lib/lpshut if test $sys_type = hpux; then while true; do test -f /usr/spool/lp/SCHEDLOCK if test $? != 0; then break fi done fi fi if test $sys_family = sysv; then if test $sys_type = bos; then echo "Modifying /etc/config.lp with the following entries:" >> $instalog fi case $print_method in prosA) /usr/lib/lpadmin -p$HPFIX$PRINTER -m$HPFIX$MODEL -v$HPFIX$PROSDEV 2>> $instalog if test $? != 0; then lperror=YES else lperror=NO echo "installed $PRINTER with lpadmin using "$MODEL" model on device $PROSDEV." >> $instalog fi if test $sys_type = bos; then cat <<- PROSA_BOS_ENTRY_END | tee -a /etc/config.lp >> $instalog $PRINTER on $CAT_NAME $REM_HOST_NAME.pr$REM_HOST_PRINTER - m $MODEL - - - - PROSA_BOS_ENTRY_END fi ;; prosB) /usr/lib/lpadmin -p$HPFIX$PRINTER -i$HPFIX$PROSHOME/pros_$PRINTER -v$HPFIX/dev/null 2>> $instalog if test $? != 0; then lperror=YES else lperror=NO echo "installed $PRINTER with lpadmin using interface $PROSHOME/pros_$PRINTER." >> $instalog echo "device used is /dev/null (dummy device)." >> $instalog fi if test $sys_type = bos; then cat <<- PROSB_BOS_ENTRY_END | tee -a /etc/config.lp >> $instalog $PRINTER on $CAT_NAME null - i $PROSHOME/pros_$PRINTER - - - - PROSB_BOS_ENTRY_END fi ;; ftp) /usr/lib/lpadmin -p$HPFIX$PRINTER -i$HPFIX$PROSHOME/ftp_$PRINTER -v$HPFIX/dev/null 2>> $instalog if test $? != 0; then lperror=YES else lperror=NO echo "installed $PRINTER with lpadmin using interface $PROSHOME/ftp_$PRINTER." >> $instalog echo "device used is /dev/null (dummy device)." >> $instalog fi if test $sys_type = bos; then cat <<- FTP_BOS_ENTRY_END | tee -a /etc/config.lp >> $instalog $PRINTER on $CAT_NAME null - i $PROSHOME/ftp_$PRINTER - - - - FTP_BOS_ENTRY_END fi ;; lpd) if test $sys_type != hpux; then lpsystem -t bsd $REM_HOST_NAME >> $instalog if test $? != 0; then lperror=YES else lperror=NO echo "used lpsystem to add(modify) an entry for $REM_HOST_NAME in /etc/lp/Systems" >> $instalog fi fi case $sys_type in hpux) /usr/lib/lpadmin -p$HPFIX$PRINTER -v$HPFIX/dev/null -orm$HPFIX$REM_HOST_NAME -orp$HPFIX"pr"$REM_HOST_PRINTER -m$HPFIX"rmodel" >> $instalog ;; *) /usr/lib/lpadmin -p$HPFIX$PRINTER -s$HPFIX$REM_HOST_NAME!pr$REM_HOST_PRINTER -I$HPFIX"any" >> $instalog ;; esac if test $? != 0; then lperror=YES else lperror=NO echo "installed $PRINTER with lpadmin using remote system name $REM_HOST_NAME and" >> $instalog echo " remote printer name pr$REM_HOST_PRINTER" >> $instalog fi ;; esac fi # sys_family = sysv if test $stoplp = YES; then /usr/lib/lpsched fi if test $sys_family = sysv; then test $lperror = NO && /usr/lib/accept $PRINTER test $lperror = NO && /usr/bin/enable $PRINTER test $lperror = YES && error=YES fi if test $sys_family = aix; then test $print_method = prosB && print_method=pros case $print_method in pros | ftp) ln /dev/null /dev/$PRINTER'd' if test $? = 0; then echo "linked printer device /dev/"$PRINTER"d to /dev/null" >> $instalog else error=YES fi if test $error = NO; then mkque -q $PRINTER if test $? = 0; then echo "used mkque:" >> $instalog echo " local queue is "$PRINTER >> $instalog else error=YES rm /dev/$PRINTER'd' fi fi if test $error = NO; then mkquedev -d $PRINTER'd' -q $PRINTER -a 'backend = '$PROSHOME'/'$print_method'_'$PRINTER'' if test $? = 0; then echo "used mkquedev:" >> $instalog echo " created queue device "$PRINTER"d" >> $instalog echo " backend is "$PROSHOME"/"$print_method"_"$PRINTER >> $instalog else error=YES rm /dev/$PRINTER'd' rmque -q $PRINTER fi fi if test $error = NO; then mkvirprt -d $PRINTER'd' -n $PRINTER'd' -q $PRINTER -s $aix_stream -t $aix_printer if test $? = 0; then echo "used mkvirprt:" >> $instalog echo " created virtual printer $PRINTER" >> $instalog echo " data stream type $aix_stream, printer type $aix_printer" >> $instalog else error=YES rm /dev/$PRINTER'd' rmquedev -q $PRINTER -d $PRINTER'd' rmque -q $PRINTER fi fi ;; lpd) mkque -q$PRINTER -a"up = "'TRUE' -a"host = "$REM_HOST_NAME\ -a"s_statfilter = "'/usr/lpd/bsdshort'\ -a"l_statfilter = "'/usr/lpd/bsdlong'\ -a"rq = "'pr'$REM_HOST_PRINTER if test $? = 0; then echo "used mkque:" >> $instalog echo " created remote printer queue $PRINTER" >> $instalog echo " destination host is $REM_HOST_NAME" >> $instalog echo " remote queue is pr"$REM_HOST_PRINTER >> $instalog mkquedev -q$PRINTER -d$PRINTER'd'\ -a"backend = "'/usr/lpd/rembak' if test $? = 0; then echo "used mkquedev:" >> $instalog echo " created remote printer queue device "$PRINTER"d" >> $instalog else error=YES fi else error=YES fi ;; esac fi # sys_family = aix; echo >> $instalog if test $error = NO; then echo "Installation of printer $PRINTER done." >> $instalog echo "Installation of printer $PRINTER done." echo yes_or_noP "Do you want a test printout" y if test $yes_or_no = YES; then case $sys_family in bsd) echo | tr '\012' '\014' | cat $instalog - | lpr -P$PRINTER ;; sysv) echo | tr '\012' '\014' | cat $instalog - | lp -d$HPFIX$PRINTER ;; aix) echo | tr '\012' '\014' | cat $instalog - | qprt -P$PRINTER ;; esac fi else echo "Installation of printer $PRINTER FAILED." >> $instalog echo "Installation of printer $PRINTER FAILED." fi echo >> $instalog echo # Not to log file fi # do_install yes_or_noP "Do you want to install more printers" n more_printers=$yes_or_no done # while more_printers echo "An installation log is saved in the file $instalog." exit