#!/bin/ksh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # MACH=$(uname -p) OS_REVISION=$(uname -r) OS_VERSION=$(uname -v) OS_BUILD=$(expr "${OS_VERSION}" : "snv_\(.*\)") REPOSITORY=${REPOSITORY:-"http://www.opensolaris.org/os/project/presto/files"} SFE_PKGS="SFEnotification-daemon-root SFEnotification-daemon \ SFElibnotify SFElibnotify-devel" OSPM_PKGS="SUNWospm-root SUNWospm" OSPM_PKG_REV="0.1" CBSVC_PKGS="SUNWcbsvcr SUNWcbsvcu" CBSVC_PKG_REV="0.1" ADMIN="/tmp/pkg.admin.$$" PKGADD="/usr/sbin/pkgadd -n -a ${ADMIN}" PKGRM="/usr/sbin/pkgrm" reverse() { TMP="" for PKG in $* ; do TMP="$PKG $TMP" done echo $TMP } # # Make sure that we are running the latest presto-install bits. # update_presto_install() { [[ -n "${UPDATED}" ]] && return echo "Checking for updated 'presto-install'...\c" THIS_FILE=$0 [[ ! -f ${THIS_FILE} ]] && ${THIS_FILE} = $(which $0) TMP_FILE=/tmp/presto-install-$$ if ! $(wget -q -O ${TMP_FILE} ${REPOSITORY}/presto-install) ; then echo "this version will suffice" elif ! $(cmp -s ${THIS_FILE} ${TMP_FILE}) ; then echo "found, replacing...\c" (cp -f ${TMP_FILE} ${THIS_FILE} ; rm -f ${TMP_FILE}) 2>/dev/null echo "restarting new bits." export UPDATED=1 exec $0 $* else # files were the same rm -f ${TMP_FILE} 2>/dev/null echo "this version will suffice" fi } update_presto_install # # Verify that HAL supports printer discovery # if [[ ! -f /usr/lib/hal/hald-probe-printer ]] ; then cat <<-EOF You need to upgrade to a version of Solaris that contains HAL support for printer detection. We recommend the most current Solaris Nevada community build. EOF exit 1 fi # # Warn if the build is not new enough build to avoid some key bugs # if [[ ${OS_REVISION} -lt 5.11 || ${OS_BUILD} -lt 61 ]] ; then cat <<-EOF WARNING... You are running a build of Solaris Nevada that is lacking fixes for some key bugs that affect USB printer discovery. 6525048 HAL doesn't completely detect MFP devices 6533722 devfsadmd and hald are off to the races Installation will continue, but it is recommended that you upgrade to the most current Solaris Nevada community build. EOF fi # # create a pkgadd(1m) admin file so we don't have to be so interactive. # cat <<-EOF >${ADMIN} mail= instance=unique runlevel=nocheck setuid=nocheck action=nocheck partial=quit idepend=nocheck rdepend=nocheck conflict=quit EOF # # Check for *notify* support # if [[ ! -L /usr/lib/libnotify.so ]] ; then echo "installing *notify* support..." for PKG in ${SFE_PKGS} ; do ${PKGADD} -d ${REPOSITORY}/${PKG}-${MACH}.pkg all || exit 1 done fi # # Check for previous OSPM and Queue Discovery support to remove # for PKG in $(reverse ${OSPM_PKGS} ${CBSVC_PKGS}) ; do if ! $(pkgchk -q ${PKG} 2>/dev/null) ; then ${PKGRM} ${PKG} || exit 1 fi done # # Install the OSPM bits # for PKG in ${OSPM_PKGS} ; do ${PKGADD} -d ${REPOSITORY}/${PKG}-${OSPM_PKG_REV}-${MACH}.pkg all || exit 1 done echo "reloading gconfd..." gconftool-2 --shutdown # # Installing the Print Queue Discovery bits # for PKG in ${CBSVC_PKGS} ; do ${PKGADD} -d ${REPOSITORY}/${PKG}-${CBSVC_PKG_REV}-${MACH}.pkg all || exit 1 done echo "enabling queue discovery..." svcadm enable svc:/application/print/queue-detect:cups-browse echo "You will now need to logout of your desktop session and re-login" exit 0