#!/sbin/sh # # ident "@(#)pprosetup.sh 1.27 05/03/14 SMI" # # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Declare an interrupt handler to catch various signals. # trap intrHandler INT HUP KILL TERM # Re-enable the echo on stty, and do the clean up. # intrHandler() { stty echo } JAVACMD=/usr/bin/java PROCESSFILE=/var/tmp/patchproprocs Background="true" CLASSNAME=PatchProSetup PKGNAME=com.sun.patchpro.cli PATHNAME=com/sun/patchpro/cli PRG=$0 SDBLIBNAME=usr/lib/patch/simpledb.jar PKGINFO="/usr/bin/pkginfo" PKGCMDARGS="" NAWK="/usr/bin/nawk" ############################################################################## # Set up localization text domain TEXTDOMAIN=SUNW_PATCHMGR_CLI_SCRIPTS export TEXTDOMAIN usage() { gettext -s "usage: pprosetup {-[[D | W | M ] -s ]" gettext -s " -d -p " gettext -s " -H } | -L" exit 1; } checkForNonRootOps() { # # Process all of the command line arguments. # NoRootCheck=0 for i in $*; do case $i in -@) NoRootCheck=1; shift;; -*) shift;; esac done } # # Confirm that the user is root. # confirmRoot() { if [ "$NoRootCheck" -ne 1 ]; then Uid=`id | sed 's/uid=\([0-9]*\)(.*/\1/'` if [ "$Uid" -ne 0 ]; then gettext -s "ERROR: Only the root user can execute this script." exit 1 fi fi } # # set up all paths to all the various executables, classes and libraries getPaths() { BIN_DIRECTORY=`dirname $PRG` BIN_PROGRAM=`basename $PRG` if [ "$BIN_DIRECTORY" = "." ]; then BIN_DIRECTORY=`pwd` PRG=${BIN_DIRECTORY}/${BIN_PROGRAM} fi CLS_DIRECTORY=`dirname $BIN_DIRECTORY`/lib/patch/patchpro.jar SDB_LIBRARY=`dirname $BIN_DIRECTORY`/lib/patch/simpledb.jar PLUGINS_DIRECTORY=`dirname $BIN_DIRECTORY`/lib/patch CLASSPATHEXT="${CLS_DIRECTORY}:${SDB_LIBRARY}:${PLUGINS_DIRECTORY}" # # Set up CLASSPATH. # CLASSFILE="${CLASSNAME}.class" if [ -z "${CLASSPATH}" ]; then CLASSPATH=${CLASSPATHEXT} else CLASSPATH=${CLASSPATHEXT}:${CLASSPATH} fi CLS_DIRECTORY="" CLASSPATHLIST=`echo $CLASSPATH | sed s/:/\ /g` # See if we can find the class #for dir in ${CLASSPATHLIST}; do # if [ -f $dir/${PATHNAME}/${CLASSFILE} ]; then # CLS_DIRECTORY=$dir # break; # fi #done #if [ -z "${CLS_DIRECTORY}" ]; then # gettext -s "ERROR: Couldn't find $PKGNAME.$CLASSNAME." # exit 1 #fi export CLASSPATH classname=${PKGNAME}.${CLASSNAME} classpath=${CLS_DIRECTORY}/${PATHNAME}/${CLASSFILE} } # # Construct the command # constructCmd() { fullCommand="${JAVACMD} " fullCommand="${fullCommand} ${classname}" } # # Main routine # # set umask to ensure that files altered by Java have appropriate permissions umask 0022 checkForNonRootOps $* confirmRoot getPaths constructCmd ${fullCommand} "$@" -y$$