Listing 1 Modified Java installation script
#!/bin/sh
PATH=/usr/bin:/bin
NODOT_VERSION=142_04
javahome=j2re1.4.2_04
PACKED_JARS="lib/rt.jar lib/jsse.jar lib/charsets.jar \
lib/ext/localedata.jar lib/plugin.jar javaws/javaws.jar"
LINUX_RPM=
JAVAWS_BIN=javaws/javaws
libthread_path=
localinstall=$1
diskSpaceRequired=50338
MIME_TYPE=application/x-java-jnlp-file
outname=install.sfx.$$
trap 'rm -f $outname; exit 1' HUP INT QUIT TERM
echo "Unpacking..."
tail +131 $0 > $outname
chmod +x $outname
echo "Extracting..."
./$outname > /dev/null 2>&1
rm -f $outname
if [ -z "$LINUX_RPM" ]; then
UNPACK_CMD=""
if [ -f $javahome/lib/unpack ]; then
UNPACK_CMD=$javahome/lib/unpack
chmod +x $UNPACK_CMD
packerror=""
for i in $PACKED_JARS; do
if [ -f $javahome/'dirname $i'/'basename $i .jar'.pack ]; then
printf "Creating %s\n" $javahome/$i
$UNPACK_CMD $javahome/'dirname $i'/'basename $i \
.jar'.pack $javahome/$i
if [ ! -f $javahome/$i ]; then
printf "Failed to unpack jar files %s. Please \
refer\n" $i
printf "to the Troubleshooting section of the \
Installation\n"
printf "Instructions on the download page for \
more information.\n"
packerror="1"
fi
rm -f $javahome/'dirname $i'/'basename $i .jar'.pack
fi
done
rm -f $UNPACK_CMD
if [ x$packerror = x1 ]; then
printf "ERROR: Installation failed. Please refer to the "
printf "Troubleshooting Section of the Installation "
printf "Instructions on the download page "
if [ -d $javahome ]; then
/bin/rm -rf $javahome
exit 2
fi
fi
fi
if [ -n "$libthread_path" ] && [ -f "$libthread_path/'uname \
-r'/libthread.so.1" ]; then
echo "Making libthread links"
ln -s 'uname -r'/libthread.so.1 $libthread_path/libthread.so.1
ln -s libthread.so.1 $libthread_path/libthread.so
fi
userid='expr "\'id\'" : ".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"'
if [ -f $HOME/.java/properties$NODOT_VERSION ]; then
if [ x$userid = "xroot" ] ; then
su $USER -c "mv -f $HOME/.java/properties$NODOT_VERSION \
$HOME/.java/_properties$NODOT_VERSION"
else
mv -f $HOME/.java/properties$NODOT_VERSION \
$HOME/.java/_properties$NODOT_VERSION
fi
fi
if [ ! x$javahome = "x" ]; then
PREFS_LOCATION=$javahome
if [ x$userid = "xroot" ] ; then
if [ x$localinstall = "x-localinstall" ] ; then
PREFS_LOCATION=/etc/.java
fi
fi
if [ ! -d $PREFS_LOCATION ] ; then
mkdir -m 755 $PREFS_LOCATION
fi
if [ ! -d $PREFS_LOCATION/.systemPrefs ] ; then
mkdir -m 755 $PREFS_LOCATION/.systemPrefs
fi
if [ ! -f $PREFS_LOCATION/.systemPrefs/.system.lock ] ; then
touch $PREFS_LOCATION/.systemPrefs/.system.lock
chmod 644 $PREFS_LOCATION/.systemPrefs/.system.lock
fi
if [ ! -f $PREFS_LOCATION/.systemPrefs/.systemRootModFile ] ; then
touch $PREFS_LOCATION/.systemPrefs/.systemRootModFile
chmod 644 $PREFS_LOCATION/.systemPrefs/.systemRootModFile
fi
fi
if [ -n "$JAVAWS_BIN" -a -z "$JAVAWS_PRIVATE" ]; then
FULLJAVAHOME='cd $javahome; pwd'
if [ -w ${HOME}/.mailcap ]; then
jGrep='grep -n ${MIME_TYPE} ${HOME}/.mailcap'
if [ -n "$jGrep" ] ; then
grep -v ${MIME_TYPE} < ${HOME}/.mailcap | grep -v \
"# Java Web Start" > /tmp/.mailcap1
mv /tmp/.mailcap1 ${HOME}/.mailcap
fi
# Doesn't contain application/x-java-jnlp-file file, add it.
echo "# Java Web Start" >> ${HOME}/.mailcap
echo "${MIME_TYPE}; $FULLJAVAHOME/$JAVAWS_BIN %s" \
>> ${HOME}/.mailcap
elif [ -w ${HOME}/ ]; then
# .mailcap doesn't exist, create it.
echo "# Java Web Start" > ${HOME}/.mailcap
echo "${MIME_TYPE}; $FULLJAVAHOME/$JAVAWS_BIN %s" \
>> ${HOME}/.mailcap
fi
if [ -w ${HOME}/.mime.types ]; then
# the file exists, make sure it contains jnlp
jGrep='grep ${MIME_TYPE} ${HOME}/.mime.types'
if [ -z "${jGrep}" ]; then
# doesn't contain Javaws, add it
echo "type=${MIME_TYPE} desc=\"Java Web Start\" \
exts=\"jnlp\"" >> ${HOME}/.mime.types
fi
elif [ -w ${HOME}/ ]; then
# Doesn't exist so create it, even though if it doesn't exist it
# implies you are not using Communicator, but we'll create it
# on the chance that you do install Communicator.
echo '#--Netscape Communications Corporation MIME Information' > \
${HOME}/.mime.types
echo '#Do not delete the above line. It is used to identify \
the file type.' >> ${HOME}/.mime.types
echo '#mime types added by Netscape Helper' >> \
${HOME}/.mime.types
echo 'type=application/x-java-jnlp-file desc="Java Web Start" \
exts="jnlp"' >> ${HOME}/.mime.types
fi
fi
fi
echo "Done."
exit 0
|