conv_lp revision 7c478bd95313f5f23a4c958a745db2134aa03244
03831d35f7499c87d51205817c93e9a8d42c4baestevel# CDDL HEADER START
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# The contents of this file are subject to the terms of the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Common Development and Distribution License, Version 1.0 only
03831d35f7499c87d51205817c93e9a8d42c4baestevel# (the "License"). You may not use this file except in compliance
03831d35f7499c87d51205817c93e9a8d42c4baestevel# with the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
03831d35f7499c87d51205817c93e9a8d42c4baestevel# See the License for the specific language governing permissions
03831d35f7499c87d51205817c93e9a8d42c4baestevel# and limitations under the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel# When distributing Covered Code, include this CDDL HEADER in each
03831d35f7499c87d51205817c93e9a8d42c4baestevel# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
03831d35f7499c87d51205817c93e9a8d42c4baestevel# If applicable, add the following below this CDDL HEADER, with the
03831d35f7499c87d51205817c93e9a8d42c4baestevel# fields enclosed by brackets "[]" replaced with your own identifying
03831d35f7499c87d51205817c93e9a8d42c4baestevel# information: Portions Copyright [yyyy] [name of copyright owner]
03831d35f7499c87d51205817c93e9a8d42c4baestevel# CDDL HEADER END
03831d35f7499c87d51205817c93e9a8d42c4baestevel# Copyright (c) 1994, 1995, 1996 by Sun Microsystems, Inc.
03831d35f7499c87d51205817c93e9a8d42c4baestevel# All Rights Reserved
03831d35f7499c87d51205817c93e9a8d42c4baestevel# ident "%Z%%M% %I% %E% SMI"
03831d35f7499c87d51205817c93e9a8d42c4baestevel# This script will automatically generate a "printcap" file
03831d35f7499c87d51205817c93e9a8d42c4baestevel# from the currently configured LP printer configuration.
03831d35f7499c87d51205817c93e9a8d42c4baestevelset -- `getopt d:f: $*`
03831d35f7499c87d51205817c93e9a8d42c4baestevelif [ $? != 0 ] ; then
03831d35f7499c87d51205817c93e9a8d42c4baestevel echo "Usage: $0 [-d dir] [-f file]"
03831d35f7499c87d51205817c93e9a8d42c4baestevel --) shift; break;;
03831d35f7499c87d51205817c93e9a8d42c4baestevelSYSTEM_FILE=${SYSTEM_FILE:-"${BASE_DIR}/etc/printers.conf"}
a90d965d832a5578dbfc2eadd1617e8cccf25264fw gettext "Exit $0: There is no directory ${BASE_DIR}/etc/lp/printers\n\tfrom which to create /etc/printers.conf."
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki mv ${BASE_DIR}/etc/lp/default ${BASE_DIR}/etc/default.orig
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkicd ${BASE_DIR}/etc/lp/printers # get the list of locally configured printers
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkifor PRINTER in ${PRINTERS} # for each printer get config info
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki REMOTE=`grep Remote: ${PRINTER}/configuration 2>/dev/null | sed -e "s/^Remote: //"`
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki DEVICE=`grep Device: ${PRINTER}/configuration 2>/dev/null | sed -e "s/^Device: //"`
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -n "${DEVICE}" ] ; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki lpset -n system -a "bsdaddr=${RHOST},${RNAME}" -a "description=${DESC}" \