ppdmgr revision c81d47afd05baeb768e2f032636019b717899efd
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# CDDL HEADER START
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# The contents of this file are subject to the terms of the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Common Development and Distribution License (the "License").
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# You may not use this file except in compliance with the License.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# or http://www.opensolaris.org/os/licensing.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# See the License for the specific language governing permissions
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# and limitations under the License.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# When distributing Covered Code, include this CDDL HEADER in each
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# If applicable, add the following below this CDDL HEADER, with the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# fields enclosed by brackets "[]" replaced with your own identifying
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# information: Portions Copyright [yyyy] [name of copyright owner]
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# CDDL HEADER END
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Use is subject to license terms.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# ident "%Z%%M% %I% %E% SMI"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Description: Script to generate the Solaris printmgr 'ppdcache' file from the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# ppd files installed in the given ppd database directory
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# ppdmgr -a <ppd_filename_path> [ -L <label> ] [-w]
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# ppdmgr -g <ppd_filename_path> [ -L <label> ] [ -R <ppd_repository> ]
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# ppdmgr -r [ -L <label> ] [ -R <ppd_repository> ]
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# ppdmgr -u [ -L <label> ] [ -R <ppd_repository> ]
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# -a <ppd_filename_path> - Add a new PPD file to the specified
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# label in the "user" repository, and
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# updates to the "user" repository
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# in the ppdcache.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# -g <ppd_filename_path> - Generate a cache file entry
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# for the specified PPD file
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# on standard out.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# -L <label> - Label name. <label>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# can be any characters from the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# portable character set, however
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# may not contain a semi-colon (':').
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# The following are the defaults
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# for <label> for each option:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# OPTION DEFAULT LABEL
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# ------ -------------
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# -a <label> from <ppd_filename_path>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# if <ppd_filename_path>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# is from a known repository,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# otherwise defaults to "user".
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# -g <label> from <ppd_filename_path>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# if <ppd_filename_path>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# is from a known repository,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# otherwise defaults to "user".
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# The following are reserved labels:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# caches - may never be specified
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# ppdcache - may never be specified
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# manufaliases - may never be specified
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# all - applies specified
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# action to all labels
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# in a repository.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Can only be specified
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# with -r or -u.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# SUNW* - anything starting with
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# SUNW is reserved for
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# use by Sun, but not
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# -r - Rebuild the cache information for the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# specified label in the specified
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# repository. Similar to -u, however,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# the cache file is removed to force an
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# update to the ppdcache.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# -R <ppd_repository> - PPD repository name.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Defaults to "user".
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# The following are the possible
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# values for <ppd_repository> and
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# location in the system:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# all all repositories
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Note: When specified with the -a option
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# only "user" and "admin" are valid.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# "vendor", "system", and "all" will be
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# considered reserved.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# -u - Update the PPD cache information
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# for the specified label in the specified
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# repository if needed. If the cache
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# update was required, then the updated
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# cache information is reflected in
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# the ppdcache.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# -w - Display full path of where the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# ppd file is located on the system.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Only valid with -a, otherwise the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# option is ignored.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# If -a, -g, -r, or -u are specified on the command line, only the last action
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# specified will be performed.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Cache file entry format:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# <ModifiedManufacturerName>:<Model>:<NickName>:<1284DeviceIDManufacturer>:<1284DeviceIDModel>:<FullPPDFilePath>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# HP:HP DeskJet 450:Foomatic/hpijs (recommended):dj450:hp:/usr/share/ppd/HP/HP-DeskJet_450-hpijs.ppd.gz
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Generates debug output for calling routine.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# If calling routine's name is passed in, then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# will also generate the name of the calling routine.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $1 - Name of calling routine
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis [[ ${debug} -eq 1 ]] || return 1
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Set the ownership and permissions on a file.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $2 - Owner:Group
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $3 - Full path to file
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Create administrator repository directories, /usr/local/share/ppd,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# if needed. This is a special case a Solaris doesn't deliver
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# /usr/local/share and it has different permissions than the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# user repository.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $1 - destination repository name
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # Only create administrator repository directories, if needed.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis make_dir ${DIRMODE} ${ADMINOWNER} "${admppar}" || \
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis make_dir ${DIRMODE} ${ADMINOWNER} "${admpar}" || return 1
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis make_dir ${DIRMODE} ${ADMINOWNER} ${ADMINREP} || return 1
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Returns full path to PPD file that was added to the system.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $1 - Full path to source PPD file
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $2 - PPD file name
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $3 - Full path to repository
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $4 - Repository name
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $5 - Label name
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Return codes:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# 0 - File successfully added
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# 2 - Duplicate file already exists
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if [[ $? -ne 0 ]] ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis gettext "invalid PPD file: ${1}" 2>/dev/null
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis dstmanufpath="${dstlabelpath}/${modmanuf}"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # If a version (either compressed or not compressed) of the PPD
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # file exists in the destination in the label/repository,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # then just return as there no work to be done.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis dst_copy_path=$(variant_copy "${1}" "${dstpath}" "${6}" "${ppdfname}")
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if [[ ${ap_rc} -ne 0 ]] ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # Can only add a PPD file to the "user" or "admin" repository.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # Note: this check is here instead of at the top of this
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # function as we don't want to cause an error if a user
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # specifies the same repository and label as a the specified
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # ppd file and the repository of the specified ppd file
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if [[ "${4}" != "${USER}" && "${4}" != "${ADMIN}" ]] ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis gettext "invalid PPD file repository name: ${4}" 2>/dev/null
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if ! create_adminrep_dirs ${4} ${DIRMODE} ${ADMINOWNER} || \
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis ! make_dir ${DIRMODE} ${DIROWNER} "${3}" || \
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis ! make_dir ${DIRMODE} ${DIROWNER} "${dstlabelpath}" || \
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis ! make_dir ${DIRMODE} ${DIROWNER} "${dstmanufpath}" ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis gettext "unable to create destination directories" 2>/dev/null
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # Copy source PPD file, and compress if needed, to destination
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if [[ "${ppdfileext}" = "${PEXT}" ]] ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis ${GZIP} "${1}" >"${dst_copy_path}" 2>/dev/null
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if [[ $? -eq 1 ]] ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis gettext "unable to copy PPD file " 2>/dev/null
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis /bin/cp -f "${1}" "${dst_copy_path}" >/dev/null 2>&1
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if [[ $? -ne 0 ]] ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis gettext "unable to copy PPD file " 2>/dev/null
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis set_perms ${FILEMODE} ${FILEOWNER} "${dst_copy_path}"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Returns 0 if the cache needs to be modified, otherwise
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $1 - Full path to cache
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $2 - Full path to cache replacement candidate
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if [[ "${action}" = "${REBUILD}" ]] ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if $(${CMP} "${1}" "${2}" >/dev/null 2>&1) ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis /bin/touch -r "${2}" "${1}" >/dev/null 2>&1
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Generate a new golden cache file (/var/lp/ppd/ppdcache), by
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# concatenating and sorting all existing cache files in /var/lp/ppd/caches.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# If there are difference between the newly generated golden cache file and
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# the existing one (if it exists) then the newly generated one replaces the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# existing one at /var/lp/ppd/ppdcache.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # Remove any cache files that don't have an associated
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis for cname in $(/bin/ls ${VARCACHES} 2>/dev/null) ; do
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis checkdir="$(get_rep_path ${repname})/${cfile}"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis remove_unassociated_cache "${checkdir}" "${cname}"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # Combine the contents of all cache files into a
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis tmpgoldencache=$(/bin/mktemp -p "${ppdmgrtmpdir}" \
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis /bin/sort "${VARCACHES}"/* >>"${tmpgoldencache}" 2>/dev/null
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis /bin/rm -f "${tmpgoldencache}" >/dev/null 2>&1
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # Use the newly generated "temporary" golden cache file if there
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # differences between the current and newly generated ppdcache
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if [[ "${VARCACHES}" -nt "${GOLDCACHE}" ]] || \
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis changes_in_cache "${GOLDCACHE}" "${tmpgoldencache}" ; then
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis set_perms ${FILEMODE} ${FILEOWNER} "${tmpgoldencache}"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis /bin/rm -f "${tmpgoldencache}" >/dev/null 2>&1
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # There wasn't an existing ppdcache. Install the newly
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # generated ppdcache file to the golden ppdcache.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis set_perms ${FILEMODE} ${FILEOWNER} "${tmpgoldencache}"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis /bin/mv -f "${tmpgoldencache}" "${GOLDCACHE}" >/dev/null 2>&1
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Returns a list of PPD files that exist.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $1 - Full path to cache file
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis for centry in $(/bin/cat "${1}" 2>/dev/null) ; do
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # Keep the entry from the ppd cache if it still
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis # exists and there haven't been any modifications
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis if [[ -n "${ppdfile}" && -e "${ppdfile}" &&
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Returns 0 if the path to the PPD is as follows:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# <PPD file repository>/<label>/<manufacturer>/<PPD file>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# otherwise, returns 1
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# $1 Full path to PPD file
if debugger ; then
ppd_file_repository=${1%/*/*/*}
found=1
for repository in ${REPOSITORIES} ; do
found=0
return ${found}
if debugger ; then
vpl_rc=0
vpf_rc=0
vpl_rc=$?
vpf_rc=$?
if [[ -n ${vpl_msg} ]] ; then
gettext \
if [[ -n ${vpf_msg} ]] ; then
if debugger ; then
if debugger ; then
ulc_rc=0
if [[ $? -eq 0 ]] ; then
if [[ $? -ne 0 ]] ; then
ulc_rc=1
return ${ulc_rc}
if debugger ; then
# ppdfileext - PPD file ext (.ppd or .ppd.gz)
if debugger ; then
ppdfileext=${GEXT}
ppdfileext=${PEXT}
if debugger ; then
if debugger ; then
echo ${item%\;}
if debugger ; then
${NICKNAME} ; do
${MANUF})
${PRODUCT})
${MODEL})
${NICKNAME})
if debugger ; then
if debugger ; then
case ${1} in
${SYSTEM})
${VENDOR})
${ADMIN})
${USER})
if debugger ; then
case ${1} in
${SYSTEMREP})
${VENDORREP})
${ADMINREP})
${USERREP})
lpir_rc=1
for repository in ${REPOSITORIES} ; do
lpir_rc=0
return ${lpir_rc}
if debugger ; then
rl_rc=1
for labelname in ${RESERVEDLABELS} ; do
rl_rc=0
return ${rl_rc}
if debugger ; then
if debugger ; then
vsl_rc=0
vsl_rc=1
vsl_rc=1
vsl_rc=1
if [[ $? -eq 0 ]] ; then
vsl_rc=1
return ${vsl_rc}
# the destination label/repository.
if debugger ; then
# $2 - Directory owner (i.e., root:lp)
if debugger ; then
uc_rc=0
for dstreppath in ${rname} ; do
if [[ $? -ne 0 ]] ; then
uc_rc=1
return ${uc_rc}
ppdmgr_exit ${FAIL}
add_ppd_rc=$?
apm_rc=$?
path_in_msg=$?
gettext \