Scripting HP/jetadmin to CUPS conversion

Rex Mueller rmueller at esu3.org
Tue Apr 22 06:41:48 PDT 2008


I have cobbed together some code from a post on another forum and have come up with a script that builds the printer.conf to convert from HP/UX queues to CUPS...

I am curious as to how CUPS connects the items in the printers.conf to reference what particular PPD or model script is uses for printing?

The script builds the printer file, I still appear to have an issue because it does not know what model script/ppd to use to filter through.

Any insight appreciated.



##############################################
#!/bin/sh
for qname in `/usr/local/bin/lpm |awk -F: '{print $1}' `
 do
 echo $qname
         for ipaddr in `grep PERIPH= /var/spool/lp/interface/$qname |grep -v MOD
EL |awk -F'=' '{print $2}' `
                do
                        echo $qname $ipaddr
 done
done


outfile=$1
if [ -z "$outfile" ]
then
echo "USAGE: hp2cups <output file>"
exit 1
else
> $outfile
fi

/usr/sam/lbin/lpmgr | while read printnfo
do
isremote=`echo $printnfo \
| cut -d":" -f3 \
| cut -d"," -f1`
if [ "$isremote" = "yes" ]
then
name=`echo $printnfo | cut -d":" -f1`
remote=`echo $printnfo \
| cut -d":" -f5 \
| awk '{print $3}'`
cat >> $outfile << EOF
<Printer $name>
Info Created by $USER
DeviceURI socket://$ipaddr:9100
Location
State Idle
Accepting Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
</Printer>
EOF
fi
done
#########################################




More information about the cups mailing list