Hello, all !
This at the request of gcmartin through a PM. Thanks, gc!
It's a script to do away with the need for a java sfs or pet. I've been doing this for a couple of years now, and it works great. Just copy and paste the script in /root/my-applications/bin as Instl-Java.sh, make executable and run. (That's
I n s t l - J a v a . s h, if you care to spell it out.)
It's really a small long-distance course that coaches you on how to do it and waits for you while you do it.
Do what? Run it and you'll know! (Setting up a new JAVA, that's what!)
Enjoy!
musher0
PS Make sure you have enough space left in your pup_save file, I'd say at least 250 Mg's, to be safe: more or less 125 Mb's for the java JRE itself, the other 125 Mb's being the minimum wiggle room for the Puppy.
NB Revised script. Sincere thanks to gcmartin for the extra pair of eyes!
Code: Select all
#!/bin/ash
# ~/my-applications/bin/Instl-Java.sh
#
# Save this script as :
# ----------------
# Instl-Java.sh
#
# in the folder:
# --------------
# ~/my-applications/bin
#
# and make executable by issuing the command:
# chmod +rwx Inst-Java.sh
# in a console in that folder.
#
# (c) musher0, 21 mai 2013, Gatineau (Qc), Canada.
# All rights reserved, but "ad usum privatum" use
# is allowed for Puppy-ists.
#
# Script written at the request of gcmartin, same day.
####
# variables
# See line 85.
# preparation
[ -d /opt/java-jre ] && rmdir /opt/java/jre
# If the above link exists, we can delete it because
# there is a real JAVA folder in there somewhere as a
# backup. So we do delete it in view of the new JAVA
# version we are going to download, to avoid link errors.
# If it doesn't exist, it doesn't matter! (hehe)
sleep 0.1s
clear
# script proper
echo "
# Hi!
#
# This is a semi-automatic process for the reason
# that, for some reason, wget does not recognize
# the oracle.com site certificate. So...
#
# 1) Download the latest java JRE tar.gz package
# from oracle.com, manually.
#
# Note 1: Be sure to choose the correct jre *.tar.gz
# package for your machine, either 32-bit or 64-bit.
#
# The 32-bit archive has a \"86\" in its archive
# name/title. The 64-bit archive has a \"x64\" in
# its archive name/title.
#
# Note 2: Download to a suitable place, such as
# /mnt/home/Downloads.
#
# Your default browser will bring you to the java site
# as soon as you hit Return."
read
defaultbrowser http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html &
echo "
#####################################################
# 2) Unpack the jre-blah-blah tar file that
# you have just downloaded, with pupzip, to /opt.
# ------ ----
# Hit Return again when this step 2) is done."
read
echo "
#####################################################
# 3) Make sure that you have \"chiseled\" (:-)
# \" java -jar \"@\" \" (without the outside quotes)
# as the defined default action for jar files in
# your ROX-Filer. ---
#
# 4) Once you're sure you have successfully
# completed the above steps...
# hit Return to execute the fancy linking! (:-)
#
# If in doubt, hit \"Ctrl-C\" and start over."
read
#
NEWJAVA="`ls -urgod jre* | head -n 1 | cut -d' ' -f6`"
#
cd /opt
chmod +rwx /opt/$NEWJAVA/bin/*
# Makes the java executables... executable!
sleep 0.1s
ln -sf "$NEWJAVA" java-jre
echo "
#####################################################
# The script just made a link from the last accessed
# java archive to a \"java-jre\" directory in /opt.
#
# Un-tarring or un-packing a file or folder counts as
# an access, so the last accessed java package is the
# one you just downloaded and unpacked, even if you
# have older versions of java in /opt.
#
# Hit Return again to finish."
read
cd ~/my-applications/bin
ln -sf /opt/java-jre/bin*
echo "
#####################################################
# Done! The links to your path have now been created,
# and ... your new java $NEWJAVA is ready to go! :)
#
# Simply repeat this process every time a new JRE
# is published. The script is made to overwrite any
# existing links so they can be re-used over, & over,
# & over, & over. (Yep, there's an echo... (:-) )
#
# Have fun with your new java!
#
# musher0
# Gatineau (Qc), Canada, May 21, 2013
"
# We make it available now and for future sessions.
# set -xe
[ ! -f /etc/profile.local ] && echo < /etc/profile.local
echo "$PATH" > /tmp/path
if [ ! "`grep -o \"java-jre\" /tmp/path`" = "java-jre" ];then
PATH=/opt/java-jre/bin:$PATH
echo "PATH=/opt/java-jre/bin:\$PATH" >> /etc/profile.local
fi
rm /tmp/path
echo "$LD_LIBRARY_PATH" > /tmp/lib-path
if [ ! "`grep -o \"java-jre\" /tmp/lib-path`" = "java-jre" ];then
LD_LIBRARY_PATH=/opt/java-jre/lib:$LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH=/opt/java-jre/lib:\$LD_LIBRARY_PATH" >> /etc/profile.local
fi
rm /tmp/lib-path
# set +xe