File: test_ppa

package info (click to toggle)
pnm2ppa 1.13-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,748 kB
  • sloc: ansic: 7,504; sh: 4,222; makefile: 125; python: 8
file content (244 lines) | stat: -rwxr-xr-x 6,843 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#!/bin/sh
# test_ppa v 1.03
# designed for Red Hat Linux systems
BINDIR=/usr/bin
CONFIG_DIR=/etc

echo  "*** Test/Calibration page printing utility for HP DeskJet PPA printers"
echo  "    Give PPA printer model ( 710 | 712 | 720 | 722 | 820 | 1000 ):"

read response
printer=""

if   $(echo $response | grep -e "710" > /dev/null ) ; then printer=710
elif $(echo $response | grep -e "712" > /dev/null ) ; then printer=710
elif $(echo $response | grep -e "720" > /dev/null ) ; then printer=720
elif $(echo $response | grep -e "722" > /dev/null ) ; then printer=720
elif $(echo $response | grep -e "820" > /dev/null ) ; then printer=820
elif $(echo $response | grep -e "1000" > /dev/null ) ; then printer=1000
fi

if [ "$printer" = "" ] ; then 
   echo "*** Error: printer model $response is not a valid PPA printer"
   exit 0
fi

echo  "    Give desired paper size ( letter | legal | a4 ):"
read response
paper=""

case $response in letter | Letter | us | US )
	paper="letter"
        page="/usr/lib/rhs/rhs-printfilters/testpage.ps"
	;;
esac

case $response in legal | Legal  )
	paper="legal"
        page="/usr/lib/rhs/rhs-printfilters/testpage.ps"
	;;
esac

case $response in a4 | A4 )
	paper="a4"
        page="/usr/lib/rhs/rhs-printfilters/testpage-a4.ps"
	;;
esac

if [ "$paper" = "" ] ; then 
   echo "*** Error: $response is not a valid paper size"
   exit 0
fi

echo  "    Give desired printer port /dev/lpn, n = (0 | 1 | 2):"
read response

port="INVALID PORT"
case $response in  0 | 1 | 2 )
     port="/dev/lp$response"
     ;;
esac
case $response in  "/dev/lp0" | "/dev/lp1" | "/dev/lp2" )
     port=$response
     ;;
esac

if ! [ -e "$port" ] ; then
    echo "*** Error: printer port $port does not exist"
    exit 0
fi


GSDEVICE=ppmraw
DRIVER=pnm2ppa 
CALIB=calibrate_ppa
CFG=$pnm2ppa_conf
OPTS="--verbose"


color=""
if [ "$DRIVER" = "pnm2ppa" ] ; then
    echo " *** pnm2ppa can print in color or black-and-white"
    echo "     test in color (1) or black-and-white (2)? [1 | 2] (1):"
    read response 
    if [ "$response" = "2" ] ; then
	color="--bw"
    fi
fi


if ! [ -f $BINDIR/$DRIVER ] ; then
    echo "*** Error: $BINDIR/$DRIVER was not found"
    echo " is it correctly installed?"
    exit 0
fi

if ! $(eval "which $DRIVER | grep -e $BINDIR/$DRIVER >/dev/null 2>&1 " ) ; then
    echo "*** WARNING: the PPA driver  $DRIVER found in your path "
    echo "    is not $BINDIR/$DRIVER; \"which $DRIVER\" reports:"
    which $DRIVER
    echo "    move or delete this other copy of $DRIVER (exit) "
    exit 0
fi

CFG=$CONFIG_DIR/${DRIVER}.conf
if [ -f $CFG ] ; then
    echo " ***  Configuration file $CFG will be used "
    cfg="-f $CFG"
else
    echo  " *** No configuration file $CFG found"
    cfg=""
fi

if  [ -f $page ] ; then
    echo " *** Do you wish to print a  test page ? [Y | N] (N):"   
    read response
    case $response in y | Y | yes | Yes )
	eval "cat $page | gs -q \
	-sDEVICE=$GSDEVICE -dNOPAUSE -r600 -sPAPERSIZE=$paper \
	-sOutputFile=- -|  $BINDIR/$DRIVER  $OPTS -v $printer $cfg $color -s $paper \
	 - - > $port"
	;;
    esac
fi

echo " *** Do you wish to print the offset calibration  page ? [Y | N] (N):"   
read response
case $response in y | Y | yes | Yes )
    if ! [ -f $BINDIR/$CALIB ] ; then
	echo "*** Error: $BINDIR/$CALIB was not found"
	echo " is it correctly installed?"
	exit 0
    fi

    if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
	echo "*** WARNING: the calibration program $CALIB found in your path "
	echo "    is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
	which $CALIB
	echo "    move or delete this other copy of $CALIB (exit) "
	exit 0
    fi

    echo "   see the file CALIBRATION.txt for details of its use"
    echo " "
    eval "$CALIB -s $paper --center | $BINDIR/$DRIVER $OPTS -v $printer $cfg --bw \
    - -  > $port"
   ;;
esac


echo " *** Do you wish to print the alignment calibration  page ? [Y | N] (N):"   
read response
case $response in y | Y | yes | Yes )
    if ! [ -f $BINDIR/$CALIB ] ; then
	echo "*** Error: $BINDIR/$CALIB was not found"
	echo " is it correctly installed?"
	exit 0
    fi

    if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
	echo "*** WARNING: the calibration program $CALIB found in your path "
	echo "    is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
	which $CALIB
	echo "    move or delete this other copy of $CALIB (exit) "
	exit 0
    fi

    echo "   see the file CALIBRATION.txt for details of its use"
    eval "$CALIB -s $paper --align | $BINDIR/$DRIVER $OPTS -v $printer $cfg --fd \
    - -  > $port"
   ;;
esac


echo " *** Do you wish to print the alignment test  page ? [Y | N] (N):"   
read response
case $response in y | Y | yes | Yes )
    if ! [ -f $BINDIR/$CALIB ] ; then
	echo "*** Error: $BINDIR/$CALIB was not found"
	echo " is it correctly installed?"
	exit 0
    fi

    if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
	echo "*** WARNING: the calibration program $CALIB found in your path "
	echo "    is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
	which $CALIB
	echo "    move or delete this other copy of $CALIB (exit) "
	exit 0
    fi

    echo "   see the file CALIBRATION.txt for details of its use"
    eval "$CALIB -s $paper --test | $BINDIR/$DRIVER $OPTS -v $printer $cfg --fd \
    - -  > $port"
   ;;
esac


echo " *** Do you wish to print a color-ink  head-cleaning  page ? [Y | N] (N):"   
read response
case $response in y | Y | yes | Yes )
    if ! [ -f $BINDIR/$CALIB ] ; then
	echo "*** Error: $BINDIR/$CALIB was not found"
	echo " is it correctly installed?"
	exit 0
    fi

    if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
	echo "*** WARNING: the calibration program $CALIB found in your path "
	echo "    is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
	which $CALIB
	echo "    move or delete this other copy of $CALIB (exit) "
	exit 0
    fi

    echo "   see the file CALIBRATION.txt for details of its use"
    eval "$CALIB -s $paper --clean | $BINDIR/$DRIVER $OPTS -v $printer $cfg -p \
    - -  > $port"
   ;;
esac



echo " *** Do you wish to print a black-ink head-cleaning  page ? [Y | N] (N):"   
read response
case $response in y | Y | yes | Yes )
    if ! [ -f $BINDIR/$CALIB ] ; then
	echo "*** Error: $BINDIR/$CALIB was not found"
	echo " is it correctly installed?"
	exit 0
    fi

    if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
	echo "*** WARNING: the calibration program $CALIB found in your path "
	echo "    is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
	which $CALIB
	echo "    move or delete this other copy of $CALIB (exit) "
	exit 0
    fi

    echo "   see the file CALIBRATION.txt for details of its use"
    eval "$CALIB -s $paper --clean | $BINDIR/$DRIVER $OPTS -v $printer $cfg --bw \
    - -  > $port"
   ;;
esac