forked from koenkooi/foo2zjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfoomatic-test
executable file
·42 lines (33 loc) · 1.13 KB
/
foomatic-test
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
#!/bin/sh
#
# Test a new foomatic printer entry.
#
# This stuff should be passable on the command line to make this script generic
# TODO
MAINDB=/usr/share/foomatic/db/source
NEWDB=./foomatic-db
PRINTER="Lexmark-Z43"
DRIVER=drv_z42
PRINTER="Minolta-magicolor_2300_DL"
DRIVER=foo2zjs
OPTIONS="-o Resolution=600x600"
OPTIONS=
OPTIONS="-o ColorMode=Color -o Nup=2up"
# Copy the new DB XML files into the main database
for dir in driver printer opt; do
root cp $NEWDB/$dir/*.xml $MAINDB/$dir
done
# Issue a command to make foomatic recognize the new DB entries
root rm -rf /var/cache/foomatic/*/*
(cd /var/cache/foomatic/compiled; root foomatic-combo-xml -O >overview.xml)
# Create the perl script that drives the printer with the above options
foomatic-datafile -t direct -p $PRINTER -d $DRIVER > xxx.foo
# Fix the directomatic script so it produces useful information
sed < /usr/bin/directomatic > xxxomatic \
-e 's/debug=0/debug=1/' \
-e 's#/tmp/prnlog#xxx.prnlog#'
chmod +x xxxomatic
# Run the script
./xxxomatic -P xxx.foo $OPTIONS testpage.ps > xxx.prn
# Ferret out the useful information
sed -n 's/.*running: \(.*\)/\1/p' xxx.prnlog