Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Imprimer sur une imprimante affulbléed'un boîtier réseau

10 réponses
Avatar
Phinous
Bonjour,

Je m'adresse à vous car je suis confronté à un problème qui n'est
même pas sûr d'être résolvable !
En espérant rencontrer quelques pro de la configuration Linux ici ;)

Voici ma configuration :
- petit LAN avec un HUB
- un Mac sous MacOSX
- un PC sous Linux (Ubuntu)
- un portable sous Windows
- une imprimante HP Laserjet 4L connectée au LAN grace à un boîtier
Axis 540+

L'imprimante (ou plutôt le boîtier Axis) a la'dresse IP 10.0.0.50
Le Mac et le portable sous Windows impriment sans pb dessus

Le pb, c'est que je n'ai pas été fichu de la faire fonctionne sous Linux !!
J'étais avant sous Mandrake et je n'y étais déjà pas parvenu :(

Un boîtier Axis se rapprochant d'un boîtier JetDirect de chez HP, j'ai
bien tenté de mettre l'adresse IP du boîtier ainsi qu'un port à
attaquer, mais rien n'y fait. Peut-être que je me plante dans le port à
utiliser, mais j'ai essayé 9100 (HP jetdirect), 427 et 515 (2 ports
ouverts sur mon boîtier Axis).
Comme ça ne marchait pas, j'ai essayé une imprimante réseau UNIX (LPD)
avec 10.0.0.50 comme hôte, et idem comme file d'impression : tjrs aucun
signe de vie de l'imprimante lors de l'envoi d'une page de test :o/

Donc auriez-vous une idée pour faire marcher cette imprimante/boîter
Axis sous Linux ?

Merci pour votre aide :)

10 réponses

Avatar
Khanh-Dang
[Boitier Axis 540+]
Donc auriez-vous une idée pour faire marcher cette imprimante/boîter
Axis sous Linux ?


Cherche d'abord quels protocoles sont acceptés par ce boîtier. C'est de
manière quasi certaine documenté dans le manuel fourni avec.

Avatar
Jerome Lambert
Phinous wrote:
Bonjour,


Bonjour,

Je m'adresse à vous car je suis confronté à un problème qui n'est
même pas sûr d'être résolvable !
En espérant rencontrer quelques pro de la configuration Linux ici ;)

Voici ma configuration :
- petit LAN avec un HUB
- un Mac sous MacOSX
- un PC sous Linux (Ubuntu)
- un portable sous Windows
- une imprimante HP Laserjet 4L connectée au LAN grace à un boîtier
Axis 540+

L'imprimante (ou plutôt le boîtier Axis) a la'dresse IP 10.0.0.50
Le Mac et le portable sous Windows impriment sans pb dessus

Le pb, c'est que je n'ai pas été fichu de la faire fonctionne sous Linux !!
J'étais avant sous Mandrake et je n'y étais déjà pas parvenu :(

Un boîtier Axis se rapprochant d'un boîtier JetDirect de chez HP, j'ai
bien tenté de mettre l'adresse IP du boîtier ainsi qu'un port à
attaquer, mais rien n'y fait. Peut-être que je me plante dans le port à
utiliser, mais j'ai essayé 9100 (HP jetdirect), 427 et 515 (2 ports
ouverts sur mon boîtier Axis).
Comme ça ne marchait pas, j'ai essayé une imprimante réseau UNIX (LPD)
avec 10.0.0.50 comme hôte, et idem comme file d'impression : tjrs aucun
signe de vie de l'imprimante lors de l'envoi d'une page de test :o/


Je ne connais pas Ubuntu ni ce boitier.
Je te conseillerais d'utiliser le machine cliquable de ta distribution
et de le laisser se débrouiller pour trouver le port. Si elle est bien
faite, elle trouvera pour toi...

Jerome.

Avatar
Phinous
Cherche d'abord quels protocoles sont acceptés par ce boîtier. C'est de
manière quasi certaine documenté dans le manuel fourni avec.


En fouillant dans la doc, j'ai trouvé un truc par rapport à Unix (les
boîtier Axis ne sont pas tout jeune) ----->
http://spheeris.free.fr/images/axis.png

Et voici ci-dessous le fichier axinstall dont ils parlent.
Lorsque je le lance j'ai une erreur : "bad interpreter: Aucun fichier ou
répertoire de ce type"


#!/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.3 Mar 31 1998"
#
#
-----------------------------------------------------------------------------
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

#
-----------------------------------------------------------------------------

# set_path_to prog path1 path2 ...
# Find the path to a program
# $1 is the program
# $2-$9 are the paths to the program
set_path_to set_path_toP()
{
set_path_to for path in $2 $3 $4 $5 $6 $7 $8 $9; do
if test -x "$path/$1"; then
set_path_to="$path/$1"
break
fi
done
}

clear mknod cut tee
which=which
test -x /usr/bin/which && which=/usr/bin/which

# Try to run which. If it exists, find paths to the commands below using it.
$which
if test $? = 0; then
clear=`$which clear`
mknod=`$which mknod`
cut=`$which cut`
tee=`$which tee`
fi

if test "X$clear" = "X"; then
set_path_toP clear /usr/bsd /usr/ucb /bin /usr/bin
clear=$set_path_to
fi

if test "X$mknod" = "X"; then
set_path_toP mknod /usr/etc /etc /etc/sbin /bin
mknod=$set_path_to
fi

if test "X$cut" = "X"; then
set_path_toP cut /usr/bin /bin
cut=$set_path_to
fi

if test "X$tee" = "X"; then
set_path_toP cut /usr/bin /bin
cut=$set_path_to
fi

ftp set_path_toP ftp /usr/bsd /usr/ucb /usr/bin /bin
ftp=$set_path_to

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 <command> do boolean negation on return value of <command>.

not()
{
if $*; then
false; return
else
true; return
fi
}

#-- print_methodP [methods] -- Prompt for the print method to use

prompt_print_method prompt_print_methodP ()
# $1 is the default method to choose,
# the rest ($2 .. $#) is the other methods that can be used
# A maximum of nine methods can be handled
# Currently, ftp, lpd, prosA and prosB are supported
# Example: print_methodP lpd ftp prosA
{
# Give these variables values that cannot be matched by case
# These will be set to 1..$# if they are present in the parameters
print_method_lpd=ZZZZ
print_method_ftp=ZZZZ
print_method_prosA=ZZZZ
print_method_prosB=ZZZZ

# Print the menu, one line for each parameter
# numbers range from 0 to $#
for print_method_num in 1 2 3 4 5 6 7 8 9; do

# Decide what method the $print_method_num:th parameter is
# set $print_method_* to the current number
# and set the method string to be written in the menu
eval "print_method_is=$$print_method_num"
case $print_method_is in
lpd)
print_method_suffix="LPD"
print_method_lpd=$print_method_num
;;
ftp)
print_method_suffix="FTP"
print_method_ftp=$print_method_num
;;
prosA)
print_method_suffix="PROS A"
print_method_prosA=$print_method_num
;;
prosB)
print_method_suffix="PROS B"
print_method_prosB=$print_method_num
;;
*)
echo "Internal Error: Print method not supported ($print_method_is)"
exit 1
;;
esac

# Echo one menu item
echo " $print_method_num......$print_method_suffix"

# If we have printed all items, exit loop
if test $print_method_num -eq $#; then
break # out of loop
fi
done

# Read which item that the user selects
echo
class_answerP "Enter choice" "[1-$#]" 1

# Match the answer to a method
case $class_answer in
$print_method_lpd)
prompt_print_method=lpd
;;
$print_method_ftp)
prompt_print_method=ftp
;;
$print_method_prosB)
prompt_print_method=prosB
;;
$print_method_prosA)
prompt_print_method=prosA
;;
*)
echo "Internal Error: Bad case: $class_answer"
exit 1
;;
esac
} # print_methodP


# --- 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 requires 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)"

# Use these constants to identify the systems below
NO_SYS=0
SUN4_n=1
SUN5_n=2
AIX_n=3
HPUX_n=4
BOS_n=5
OSF1_n=6
ULTRIX_n=7
SGI_n=8
SCO_n=9
FreeBSD_n
BSD_n
SYSV3_n
SYSV4_n
MAX_SYS_n

altlist="SunOS 4zSunOS 5zAIXzHP-UXzB.O.S. zOSF1zULTRIXzIRIXzFreeBSD"
num_alts=9

osfound=NO
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

# BSD has a printcap file but no lpadmin program
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

# SYSV has lpadmin and no printcap
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=$SUN4_n
;;
"SunOS 5")
str2=$SUN5_sys
sys_type=$SUN5_n
;;
"AIX")
str2=$AIX_sys
sys_type=$AIX_n
;;
"HP-UX")
str2=$HPUX_sys
sys_type=$HPUX_n
;;
"B.O.S. ")
str2=$BOS_sys
sys_type=$BOS_n
;;
"OSF1")
str2=$OSF1_sys
sys_type=$OSF_n
;;
"ULTRIX")
str2=$ULTRIX_sys
sys_type=$ULTRIX_n
;;
"IRIX")
str2=$SGI_sys
sys_type=$SGI_n
;;
"SCO")
str2=$SCO_sys
sys_type=$SCO_n
;;
"FreeBSD")
str2=$FreeBSD_sys
sys_type=$FreeBSD_n
;;
"BSD")
str2=$BSD_sys
sys_type=$BSD_n
;;
"SYSV3")
str2=$SYSV3_sys
sys_type=$SYSV3_n
;;
"SYSV4")
str2=$SYSV4_sys
sys_type=$SYSV4_n
;;
*)
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?

$SUN4_n....$SUN4_sys
$SUN5_n....$SUN5_sys
$AIX_n....$AIX_sys
$HPUX_n....$HPUX_sys
$BOS_n....$BOS_sys
$OSF1_n....$OSF1_sys
$ULTRIX_n....$ULTRIX_sys
$SGI_n....$SGI_sys
$SCO_n....$SCO_sys
$FreeBSD_n...$FreeBSD_sys

$BSD_n...$BSD_sys
$SYSV3_n...$SYSV3_sys
$SYSV4_n...$SYSV4_sys

$NO_SYS....Quit this program

SYS_TYPE_END

range_answerP "Enter choice" "[$NO_SYS-$MAX_SYS_n]" $NO_SYS
sys_type=$range_answer
fi

# SGI may have a BSD spooler as well
if test $sys_type = $SGI_n; 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
$SUN4_n|$OSF1_n|$BSD_n) # Sun OS 4, OSF1, BSD
sys_family=bsd
sys_type=bsd
filt_name=bsd
ULTRIXFIX stoplp=NO
;;
$SUN5_n) # Sun OS 5.x
sys_family=sysv
sys_type=sysv4
filt_name=sysv
SHELL=/bin/sh # for the benefit of lpadmin.
HPFIX=" "
MODEL="standard"
stoplp=NO
$mknod /tmp/nisse_$$ p 2>/dev/null
if test $? != 0; then
sys_type=sun5
echo
echo " Your system does not support FIFOs, PROS A cannot be
used."
fi
rm /tmp/nisse_$$

;;
$AIX_n) # AIX (IBM AIX 3)
sys_family=aix
sys_type=aix
filt_name=piobe
stoplp=NO
;;
$HPUX_n) # 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
;;
$BOS_n) # BOS (BULL DPX 2)
sys_family=sysv
sys_type=bos
filt_name=sysv
SHELL=/bin/sh
HPFIX MODEL="dumb"
stoplp=YES
;;
$ULTRIX_n) # 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).
;;
$SGI_n) # SGI
sys_family=sysv
sys_type=sgi
filt_name=sysv
SHELL=/bin/sh
HPFIX MODEL="dumb"
stoplp=YES
;;
$FreeBSD_n) # 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 system does not support FIFOs, PROS A cannot be
used."
fi
rm /tmp/nisse_$$
;;
$SYSV3_n|$SCO_n) # SYS V3, SCO
sys_family=sysv
sys_type=sysv3
filt_name=sysv
SHELL=/bin/sh
HPFIX=" "
MODEL="standard"
stoplp=YES
;;
$SYSV4_n) # SYS V4
sys_family=sysv
sys_type=sysv4
filt_name=sysv
SHELL=/bin/sh
HPFIX=" "
MODEL="standard"
stoplp=NO
;;
$NO_SYS) # No system, exit
echo "Exit axinstall"
exit 1
;;
*) # Other (unknown).
echo "Internal error: Unknown OS type ($sys_type)"
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)
echo "Select a print method from the list below."
echo "The recommended basic print method is LPD, for more advanced "
echo "functionality and status feedback use PROS."

prompt_print_methodP lpd ftp prosA prosB
print_method=$prompt_print_method
;;

sun5|bsd_nopipe)
echo "Select a print method from the list below."
echo "The recommended basic print method is LPD, for more advanced "
echo "functionality and status feedback use PROS."

prompt_print_methodP lpd ftp prosB
print_method=$prompt_print_method
;;

sysv3|sgi|bos)
echo "Select a print method from the list below."
echo "The recommended basic print method is FTP, for more advanced "
echo "functionality and status feedback use PROS."

prompt_print_methodP ftp prosB prosA
print_method=$prompt_print_method
;;

aix)
echo "Select a print method from the list below."
echo "The recommended basic print method is LPD, for more advanced "
echo "functionality and status feedback use PROS."

prompt_print_methodP lpd ftp prosB
print_method=$prompt_print_method
;;
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


# --- Here starts the installation loop ----
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

# --- Install print methods -------------------
case $print_method in

# ----- PROSA ----
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 ----
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 ----
ftp)
path_answerP "Enter FTP filter directory: " $PROSHOME
test X$PROSHOME != X$path_answer && create_proshome=YES
PROSHOME=$path_answer
;;
esac # Case print method

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

# ---------- Done barfing configuration ----------------------

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

# Install the systems
case $sys_type in

# CASE BSD
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
;;

# CASE SYSV
sysv3 | sysv4 | sun5 | hpux | sgi | bos)
/usr/bin/lpstat -p$HPFIX$PRINTER > /dev/null
if test $? = 0; then
echo "Printer $PRINTER is already present in the system"
more_changes=YES
fi
;;

# CASE AIX
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 # Case system

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=rf:
: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=rf:
: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Ì
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Ì
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Ì
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 '12' '14' | cat $instalog - | lpr -P$PRINTER
;;
sysv)
Avatar
Phinous
Je te conseillerais d'utiliser le machine cliquable de ta distribution
et de le laisser se débrouiller pour trouver le port. Si elle est bien
faite, elle trouvera pour toi...


Qu'est-ce donc qu'une "machine cliquable" ?

Avatar
Jerome Lambert
Phinous wrote:
Je te conseillerais d'utiliser le machine cliquable de ta distribution
et de le laisser se débrouiller pour trouver le port. Si elle est bien
faite, elle trouvera pour toi...



Qu'est-ce donc qu'une "machine cliquable" ?


Un *machin* (faute de frappe).

Un assistant d'ajout d'imprimante ou quelque chose du genre. D'après la
doc de ce boitier, ils suggèrent de l'utiliser et de le laisser faire.
Sur mes imprimantes (via des boitiers JetDirect il est vrai), j'ai juste
à entrer l'ip du boitier et l'assistant Fedora ou Mandrake se débrouille
avec, et ma foi il y arrive fort bien.


Avatar
Khanh-Dang
[boitier Axis 540 pour impression réseau]
Et voici ci-dessous le fichier axinstall dont ils parlent.

#!/bin/sh
[snip contenu du long script]


La netiquette ne voit pas d'un très bon oeil les posts aussi long.

Quoi qu'il en soit, tu ne devrait pas installer ton imprimante via ce
script. Je l'ai parcouru rapidement, et apparemment, il ne gère que les
systèmes UNIX propriétaires et NetBSD. Je ne pense que ce soit une bonne
idée de vouloir le lancer sur une distribution Linux.

De plus, l'examen du script révèle que l'imprimante (le boitier plutôt)
supporte plusieurs protocoles, dont lpd, qui est très utilisé. J'ai
aussi vu ftp (je suppose intuitivement qu'il y a un spool sur
l'imprimante, accessible par protocole ftp).

Bref, il ne devrait pas être insurmontable de configurer une impression
sachant que le protocole lpd est utilisé.

Tu devrais normalement utiliser un moteur de recherche pour trouver la
documentation nécessaire. Je suis gentil, je te mâche le début du
travail :
http://www.freenix.fr/unix/linux/HOWTO/Printing-HOWTO.html

Lis ce document en entier, sachant que c'est la section 12.1 qui devrait
particulièrement t'intéresser.

Avatar
Phinous
Un assistant d'ajout d'imprimante ou quelque chose du genre. D'après la
doc de ce boitier, ils suggèrent de l'utiliser et de le laisser faire.
Sur mes imprimantes (via des boitiers JetDirect il est vrai), j'ai juste
à entrer l'ip du boitier et l'assistant Fedora ou Mandrake se débrouille
avec, et ma foi il y arrive fort bien.


OK je comprends mieux. Je ne doute pas une seconde qu'avec les boîtier
Jetdirect, l'installation soit aussi aisée.
Malheureusement il semble y avoir une subtilité qui m'échappe avec les
boîtier Axis, car une fois l'imprimante installée, aucune page de test
ne veut sortir :o/

Avatar
Jerome Lambert
Phinous wrote:
Un assistant d'ajout d'imprimante ou quelque chose du genre. D'après la
doc de ce boitier, ils suggèrent de l'utiliser et de le laisser faire.
Sur mes imprimantes (via des boitiers JetDirect il est vrai), j'ai juste
à entrer l'ip du boitier et l'assistant Fedora ou Mandrake se débrouille
avec, et ma foi il y arrive fort bien.



OK je comprends mieux. Je ne doute pas une seconde qu'avec les boîtier
Jetdirect, l'installation soit aussi aisée.
Malheureusement il semble y avoir une subtilité qui m'échappe avec les
boîtier Axis, car une fois l'imprimante installée, aucune page de test
ne veut sortir :o/


D'après la doc trouvée sur le net, il n'est pas nécessaire de renseigner
le port (?).

Sinon, essaye de taper http://ip_du_boitier ou de trifouiller dans les
paramètres des imprimantes sous Windows et MacOS pour voir si ce foutu
port n'apparait pas quelque part...

Au pire, nmap permet de connaitre les ports ouverts...


Avatar
Phinous
Sinon, essaye de taper http://ip_du_boitier ou de trifouiller dans les
paramètres des imprimantes sous Windows et MacOS pour voir si ce foutu
port n'apparait pas quelque part...

Au pire, nmap permet de connaitre les ports ouverts...


Bah écoute je ne comprends pas, masi ça marche !
J'ai fait un nmap qui ma confirmé que le port 9100 est en effet ouvert
sur le boitier.
j'ai supprimé et réinstallé l'imprimante 2 fois et la deuxième fois ça a
marché !
Le paramétrage qui fonctionne est donc bien HP Jetdirect avec :
- host : 10.0.0.50
- port : 9100

Merci pour vos différentes réponse :)

Avatar
Phinous
La netiquette ne voit pas d'un très bon oeil les posts aussi long.
Oui en effet, j'aurai pu le mettre en téléchargement.



Tu devrais normalement utiliser un moteur de recherche pour trouver la
documentation nécessaire. Je suis gentil, je te mâche le début du
travail :
http://www.freenix.fr/unix/linux/HOWTO/Printing-HOWTO.html

Lis ce document en entier, sachant que c'est la section 12.1 qui devrait
particulièrement t'intéresser.


Merci mais ça ira : la config Jetdirect s'est mystérieusement mise à
fonctionner