| 1 |
#!/usr/bin/perl |
| 2 |
# |
| 3 |
# hpijs-drv - Create hp device include file for Makefile.am. |
| 4 |
# |
| 5 |
# Copyright (c) 2003-2008, HP Co. All rights reserved. |
| 6 |
# |
| 7 |
# Redistribution and use in source and binary forms, with or without |
| 8 |
# modification, are permitted provided that the following conditions |
| 9 |
# are met: |
| 10 |
# 1. Redistributions of source code must retain the above copyright |
| 11 |
# notice, this list of conditions and the following disclaimer. |
| 12 |
# 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
# notice, this list of conditions and the following disclaimer in the |
| 14 |
# documentation and/or other materials provided with the distribution. |
| 15 |
# 3. Neither the name of the Hewlett-Packard nor the names of its |
| 16 |
# contributors may be used to endorse or promote products derived |
| 17 |
# from this software without specific prior written permission. |
| 18 |
# |
| 19 |
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 20 |
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 21 |
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 22 |
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 23 |
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 24 |
# NOT LIMITED TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR |
| 25 |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 26 |
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 27 |
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 28 |
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 |
# POSSIBILITY OF SUCH DAMAGE. |
| 30 |
# |
| 31 |
# Author: David Suffield <[email protected]> |
| 32 |
# |
| 33 |
# Usage: |
| 34 |
# ./hpijs-drv |
| 35 |
# |
| 36 |
# Description: |
| 37 |
# This script will create a include file for Makefile.am. |
| 38 |
# |
| 39 |
|
| 40 |
$shadow = shift @ARGV; |
| 41 |
|
| 42 |
# Generate ppd list of all hpijs printers. |
| 43 |
$line = "foomatic_ppd_printers = \\\n"; |
| 44 |
$ppddir = "ppd/hpijs"; |
| 45 |
opendir(DIR, "$ppddir") or die "Error while opening $ppddir: $!\n"; |
| 46 |
while($file = readdir(DIR)) |
| 47 |
{ |
| 48 |
if ($file =~ /(^[hp|HP].*ppd\.gz)/) |
| 49 |
{ |
| 50 |
$line .= " $ppddir/$file \\\n"; |
| 51 |
} |
| 52 |
} |
| 53 |
close DIR; |
| 54 |
chop($line); # remove last "\" character |
| 55 |
chop($line); |
| 56 |
print(STDOUT "$line\n\n"); |
| 57 |
|
| 58 |
# Generate ppd list of all HP postscript printers. |
| 59 |
$line = "foomatic_ps_printers = \\\n"; |
| 60 |
$ppddir = "prnt/ps"; |
| 61 |
opendir(DIR, "$ppddir") or die "Error while opening $ppddir: $!\n"; |
| 62 |
while($file = readdir(DIR)) |
| 63 |
{ |
| 64 |
if ($file =~ /(^[hp|HP].*ppd\.gz)/) |
| 65 |
{ |
| 66 |
$line .= " $ppddir/$file \\\n"; |
| 67 |
} |
| 68 |
} |
| 69 |
close DIR; |
| 70 |
if ($shadow eq "true") |
| 71 |
{ |
| 72 |
# Shadow build add unreleased directory. |
| 73 |
$unreldir = "$ppddir/unrelease"; |
| 74 |
opendir(DIR, "$unreldir") or die "Error while opening $unreldir: $!\n"; |
| 75 |
while($file = readdir(DIR)) |
| 76 |
{ |
| 77 |
if ($file =~ /(^[hp|HP].*ppd\.gz)/) |
| 78 |
{ |
| 79 |
$line .= " $unreldir/$file \\\n"; |
| 80 |
} |
| 81 |
} |
| 82 |
close DIR; |
| 83 |
} |
| 84 |
chop($line); # remove last "\" character |
| 85 |
chop($line); |
| 86 |
print(STDOUT "$line\n\n"); |
| 87 |
|
| 88 |
# Generate drv list. |
| 89 |
# NOTE: Shadow build does not need any additional drv files anymore. |
| 90 |
$line = "foomatic_drv = prnt/drv/hpijs.drv\n"; |
| 91 |
|
| 92 |
print(STDOUT "$line\n"); |
| 93 |
|