~ubuntu-branches/ubuntu/trusty/brother-cups-wrapper-laser/trusty

« back to all changes in this revision

Viewing changes to scripts/cupswrapperHL5240-2.0.1

  • Committer: Bazaar Package Importer
  • Author(s): Saïvann Carignan
  • Date: 2008-02-15 10:07:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080215100722-h1byi95bycfch7bw
Tags: upstream-2.0.1-2
Import upstream version 2.0.1-2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
#
 
3
# Brother Print filter
 
4
# Copyright (C) 2005 Brother. Industries, Ltd.
 
5
 
 
6
# This program is free software; you can redistribute it and/or modify it
 
7
# under the terms of the GNU General Public License as published by the Free
 
8
# Software Foundation; either version 2 of the License, or (at your option)
 
9
# any later version.
 
10
#
 
11
# This program is distributed in the hope that it will be useful, but WITHOUT
 
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
14
# more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License along with
 
17
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
18
# Place, Suite 330, Boston, MA  02111-1307  USA
 
19
#
 
20
 
 
21
if [ "$1" = '-e' ]; then
 
22
  lpadmin -x HL5240
 
23
  rm -f /usr/share/cups/model/HL5240.ppd
 
24
  rm -f /usr/lib/cups/filter/brlpdwrapperHL5240
 
25
  rm -f /usr/lib64/cups/filter/brlpdwrapperHL5240
 
26
  rm -f /usr/local/Brother/cupswrapper/brcupsconfig3
 
27
  if [ -e /etc/init.d/cups ]; then
 
28
    /etc/init.d/cups restart
 
29
  fi
 
30
  if [ -e /etc/init.d/cupsys ]; then
 
31
    /etc/init.d/cupsys restart
 
32
  fi
 
33
  exit 0 
 
34
fi
 
35
if [ "$1" = "-r" ]; then
 
36
  lpadmin -x HL5240
 
37
  if [ -e /etc/init.d/cups ]; then
 
38
    /etc/init.d/cups restart
 
39
  fi
 
40
  if [ -e /etc/init.d/cupsys ]; then
 
41
    /etc/init.d/cupsys restart
 
42
  fi
 
43
  exit 0 
 
44
fi
 
45
if [ "$1" = "help" ] || [ "$1" = "-h" ]; then
 
46
  echo   'option -h : help'
 
47
  echo   '       -i : install'
 
48
  echo   '       -e : uninstall'
 
49
  echo   '       -r : remove printer'
 
50
  exit 0
 
51
fi
 
52
mkdir -p /usr/local/Brother/filter
 
53
mkdir -p /usr/lib/cups/filter
 
54
 
 
55
if [ -e "/usr/local/Brother/lpd/filterHL5240" ]; then
 
56
  :
 
57
else
 
58
  echo "ERROR : Brother LPD filter is not installed."
 
59
fi
 
60
rm -f /usr/share/cups/model/HL5240.ppd
 
61
ppd_file_name=/usr/share/cups/model/HL5240.ppd
 
62
 
 
63
cat <<ENDOFPPDFILE >$ppd_file_name
 
64
*PPD-Adobe: "4.3"
 
65
*%================================================
 
66
*%      Copyright(C) 2006 Brother Industries, Ltd.
 
67
*%      "Brother HL5240 for CUPS"
 
68
*%================================================
 
69
 
 
70
*%==== General Information Keywords ========================
 
71
*FormatVersion: "4.3"
 
72
*FileVersion: "1.00"
 
73
*LanguageEncoding: ISOLatin1
 
74
*LanguageVersion: English
 
75
*Manufacturer: "Brother"
 
76
*PCFileName: "HL5240.PPD"
 
77
*Product: "(Brother HL5240 series)"
 
78
*cupsVersion:   1.1
 
79
*cupsManualCopies: True
 
80
*cupsModelNumber:       72
 
81
*cupsFilter: "application/vnd.cups-postscript 0 brlpdwrapperHL5240"
 
82
*PSVersion: "(3010.106) 3"
 
83
*ModelName: "HL5240"
 
84
*NickName: "Brother HL5240 for CUPS"
 
85
*ShortNickName: "Brother HL5240 for CUPS"
 
86
 
 
87
*%==== Basic Device Capabilities =============
 
88
*LanguageLevel: "3"
 
89
*TTRasterizer: Type42
 
90
*ColorDevice: False
 
91
*DefaultColorSpace: Gray
 
92
*FileSystem: True
 
93
*?FileSystem:"
 
94
save 
 
95
        /devname (%disk0%) def 
 
96
        /ret false def 
 
97
        0 1 7{ 
 
98
                devname exch 48 add 5 exch put 
 
99
                devname devstatus { 
 
100
                        0 ne {/ret true def}if 
 
101
                        pop pop pop pop pop pop pop 
 
102
                }if 
 
103
        }for 
 
104
        ret {(True)}{(False)} ifelse = flush 
 
105
restore 
 
106
 
107
*End
 
108
 
 
109
*Throughput: "18"
 
110
*FreeVM: "1700000"
 
111
 
 
112
*%==== Installable Options ===================
 
113
 
 
114
*OpenGroup: InstallableOptions/Options Installed
 
115
 
 
116
*OpenUI *OptionTrays/Number of Input Trays: PickOne
 
117
*DefaultOptionTrays: 2Trays
 
118
*OptionTrays 1Trays/ 1: ""
 
119
*OptionTrays 2Trays/ 2: ""
 
120
*OptionTrays 3Trays/ 3: ""
 
121
*?OptionTrays:"
 
122
save
 
123
        <</BRFeeder 1>>setpagedevice currentpagedevice/BRFeeder get
 
124
        1 eq{(2Trays)}{(1Trays)}ifelse
 
125
        = flush 
 
126
restore 
 
127
"
 
128
*End
 
129
*CloseUI: *OptionTrays
 
130
 
 
131
*CloseGroup: InstallableOptions
 
132
 
 
133
*UIConstraints: *OptionTrays 1Trays *InputSlot Tray2
 
134
*UIConstraints: *OptionTrays 1Trays *InputSlot Tray3
 
135
*UIConstraints: *OptionTrays 1Trays *InputSlot Tray4
 
136
*UIConstraints: *OptionTrays 2Trays *InputSlot Tray3
 
137
*UIConstraints: *OptionTrays 2Trays *InputSlot Tray4
 
138
*UIConstraints: *OptionTrays 3Trays *InputSlot Tray4
 
139
 
 
140
*%==== Media Selection ======================
 
141
 
 
142
*OpenUI *PageSize: PickOne
 
143
*OrderDependency: 30 AnySetup *PageSize
 
144
*DefaultPageSize: A4
 
145
*PageSize Letter/Letter: "                      "
 
146
*PageSize Legal/Legal: "                      "
 
147
*PageSize Executive/Executive: "                      "
 
148
*PageSize A4/A4: "                      "
 
149
*PageSize A5/A5: "                      "
 
150
*PageSize A6/A6: "                      "
 
151
*PageSize Env10/Com-10: "                      "
 
152
*PageSize EnvMonarch/Monarch: "                      "
 
153
*PageSize EnvDL/DL: "                      "
 
154
*PageSize EnvC5/C5: "                      "
 
155
*PageSize EnvISOB5/B5: "                      "
 
156
*PageSize EnvISOB6/B6: "                      "
 
157
*CloseUI: *PageSize
 
158
 
 
159
*OpenUI *PageRegion: PickOne
 
160
*OrderDependency: 40 AnySetup *PageRegion
 
161
*DefaultPageRegion: A4
 
162
*PageRegion Letter/Letter: "                      "
 
163
*PageRegion Legal/Legal: "                      "
 
164
*PageRegion Executive/Executive: "                      "
 
165
*PageRegion A4/A4: "                      "
 
166
*PageRegion A5/A5: "                      "
 
167
*PageRegion A6/A6: "                      "
 
168
*PageRegion Env10/Com-10: "                      "
 
169
*PageRegion EnvMonarch/Monarch: "                      "
 
170
*PageRegion EnvDL/DL: "                      "
 
171
*PageRegion EnvC5/C5: "                      "
 
172
*PageRegion EnvISOB5/B5: "                      "
 
173
*PageRegion EnvISOB6/B6: "                      "
 
174
*CloseUI: *PageRegion
 
175
 
 
176
*DefaultImageableArea: A4
 
177
*ImageableArea Letter/Letter: "18 12 594 780"
 
178
*ImageableArea Legal/Legal: "18 12 594 996"
 
179
*ImageableArea Executive/Executive: "18 12 504 744"
 
180
*ImageableArea A4/A4: "18 12 577 830"
 
181
*ImageableArea A5/A5: "18 12 403 583"
 
182
*ImageableArea A6/A6: "18 12 279 408"
 
183
*ImageableArea Env10/Com-10: "18 12 279 672"
 
184
*ImageableArea EnvMonarch/Monarch: "18 12 261 528"
 
185
*ImageableArea EnvDL/DL: "18 12 294 612"
 
186
*ImageableArea EnvC5/C5: "18 12 441 637"
 
187
*ImageableArea EnvISOB5/B5: "18 12 463 697"
 
188
*ImageableArea EnvISOB6/B6: "18 12 336 487"
 
189
 
 
190
*%==== Information About Media Sizes ========
 
191
 
 
192
*DefaultPaperDimension: A4
 
193
*PaperDimension Letter/Letter: "612 792"
 
194
*PaperDimension Legal/Legal: "612 1008"
 
195
*PaperDimension Executive/Executive: "522 756"
 
196
*PaperDimension A4/A4: "595 842"
 
197
*PaperDimension A5/A5: "420 595"
 
198
*PaperDimension A6/A6: "297 420"
 
199
*PaperDimension Env10/Com-10: "297 684"
 
200
*PaperDimension EnvMonarch/Monarch: "279 540"
 
201
*PaperDimension EnvDL/DL: "312 624"
 
202
*PaperDimension EnvC5/C5: "459 649"
 
203
*PaperDimension EnvISOB5/B5: "499 709"
 
204
*PaperDimension EnvISOB6/B6: "354 499"
 
205
 
 
206
*%==== 5.13 Media Handling Features ============================
 
207
*OpenUI *BrMediaType/BrMediaType: PickOne
 
208
*OrderDependency: 28 AnySetup *BrMediaType
 
209
*DefaultBrMediaType: PLAIN
 
210
*BrMediaType PLAIN/Plain Paper: "                      "
 
211
*BrMediaType THIN/Thin Paper: "                      "
 
212
*BrMediaType THICK/Thick Paper: "                      "
 
213
*BrMediaType THICKERPAPER2/Thicker Paper: "                      "
 
214
*BrMediaType BOND/Bond Paper: "                      "
 
215
*BrMediaType TRANSPARENCIES/Transparencies: "                      "
 
216
*BrMediaType ENV/Envelopes: "                      "
 
217
*BrMediaType ENVTHICK/Env. Thick: "                      "
 
218
*BrMediaType ENVTHIN/Env. Thin: "                      "
 
219
*CloseUI: *BrMediaType
 
220
 
 
221
*OpenUI *InputSlot/InputSlot: PickOne
 
222
*OrderDependency: 29 AnySetup *InputSlot
 
223
*DefaultInputSlot: AUTO
 
224
*InputSlot MANUAL/Manual Feed: "                      "
 
225
*InputSlot MPTRAY/MP Tray: "                      "
 
226
*InputSlot TRAY1/Tray1: "                      "
 
227
*InputSlot TRAY2/Tray2: "                      "
 
228
*InputSlot TRAY3/Tray3: "                      "
 
229
*InputSlot AUTO/Auto Select: "                      "
 
230
*CloseUI: *InputSlot
 
231
 
 
232
*RequiresPageRegion All:True
 
233
 
 
234
 
 
235
*%=== Duplex ================================
 
236
*%=== Output Bin =============================
 
237
*% === Collate ==========
 
238
*%==== 5.14 Finishing Features =================================
 
239
*%%%%% Resolution and Appearance Control %%%%%
 
240
*OpenUI *Resolution: PickOne
 
241
*OrderDependency: 11 AnySetup *Resolution
 
242
*DefaultResolution: 600dpi
 
243
*Resolution     300dpi: "                      "
 
244
*Resolution     600dpi: "                      "
 
245
*Resolution     2400x600dpi/HQ1200dpi: "                    "
 
246
*Resolution     1200dpi: "                    "
 
247
*CloseUI: *Resolution
 
248
 
 
249
*OpenUI *TonerSaveMode/Toner Save: PickOne
 
250
*DefaultTonerSaveMode: Off
 
251
*OrderDependency: 10 AnySetup  *TonerSaveMode
 
252
*TonerSaveMode Off/Off: "statusdict begin false tonersave end"
 
253
*TonerSaveMode On/On: "statusdict begin true tonersave end"
 
254
*CloseUI: *TonerSaveMode
 
255
 
 
256
*OpenUI *Sleep/Sleep Time [Min.]: PickOne
 
257
*DefaultSleep: PrinterDefault
 
258
*OrderDependency: 10 AnySetup  *Sleep
 
259
*Sleep PrinterDefault/Printer Default: ""
 
260
*Sleep 2minutes/2: "statusdict begin 2 powersavetime end"
 
261
*Sleep 10minutes/10: "statusdict begin 10 powersavetime end"
 
262
*Sleep 30minutes/30: "statusdict begin 30 powersavetime end"
 
263
*CloseUI: *Sleep
 
264
 
 
265
*%==== 5.20 Font Related Keywords ==============================
 
266
*DefaultFont: Courier
 
267
*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
 
268
*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
 
269
*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
 
270
*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
 
271
*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
 
272
*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
 
273
*Font Bookman-Light: Standard "(001.004S)" Standard ROM
 
274
*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
 
275
*Font Courier: Standard "(002.004S)" Standard ROM
 
276
*Font Courier-Bold: Standard "(002.004S)" Standard ROM
 
277
*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
 
278
*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
 
279
*Font Helvetica: Standard "(001.006S)" Standard ROM
 
280
*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
 
281
*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
 
282
*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
 
283
*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
 
284
*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
 
285
*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
 
286
*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
 
287
*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
 
288
*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
 
289
*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
 
290
*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
 
291
*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
 
292
*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
 
293
*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
 
294
*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
 
295
*Font Times-Bold: Standard "(001.007S)" Standard ROM
 
296
*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
 
297
*Font Times-Italic: Standard "(001.007S)" Standard ROM
 
298
*Font Times-Roman: Standard "(001.007S)" Standard ROM
 
299
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
 
300
*Font ZapfDingbats: Special "(001.004S)" Special ROM
 
301
*Font Symbol: Special "(001.007S)" Special ROM
 
302
*Font Alaska: Standard "(001.005)" Standard ROM
 
303
*Font AlaskaExtrabold: Standard "(001.005)" Standard ROM
 
304
*Font AntiqueOakland: Standard "(001.005)" Standard ROM
 
305
*Font AntiqueOakland-Bold: Standard "(001.005)" Standard ROM
 
306
*Font AntiqueOakland-Oblique: Standard "(001.005)" Standard ROM
 
307
*Font ClevelandCondensed: Standard "(001.005)" Standard ROM
 
308
*Font Connecticut: Standard "(001.005)" Standard ROM
 
309
*Font Guatemala-Antique: Standard "(001.005)" Standard ROM
 
310
*Font Guatemala-Bold: Standard "(001.005)" Standard ROM
 
311
*Font Guatemala-Italic: Standard "(001.005)" Standard ROM
 
312
*Font Guatemala-BoldItalic: Standard "(001.005)" Standard ROM
 
313
*Font LetterGothic: Standard "(001.005)" Standard ROM
 
314
*Font LetterGothic-Bold: Standard "(001.005)" Standard ROM
 
315
*Font LetterGothic-Oblique: Standard "(001.005)" Standard ROM
 
316
*Font Maryland: Standard "(001.005)" Standard ROM
 
317
*Font Oklahoma: Standard "(001.005)" Standard ROM
 
318
*Font Oklahoma-Bold: Standard "(001.005)" Standard ROM
 
319
*Font Oklahoma-Oblique: Standard "(001.005)" Standard ROM
 
320
*Font Oklahoma-BoldOblique: Standard "(001.005)" Standard ROM
 
321
*Font Utah: Standard "(001.005)" Standard ROM
 
322
*Font Utah-Bold: Standard "(001.005)" Standard ROM
 
323
*Font Utah-Oblique: Standard "(001.005)" Standard ROM
 
324
*Font Utah-BoldOblique: Standard "(001.005)" Standard ROM
 
325
*Font UtahCondensed: Standard "(001.005)" Standard ROM
 
326
*Font UtahCondensed-Bold: Standard "(001.005)" Standard ROM
 
327
*Font UtahCondensed-Oblique: Standard "(001.004)" Standard ROM
 
328
*Font UtahCondensed-BoldOblique: Standard "(001.005)" Standard ROM
 
329
*Font BermudaScript: Standard "(001.005)" Standard ROM
 
330
*Font Germany: Standard "(001.005)" Standard ROM
 
331
*Font SanDiego: Standard "(001.005)" Standard ROM
 
332
*Font US-Roman: Standard "(001.005)" Standard ROM
 
333
*?FontQuery: "
 
334
save
 
335
count 1 gt
 
336
  {exch dup dup
 
337
   =string cvs (/) print print (:) print
 
338
   FontDirectory exch known
 
339
     {pop(Yes)}
 
340
     {(fonts/)AppendName exch pop mark exch
 
341
      {}=string filenameforall counttomark
 
342
      0 gt
 
343
        {cleartomark(Yes)}
 
344
        {cleartomark(No)}ifelse
 
345
     }ifelse
 
346
   =
 
347
  }if
 
348
  (*) = flush
 
349
restore
 
350
"
 
351
*End
 
352
*?FontList: "
 
353
save
 
354
  FontDirectory{pop ==}forall
 
355
  (fonts/*)
 
356
  {dup length 6 sub 6 exch getinterval cvn ==
 
357
  }=string filenameforall
 
358
  (*) = flush
 
359
restore
 
360
"
 
361
*End
 
362
 
 
363
 
 
364
ENDOFPPDFILE
 
365
 
 
366
 
 
367
brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapperHL5240
 
368
brotherlpdwrapper64=/usr/lib64/cups/filter/brlpdwrapperHL5240
 
369
rm -f  $brotherlpdwrapper
 
370
 
 
371
 
 
372
cat <<!ENDOFWFILTER! >$brotherlpdwrapper
 
373
#! /bin/sh
 
374
#
 
375
# Brother Print filter  >>  $brotherlpdwrapper
 
376
# Copyright (C) 2005 Brother. Industries, Ltd.
 
377
#                                    Ver1.00
 
378
 
 
379
# This program is free software; you can redistribute it and/or modify it
 
380
# under the terms of the GNU General Public License as published by the Free
 
381
# Software Foundation; either version 2 of the License, or (at your option)
 
382
# any later version.
 
383
#
 
384
# This program is distributed in the hope that it will be useful, but WITHOUT
 
385
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
386
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
387
# more details.
 
388
#
 
389
# You should have received a copy of the GNU General Public License along with
 
390
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
391
# Place, Suite 330, Boston, MA  02111-1307  USA
 
392
#
 
393
LOGFILE="/dev/null"
 
394
LOGCLEVEL="7"
 
395
DEBUG=0
 
396
NUPENABLE=1
 
397
ENABLECOPY=0
 
398
LOG_LATESTONLY=1
 
399
errorcode=0
 
400
 
 
401
set +o noclobber
 
402
if [ "\`echo \$5 | grep 'debug-noprint=1'\`" != '' ]; then
 
403
    DEBUG=1
 
404
fi
 
405
if [ "\`echo \$5 | grep 'debug-noprint=2'\`" != '' ]; then
 
406
    DEBUG=2
 
407
fi
 
408
if [ "\`echo \$5 | grep 'debug-noprint=3'\`" != '' ]; then
 
409
    DEBUG=3
 
410
fi
 
411
if [ \$DEBUG != 0 ]; then
 
412
    LOGFILE=/tmp/br_cupsfilter_debug_log
 
413
fi
 
414
 
 
415
PRINTER=HL5240
 
416
 
 
417
 
 
418
if [ "\$PPD" = "" ]; then
 
419
    PPD="/usr/share/cups/model/HL5240.ppd"
 
420
fi
 
421
 
 
422
 
 
423
if [ \$LOGFILE != "/dev/null" ]; then
 
424
  if [ \$LOG_LATESTONLY == "1" ]; then
 
425
    rm -f \$LOGFILE
 
426
    date                                                           >\$LOGFILE
 
427
  else
 
428
    if [ -e \$LOGFILE ]; then
 
429
            date                                                        >>\$LOGFILE
 
430
    else
 
431
            date                                                        >\$LOGFILE
 
432
    fi
 
433
  fi
 
434
    echo "arg0 = \$0"                                           >>\$LOGFILE
 
435
    echo "arg1 = \$1"                                           >>\$LOGFILE
 
436
    echo "arg2 = \$2"                                           >>\$LOGFILE
 
437
    echo "arg3 = \$3"                                           >>\$LOGFILE
 
438
    echo "arg4 = \$4"                                           >>\$LOGFILE
 
439
    echo "arg5 = \$5"                                           >>\$LOGFILE
 
440
    echo "arg6 = \$6"                                           >>\$LOGFILE
 
441
    echo "PPD  = \$PPD"                                         >>\$LOGFILE
 
442
fi
 
443
 
 
444
INPUT_TEMP_PS=\`mktemp /tmp/br_input_ps.XXXXXX\`
 
445
 
 
446
nup="cat"
 
447
if [ "\`echo \$5 | grep 'Nup='\`" != '' ] && [ \$NUPENABLE != 0 ]; then
 
448
 
 
449
        if   [ "\`echo \$5 | grep 'Nup=64'\`" != '' ]; then
 
450
                nup="psnup -64"
 
451
        elif [ "\`echo \$5 | grep 'Nup=32'\`" != '' ]; then
 
452
                nup="psnup -32"
 
453
        elif [ "\`echo \$5 | grep 'Nup=25'\`" != '' ]; then
 
454
                nup="psnup -25"
 
455
        elif [ "\`echo \$5 | grep 'Nup=16'\`" != '' ]; then
 
456
                nup="psnup -16"
 
457
        elif [ "\`echo \$5 | grep 'Nup=8'\`" != '' ]; then
 
458
                nup="psnup -8"
 
459
        elif [ "\`echo \$5 | grep 'Nup=6'\`" != '' ]; then
 
460
                nup="psnup -6"
 
461
        elif [ "\`echo \$5 | grep 'Nup=4'\`" != '' ]; then
 
462
                nup="psnup -4"
 
463
        elif [ "\`echo \$5 | grep 'Nup=2'\`" != '' ]; then
 
464
                nup="psnup -2"
 
465
        elif [ "\`echo \$5 | grep 'Nup=1'\`" != '' ]; then
 
466
                nup="cat"
 
467
        fi
 
468
        echo   "NUP=\$nup"                                      >>\$LOGFILE
 
469
   if [ -e /usr/bin/psnup ]; then
 
470
       if [ \$# -ge 7 ]; then
 
471
               cat \$6  | \$nup > \$INPUT_TEMP_PS
 
472
       else
 
473
               cat       | \$nup > \$INPUT_TEMP_PS
 
474
       fi
 
475
   else
 
476
       if [ \$# -ge 7 ]; then
 
477
               cp \$6  \$INPUT_TEMP_PS
 
478
       else
 
479
               cat    > \$INPUT_TEMP_PS
 
480
       fi
 
481
   fi
 
482
else
 
483
   if [ \$# -ge 7 ]; then
 
484
      cp \$6  \$INPUT_TEMP_PS
 
485
   else
 
486
      cat    > \$INPUT_TEMP_PS
 
487
   fi
 
488
fi
 
489
 
 
490
if [ "\$ENABLECOPY" != 0 ];then
 
491
  if [ "\$4" -ge 2 ];then
 
492
     options="\$5"" ""Copies=\$4"
 
493
  else
 
494
     options="\$5"
 
495
  fi
 
496
else
 
497
  options="\$5"
 
498
fi
 
499
 
 
500
 
 
501
if [ -e "/usr/local/Brother/lpd/filter\$PRINTER" ]; then
 
502
       :
 
503
else
 
504
    echo "ERROR: /usr/local/Brother/lpd/filter\$PRINTER does not exist"   >>\$LOGFILE
 
505
    errorcode=30
 
506
    exit $errorcode
 
507
fi
 
508
 
 
509
if [ -e "/usr/local/Brother/cupswrapper/brcupsconfig3" ]; then
 
510
  if [ \$DEBUG = 0 ]; then
 
511
     /usr/local/Brother/cupswrapper/brcupsconfig3  \$PRINTER  \$PPD 0 "\$options" >> /dev/null
 
512
  else
 
513
     /usr/local/Brother/cupswrapper/brcupsconfig3  \$PRINTER  \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE
 
514
  fi
 
515
fi
 
516
 
 
517
 
 
518
if [ \$DEBUG -le 2 ]; then
 
519
    cat    \$INPUT_TEMP_PS | /usr/local/Brother/lpd/filter\$PRINTER
 
520
fi
 
521
 
 
522
if [ \$DEBUG -ge 2 ];  then
 
523
           if [ \$LOGFILE != "/dev/null" ]; then
 
524
             echo ""                                                >>\$LOGFILE
 
525
             echo "    ------PostScript Data-------"                >>\$LOGFILE
 
526
             cat    \$INPUT_TEMP_PS                                  >>\$LOGFILE
 
527
           fi
 
528
fi
 
529
rm -f  \$INPUT_TEMP_PS
 
530
 
 
531
exit \$errorcode
 
532
 
 
533
!ENDOFWFILTER!
 
534
 
 
535
 
 
536
chmod a+x $brotherlpdwrapper
 
537
if [ -e /usr/lib64/cups/filter ]; then
 
538
   cp $brotherlpdwrapper  $brotherlpdwrapper64
 
539
fi
 
540
 
 
541
chmod a+w /usr/local/Brother/inf/brHL5240rc
 
542
chmod a+w /usr/local/Brother/inf
 
543
if [ -e /etc/init.d/lpd ]; then
 
544
   /etc/init.d/lpd stop
 
545
fi
 
546
if [  -e /etc/init.d/lprng ]; then
 
547
   /etc/init.d/lprng stop
 
548
fi
 
549
  if [ -e /etc/init.d/cups ]; then
 
550
    /etc/init.d/cups restart
 
551
  fi
 
552
  if [ -e /etc/init.d/cupsys ]; then
 
553
    /etc/init.d/cupsys restart
 
554
  fi
 
555
sleep 2s
 
556
port2=`lpinfo -v | grep -i 'usb://Brother/HL-5240' | head -1`
 
557
if [ "$port2" = '' ];then
 
558
        port2=`lpinfo -v | grep 'usb://' | head -1`
 
559
fi
 
560
port=`echo $port2| sed s/direct//g`
 
561
if [ "$port" = '' ];then
 
562
        port=usb:/dev/usb/lp0
 
563
fi
 
564
lpadmin -p HL5240 -E -v $port -P /usr/share/cups/model/HL5240.ppd
 
565
  exit 0