source: trunk/athena/bin/lpr/makespools @ 10185

Revision 10185, 1.7 KB checked in by ghudson, 27 years ago (diff)
From mwhitson: Add a comment header to the .options file. Add more common configuration defaults and a line to export environment variables. Create a .spooler file to enable use of a duplexing queue by default.
Line 
1#!/bin/csh -f
2
3#
4# script for creating spooling directories
5#
6
7if ($?DEBUG) set verbose
8
9set destdir=""
10set prot=775
11set owner=daemon
12set group=daemon
13
14if ($1 != "") set destdir = $1
15if ($2 != "") set prot = $2
16if ($3 != "") set owner = $3
17if ($4 != "") set group = $4
18
19echo "# $0  $destdir  $prot  $owner  $group"
20
21set f=/etc/printcap
22set dirs=(`sed -n -e '/^#/d' -e '/:sd=/s/^.*:sd=\([^:]*\).*$/\1/p' $f`)
23set logs=(`sed -n -e '/^#/d' -e '/:lf=/s/^.*:lf=\([^:]*\).*$/\1/p' $f`)
24set acct=(`sed -n -e '/^#/d' -e '/:af=/s/^.*:af=\([^:]*\).*$/\1/p' $f`)
25
26foreach j (${dirs})
27        set i = "${destdir}/${j}"
28        set sdd = ${i:h}
29        set psn = ${i:t}
30        if (! -d $sdd) then
31                echo "# Creating enclosing directory $sdd"
32                mkdir $sdd
33                chown $owner $sdd
34                chgrp $group $sdd
35                chmod $prot $sdd
36                echo "# `ls -ldg $sdd`"
37                endif
38        if (! -d $i) then
39                echo "# Creating $i"
40                mkdir $i
41                chown $owner $i
42                chgrp $group $i
43                chmod $prot $i
44                echo "# `ls -lgd $i`"
45                endif
46        if (! -f $i/.options) then
47                echo "# Creating $i/.options"
48                cat > $i/.options << EOF
49#
50# Prototype .options file
51#
52# File should be in spooler directory for printer as ./.options
53# This file passes environment variables to the Transcript program
54# that does envget(s) on these items.
55#
56BANNERFIRST=1
57BANNERLAST=0
58REVERSE=""
59DUPLEXING=0
60INTERFACE=0
61PRINTER=$psn
62export BANNERFIRST BANNERLAST REVERSE DUPLEXING PRINTER NETNAME INTERFACE VERBOSELOG
63EOF
64                echo "# Creating $i/.spooler"
65                cat > $i/.spooler << EOF
66${psn}2 -F /usr/athena/lib/lpdfilters/duplex2
67EOF
68                chown $owner $i/.options
69                chgrp $group $i/.options
70                chmod $prot $i/.options
71                endif
72        end
73
74foreach j (${logs} ${acct})
75        set i = "${destdir}/${j}"
76        if (! -f $i) then
77                echo "# Creating $i"
78                cp /dev/null $i
79                chown $owner $i
80                chgrp $group $i
81                chmod $prot $i
82                endif
83        end
Note: See TracBrowser for help on using the repository browser.