lpadmin revision 355b4669e025ff377602b6fc7caaf30dbc218371
4675N/A# The contents of this file are subject to the terms of the 4675N/A# Common Development and Distribution License (the "License"). 4675N/A# You may not use this file except in compliance with the License. 4675N/A# See the License for the specific language governing permissions 4675N/A# and limitations under the License. 4675N/A# When distributing Covered Code, include this CDDL HEADER in each 4675N/A# If applicable, add the following below this CDDL HEADER, with the 4675N/A# fields enclosed by brackets "[]" replaced with your own identifying 4675N/A# information: Portions Copyright [yyyy] [name of copyright owner] 5453N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 4675N/A# Use is subject to license terms. 5680N/A# ident "%Z%%M% %I% %E% SMI" 5453N/A gettext " lpadmin -S print-wheel -A alert-type [ -W minutes ]\n" 1>&2 5453N/A gettext " lpadmin -M -f form-name [ -a [ -o filebreak ]\n" 1>&2 5453N/A# Get printer names for each local printer 5453N/A# get printer name from that line 5453N/A# If there is not an entry for this printer in 4675N/A# shutdown scheduler if there are no local printers 5453N/A "Call to lpset -x _default exits with ${status}" 5453N/A# Delete all the remote printers using bsdaddr "Call to lpset -x $PRINTER exits with ${status}" # Deal with the -d option independently since getopts does not handle # options that may or may not have arguments if [ ${
first} =
"-d" ] ;
then # check that there are no extra arguments if [ -n
"${third}" ] ;
then # be sure we have lpset and lpget gettext "lpadmin: System error; cannot set default printer\n" 1>&
2 if [ ! -n
"${second}" ] ;
then gettext "lpadmin: System error while trying to delete default printer\n" 1>&
2 # there was no _default, the work is done # Strip off legal options while getopts "A:ac:D:e:f:F:H:hi:I:lm:Mn:o:p:Q:r:S:s:T:u:U:v:W:x:t:P:" arg if [ -n
"${delete}" ] ;
then if [ ! -n
"${server}" ] ;
then if [ -n
"${printer}" -o -n
"${server}" -o \
-n
"${device}" -o -n
"${description}" ] ;
then if [ ! -f ${
LPGET} ] ;
then gettext "lpadmin: System error; cannot set class\n " 1>&
2 gettext "lpadmin: ERROR: Can't create class ${class}.\n" 1>&
2 gettext " TO FIX: This is an existing printer name;\n" 1>&
2 gettext " choose another name.\n" 1>&
2 # We don't have anything to do; let user know and bail if [ ! -n
"${printer}" -a ! -n
"${delete}" -a ! -n
"${local}" ] ;
then gettext "lpadmin: ERROR: Nothing to do.\n" 1>&
2 gettext " TO FIX: You must give one of these options:\n" 1>&
2 # To be consistent with 2.5, assume adding local printer if [ ! -n
"${device}" -a ! -n
"${server}" -a ! -n
"${delete}" \
-a ! -n
"${local}" ] ;
then gettext "lpadmin: ERROR: Missing -U or -v option.\n" 1>&
2 gettext " TO FIX: Local printers must have\n" 1>&
2 gettext " a port defined (-v option) or\n" 1>&
2 gettext " have dial-out instructions (-U option).\n" 1>&
2 # Do the LP configuration for a local printer served by lpsched # to deal with multi-word arguments # if adding a printer, make sure scheduler is running if [ -n
"${printer}" -a ! -n
"${delete}" -a \
# add filters to the print server # process the "server" value # It can be a hostname, UUCP form (server!queue), RCMD form(queue@server), # or in URI form ({scheme}://{endpoint}) # default URI form is "lpd" form if [ -n
"${server}" ] ;
then uri=${
uri:-
"lpd://${server}/printers/${rem_printer}#Solaris"}
bsdaddr=
"${server},${rem_printer},Solaris" # Do the Solstice Print Configuration in /etc if [ -n
"${delete}" ] ;
then if [
"${delete}" =
"all" ] ;
then if [ -n
"${printer}" -a -n
"${uri}" ] ;
then if [ -n
"${printer}" -a -n
"${bsdaddr}" ] ;
then if [ -n
"${printer}" -a -n
"${description}" ] ;
then # Add class for local printers only if [ -n
"${class}" -a -n
"${printer}" \
uri=
"lpd://${server}/printers/${class}#Solaris" bsdaddr=
"${server},${class},Solaris" -a
"printer-uri-supported=${uri}" \
-a
"bsdaddr=${bsdaddr}" \
if [ -n
"${pconflocalclean}" ] ;
then