#!/bin/csh -f # # script for creating spooling directories # if ($?DEBUG) set verbose set destdir="" set prot=775 set owner=daemon set group=daemon if ($1 != "") set destdir = $1 if ($2 != "") set prot = $2 if ($3 != "") set owner = $3 if ($4 != "") set group = $4 echo "# $0 $destdir $prot $owner $group" set f=/etc/printcap set dirs=(`sed -n -e '/^#/d' -e '/:sd=/s/^.*:sd=\([^:]*\).*$/\1/p' $f`) set logs=(`sed -n -e '/^#/d' -e '/:lf=/s/^.*:lf=\([^:]*\).*$/\1/p' $f`) set acct=(`sed -n -e '/^#/d' -e '/:af=/s/^.*:af=\([^:]*\).*$/\1/p' $f`) foreach j (${dirs}) set i = "${destdir}/${j}" set sdd = ${i:h} if (! -d $sdd) then echo "# Creating enclosing directory $sdd" mkdir $sdd chown $owner $sdd chgrp $group $sdd chmod $prot $sdd echo "# `ls -ldg $sdd`" endif if (! -d $i) then echo "# Creating $i" mkdir $i chown $owner $i chgrp $group $i chmod $prot $i echo "# `ls -lgd $i`" endif if (! -f $i/.options) then echo "# Creating $i/.options" cat > $i/.options << EOF BANNERFIRST=1 BANNERLAST=0 REVERSE="" EOF chown $owner $i/.options chgrp $group $i/.options chmod $prot $i/.options endif end foreach j (${logs} ${acct}) set i = "${destdir}/${j}" if (! -f $i) then echo "# Creating $i" cp /dev/null $i chown $owner $i chgrp $group $i chmod $prot $i endif end