#!/bin/sh # Copyright 1999 Sun Microsystems, Inc. All rights reserved. # Copyright 1999 Sun Microsystems, Inc. Tous droits réservés. # pragma ident "@(#)postinstall 1.12 99/05/16 Sun Microsystems" #================================================= # Check for Fonts #------------------------------------------------- CheckFonts() { # Warn when expected font packages are not present. # case `uname -r` in 5.5*) # No checks for Solaris 2.5.1. ;; 5.*) # Compain about lack of default fonts common to all locales. pkginfo -q SUNWi1of if [ $? -ne 0 ] then echo echo "Warning! It is strongly recommended that the following font package" echo "be installed for all locales:" echo echo " SUNWi1of" echo fi # Compain about lack of default fonts for specific locales. # Build a list of missing packages. fontPkgs="SUNWi2of SUNWi2rf SUNWi4of SUNWi4rf SUNWi5of SUNWi7of \ SUNWi7rf SUNWi9of SUNWi9rf SUNWjxcft SUNWkcoft \ SUNWcttf SUNWhttf SUNW5xfnt" missingPkgs= for fontPkg in $fontPkgs do pkginfo -q $fontPkg if [ $? -ne 0 ] then missingPkgs=$missingPkgs" "$fontPkg fi done if [ "X$missingPkgs" != "X" ] then echo echo "Warning! It is strongly recommended that the following font packages" echo "be installed to support locales (other than ISO8859-1 locales) as" echo "needed:" echo echo " "$missingPkgs echo fi;; esac } #================================================= # Used variables #------------------------------------------------- ARCH=`uname -p` SHARED_LINK=$BASEDIR/java SHARED_LOCATION=$BASEDIR/bin SYS_CONTENTS_FILE_NAME=contents DEV_TEST_BIT_FILE=bin/${ARCH}/native_threads/javac SYS_CONTENTS=$PKG_INSTALL_ROOT/var/sadm/install/$SYS_CONTENTS_FILE_NAME INSTALL_DIR="java1.2" #================================================= # Check if slave or master #------------------------------------------------- CheckForSlave() { PKG_VERSION=`echo $VERSION | awk '{print substr($1, 0, 3);}'` if [ "X$PKG_VERSION" = "X1.1" ]; then INSTALL_DIR="java1.1" fi OS=`uname -r` if [ -n "$DEFAULT" ]; then return 0 fi case $OS in 5.5.1 | 5.6 | 5.7 ) if [ "$PKG_VERSION" = "1.1" ]; then DEFAULT=TRUE; else CheckIfDefault if [ $? -ne 0 ]; then DEFAULT=FALSE else DEFAULT=TRUE fi fi ;; * ) if [ "$PKG_VERSION" = "1.2" ]; then DEFAULT=TRUE; else CheckIfDefault if [ $? -ne 0 ]; then DEFAULT=FALSE else DEFAULT=TRUE fi fi ;; esac } #================================================= # Check if installed 1.1 as default and install # additional pkgs for 1.1 as default too #------------------------------------------------- CheckIfDefault() { sharLinkLastRec=`grep "^$CLIENT_BASEDIR/java=" $SYS_CONTENTS | awk '{ print $(NF)}'` if [ "X$sharLinkLastRec" != "X" ]; then version=`pkginfo -l $sharLinkLastRec | awk \ '{ \ if ($1 ~ /^VERSION:/) { print substr($2, 0, 3); exit;}\ }'` if [ "X$version" = "X$PKG_VERSION" ]; then return 0; fi return 1; fi return 0; } #================================================= # If we install 1.1, then install 1.1 links to /usr/bin #------------------------------------------------- InstallLinks() { if [ ! -d "$SHARED_LOCATION" ]; then installf -c none $PKGINST $SHARED_LOCATION d 0755 root bin else installf -c none $PKGINST $SHARED_LOCATION \? fi if [ "$PKG_VERSION" = "1.1" ]; then if [ "$PKG" = "SUNWjvrt" ]; then links_strs="jar java javald jre rmiregistry appletviewer" else links_strs="javac javadoc javah java_g javap javaverify jdb \ native2ascii rmic serialver javakey" fi else RT_LINKS_STRS="java keytool policytool rmid rmiregistry tnameserv" if [ "$PKG" = "SUNWj2rt" ]; then links_strs=$RT_LINKS_STRS else links_strs="oldjava javac javah javald jarsigner \ jar javap appletviewer native2ascii rmic \ serialver jdb javadoc extcheck "$RT_LINKS_STRS fi fi for ln_str in $links_strs; do installf -c none $PKGINST "$SHARED_LOCATION/$ln_str=../java/bin/$ln_str" s done } #================================================= # Get links from dir which are pointing to /usr/java/bin/... # Var 'BITS' will bi changed #------------------------------------------------- GetBits() { BITS=`grep "^$1" $SYS_CONTENTS | grep /java/bin | \ awk 'BEGIN{strout=""; } \ { split($1,arr,"="); \ if (index(arr[2],"/usr/java/bin") || index(arr[2],"../java/bin")) { \ n=split(arr[2], a,"/"); \ strout=strout" "a[n]; \ } \ } \ END{print strout}'` } #================================================= # Check if string $2 is in the list $1 #------------------------------------------------- InTheList() { for name in $2; do if [ "$1" = "$name" ]; then return 0 fi done return 1 } #================================================= # Get installed 1.2 bits and create message file #------------------------------------------------- GetInstalledBits() { instBits=`grep "$LINKED_DIR/bin/.*=.java_wrapper" $SYS_CONTENTS | grep $PKGINST | \ awk '{split($1, ln,"="); n=split(ln[1], sl, "/"); print sl[n];}'` GetBits $CLIENT_BASEDIR/bin if [ ! -d $FLINKED_DIR/bin ]; then installf -c none $PKGINST $FLINKED_DIR/bin d 0755 root bin fi for bit in $BITS; do InTheList $bit "$instBits" if [ $? -ne 0 ]; then file=$FLINKED_DIR/bin/$bit if [ -s $file ]; then continue fi touch $file if [ $? -ne 0 ]; then return 1 fi echo "#!/bin/ksh -p" >> $file echo "" >> $file echo "echo \"This command is not installed and/or not supported in jdk $PKG_VERSION\"" >> $file echo "echo \"Please check JDK version and '/usr/java' link.\"" >> $file installf -c none $PKGINST $file f 0555 root bin fi done } #================================================= # Get installed Package Version for compare with SUNWj2rt #------------------------------------------------- GetInstalledPkgVer() { InstalledPkgVer="" pkg_def=$2 if [ "X$2" = "X" ]; then pkg_def=SUNWj2dev fi pkg_names=`grep "$1/bin d" $SYS_CONTENTS | awk '{ \ n=index($0, "SUNW"); \ str=substr($0, n); \ n=split(str, arr); \ out=""; \ for (i = n;i > 0; i--) {\ out=out" "arr[i]; }\ print out; \ }'` for name in $pkg_names; do sname=`echo $name | sed 's/\..*//'` if [ "$sname" = "$pkg_def" ]; then pkg_name=$name break fi done if [ "X$pkg_name" != "X" ]; then InstalledPkgVer=`pkginfo -l $pkg_name | awk '{if ($1 ~ /^VERSION:/) print $2;}'` fi } #================================================= # Move /usr/java link #------------------------------------------------- MoveLink() { if [ "$PKG" = "SUNWj2rt" ]; then if [ ! -f $BASEDIR/$INSTALL_DIR/$DEV_TEST_BIT_FILE ]; then LINKED_DIR=./$INSTALL_DIR/jre FLINKED_DIR=$BASEDIR/$INSTALL_DIR/jre else GetInstalledPkgVer $CLIENT_BASEDIR/$INSTALL_DIR if [ "X$InstalledPkgVer" = "X$VERSION" ]; then LINKED_DIR=./$INSTALL_DIR FLINKED_DIR=$BASEDIR/$INSTALL_DIR else LINKED_DIR=./$INSTALL_DIR/jre FLINKED_DIR=$BASEDIR/$INSTALL_DIR/jre fi fi else LINKED_DIR=./$INSTALL_DIR FLINKED_DIR=$BASEDIR/$INSTALL_DIR fi GetInstalledBits InstallLinks if [ ! -d "$PKG_INSTALL_ROOT$CLIENT_BASEDIR" ]; then installf -c none $PKGINST $BASEDIR d 0755 root bin else installf -c none $PKGINST $BASEDIR \? fi installf -c none $PKGINST "$SHARED_LINK=$LINKED_DIR" s installf -f $PKGINST if [ $? -ne 0 ]; then echo "$PKG: unable to add $SHARED_LINK to package" \ "database." 1>&2 return 2 fi } #================================================= # Roll it #------------------------------------------------- installf -f $PKGINST if [ "$PKG" = "SUNWj2rt" ]; then CheckFonts fi if [ "X$UPDATE" = "Xyes" ]; then installf -f $PKGINST exit 0; fi CheckForSlave if [ "$DEFAULT" = "FALSE" ]; then if [ ! -d "$PKG_INSTALL_ROOT$CLIENT_BASEDIR" ]; then installf -c none $PKGINST $BASEDIR d 0755 root bin else installf -c none $PKGINST $BASEDIR ? fi installf -f $PKGINST exit 0; fi MoveLink if [ $? -ne 0 ]; then installf -f $PKGINST exit 2 fi