Author |
Message |
Uten

Joined: 29 Jan 2008 Posts: 129
|
Posted: Fri 09 Aug 2013, 04:27 Post subject:
script to make java.sfs Subject description: This wil get the latest java release and make an sfs file of it |
|
EDIT: @rerwin has done a fine job at merging this with several other scripts and options to make a java.sfs http://murga-linux.com/puppy/viewtopic.php?t=101592
This script is discontinued. Use @rerwin's
This post contains a script that hopefully will make your life as a java user easier. It is meant to work out of the box. But as our mileage varies a short tutorial on how to get started follows:
* Copy the code bellow to your favorite editor and save the file as sfs-java.sh in folder /root/my-applications/bin. The name is important as it is used to check if the script is running as a standalone application or sourced by another application.
* Make the script executable by either 1: select it with Ctrl+<left click> in ROX. Then <right click> and select permissions. Then select a+x and OK. or 2: Open a terminal and write chmod +x /root/my-applications/bin/sfs-java.sh
* Now you can run the script from either ROX by <left click> on it. Or from the terminal by issuing the command sfs-java.sh
* When the script finishes the new sfs can be found in /tmp/java-sfs/. The name should be something like jre1.8.0_40.sfs.
* Now you can load the file by <left click> it in ROX. Since the file is located in /tmp you will get some a question whether you would like to move it before you load it. I have experienced conflicts when loading sfs files from /tmp so I recommend you accept to move it.
* When the sfs is loaded you should get a dialog offering to run the java control applet. If it is your first attempt I suggest running it as it will confirm that java is accessible and installed correctly by showing the dialog.
* To confirm that it works with your browser try the link http://java.com/en/download/installed8.jsp?detect=jre
* I'm not into java applications but jedit worked out of the box after loading the sfs. (I downloaded the java based installer )
* Or check out one of the other java applications know to have worked with puppylinux in this thread.
I you like this sfs making script you might like my sfs-seamonkey,sh or my sfs-firefox.sh script.
Code: | #!/usr/bin/env bash
# CREATED_BY: uten: http://murga-linux.com/puppy/profile.php?mode=viewprofile&u=9467
#
# SCRIPT_NAME: sfs-java.sh
#
# PURPOSE: Download latest java files and reate a java sfs file to be used
# with puppylinux
#
# HOMEPAGE: http://murga-linux.com/puppy/viewtopic.php?p=835995
#
# TODO: * Add shunit2 unit test of all functions
# * Add commandline configuration
# * Add help description
# * Cleanup variable names and usage
# * Cleanup function need some thought and work
# * Pristine function need some thought and work
# * Download function should have a local repository option
#
#
# CHANGELOG: Format >> Version: User: Description:
#
# 0.1 Uten Initial release
# 0.1.1 Uten Changed some sed scripts to reflect changes in download pages.
# 0.1.2 Uten Moved linking to /etc/init.d/java.sfs.sh [start] [stop] script
# 0.1.3 Uten Added desktop files. See Menu->Setup->Java control applet
# 0.2.0 Uten Released new version
# 0.2.1 Uten Added java_add_mime_support
# 0.2.2 Uten Added java_include_self
# 0.2.3 Uten Added more error handeling
# 0.2.4 Uten Changed shebang to use env
#
{ # Initial Configuration
THIS_FILE_NAME="sfs-java.sh" #NOTICE: Must be the script file name, used to do test.
THIS_BASENAME=$(basename $0)
TERMINATE_ON_ERROR='True' # If set then err function will terminate script on error
JAVA_SCRIPT_VERSION='0.2.3'
CUR_DIR=$(pwd)
}
function java_set_defaults(){ # Set default values to global variables
#format: variable=${variable-defaultvalue}
WORK_FOLDER=${WORK_FOLDER:-"/tmp"}
TARGET_PATH=${TARGET_PATH:-$WORK_FOLDER/java-sfs}
JAVA_VERSION=${JAVA_VERSION:-7u25} #jre-7u21-linux-i586
JAVA_PATH_VERSION_NAME=${JAVA_PATH_VERSION_NAME:-$(echo $JAVA_VERSION|sed 's/\([0-9]\+\)u\([0-9]\+\)/jre1\.\1\.0_\2/')}
JAVA_BUNDLE_ID=${JAVA_BUNDLE_ID:-78695} #78695=7u25, 76851=7u21, 75250
# TODO: Figure out JAVA_PATH from the unpacked JAVA_VERSION file. Should be
# something like ls $TARGET_PATH/opt/jre*
JAVA_PATH=/opt/jre-$JAVA_VERSION
JAVA_BASE_PATH=${JAVA_BASE_PATH:-"/opt"}
JAVA_PATH=${JAVA_PATH:-$JAVA_BASE_PATH/$JAVA_PATH_VERSION_NAME} #/opt/jre1.7.0_21
#
# JAVA_URL is the url ju get from the download link at www.java.com
# I think number in BundleId=73132 is the only thing changing
JAVA_URL=${JAVA_URL:-"http://javadl.sun.com/webapps/download/AutoDL?BundleId="}
JAVA_WGET_TEMP_FILE=${JAVA_WGET_TEMP_FILE:-/tmp/sfs-java.sh.tmp}
}
function java_dump_variables() { #
echo "WORK_FOLDER:=" $WORK_FOLDER
echo "TARGET_PATH:=" $TARGET_PATH
echo "JAVA_VERSION:=" $JAVA_VERSION
echo "JAVA_PATH_VERSION_NAME:=" $JAVA_PATH_VERSION_NAME
echo "JAVA_BUNDLE_ID:=" $JAVA_BUNDLE_ID
echo "JAVA_BASE_PATH:=" $JAVA_BASE_PATH
echo "JAVA_PATH:=" $JAVA_PATH
echo "JAVA_URL:=" $JAVA_URL
echo "JAVA_WGET_TEMP_FILE:=" $JAVA_WGET_TEMP_FILE
}
function err() { # $? [msg]
# If TERMINATE_ON_ERROR has a value script will terminate
local err=${1:-1}
local COLOR_LIGHT_RED='\e[91m'
local COLOR_BOLD='\e[1m'
local COLOR_RESET='\e[0m'
if [ $# -gt 0 ] && [ $1 -gt 0 ]; then
local msg=${2:-'no err msg'}
local funcname=${FUNCNAME[1]}
local line=${BASH_LINENO[0]}
local script=${BASH_SOURCE[1]}
echo -e "${COLOR_LIGHT_RED}${COLOR_BOLD}ERR ${COLOR_RESET}($line) err:=$err, $msg :: [$funcname] [$script]"
if [ -n $TERMINATE_ON_ERROR ]; then
echo "----------------------------------------------------------------"
java_dump_variables
echo "----------------------------------------------------------------"
echo "terminating due to error $err"
exit $1
fi
fi
return $1
}
function java_get_version_info () { # Get info about the latest java.com release
local ret=0
echo "#TODO: NOTICE: java_get_version_info NOT COMPLETED!"
# Get information
JAVA_VERSION="~~~"
JAVA_BUNDLE_ID="~~~"
wget -O $JAVA_WGET_TEMP_FILE http://www.java.com/en/download/manual.jsp
err $? "wget failed to get manual download information"
if [ -f $JAVA_WGET_TEMP_FILE ]; then
JAVA_BUNDLE_ID=$( grep 'Linux".*" onclick' $JAVA_WGET_TEMP_FILE| sed -n 's/.*=\([0-9]\+\)\".*/\1/p' |sed 1q )
err $? "Failed to parse bundle id"
echo "JAVA_BUNDLE_ID:=" $JAVA_BUNDLE_ID
JAVA_VERSION=$( sed -n 's/.*Version \([0-9]\+\) Update \([0-9]\+\).*/\1u\2/p' "$JAVA_WGET_TEMP_FILE" )
err $? "Failed to parse version info"
echo "JAVA_VERSION:=" $JAVA_VERSION
if [ $ret -eq 0 ]; then
echo "TODO: DELETING: $JAVA_WGET_TEMP_FILE"
#rm -f $JAVA_WGET_TEMP_FILE
fi
else
err 1 "Could not locate $JAVA_WGET_TMP_FILE"
fi
#Copy from java_set_defaults
JAVA_PATH=/opt/jre-$JAVA_VERSION
JAVA_BASE_PATH=${JAVA_BASE_PATH:-"/opt"}
JAVA_PATH=${JAVA_PATH:-$JAVA_BASE_PATH/$JAVA_PATH_VERSION_NAME} #/opt/jre1.7.0_21
#
# JAVA_URL is the url ju get from the download link at www.java.com
# I think number in BundleId=73132 is the only thing changing
JAVA_URL=${JAVA_URL:-"http://javadl.sun.com/webapps/download/AutoDL?BundleId="}
JAVA_WGET_TEMP_FILE=${JAVA_WGET_TEMP_FILE:-/tmp/sfs-java.sh.tmp}
JAVA_PATH_VERSION_NAME=$(echo $JAVA_VERSION|sed 's/\([0-9]\+\)u\([0-9]\+\)/jre1\.\1\.0_\2/')
err $? "Failed to parse JAVA_PATH_VERSION_NAME"
}
function java_add_mime_support() { # Add jar mime support to rox
local ret=0
local d="$TARGET_PATH/root/.config/rox.sourceforge.net/MIME-types/"
local f="$d/application_x-java-archive"
if [ ! -d $d ]; then
mkdir -p "$d"
fi
if [ ! -e $f ]; then
cat << 'EOF' > $f
#! /bin/sh
exec java -jar "$@"
EOF
fi
return $ret
}
function java_include_self() { # Include this script in sfs
local ret=0
local f=$0
local d="$TARGET_PATH/root/my-applications/bin"
if [ ! -d $d ]; then
mkdir -p "$d"
fi
cp -f "$f" "$d"
err $? "Could not copy $f to $d"
return $ret
}
function java_write_init_d_script() { # Create a init.d script to get linking right
mkdir -p $TARGET_PATH/etc/init.d/
err $? "Could not mkdir $TARGET_PATH/etc/init.d/"
cat << 'EOF' > $TARGET_PATH/etc/init.d/java.sfs.sh
#!/usr/bin/env bash
JAVA_PATH=SED_WRITE_JAVA_PATH
LOGFILE=/tmp/java.sfs.sh.log
function remove_plugin_links() {
rm /usr/lib/firefox/plugins/libnpjp2.so
rm /usr/lib/firefox/plugins/libjavaplugin_nscp_gcc29.so
rm /usr/lib/firefox/plugins/libjavaplugin_nscp.so
rm /usr/lib/firefox/plugins/libjavaplugin_oji.so
rm /usr/lib/firefox/plugins/libjavaplugin_jni.so
rm /usr/lib/mozilla/plugins/libnpjp2.so
rm /usr/lib/mozilla/plugins/libjavaplugin_nscp_gcc29.so
rm /usr/lib/mozilla/plugins/libjavaplugin_nscp.so
rm /usr/lib/mozilla/plugins/libjavaplugin_oji.so
rm /usr/lib/mozilla/plugins/libjavaplugin_jni.so
}
function fix_plugin_links() {
#
# Make nescessary plugin folders
mkdir -p /usr/lib/firefox/plugins/
mkdir -p /usr/lib/mozilla/plugins/
ln -s -f -T $JAVA_PATH/lib/i386/libnpjp2.so /usr/lib/firefox/plugins/libnpjp2.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_nscp_gcc29.so /usr/lib/firefox/plugins/libjavaplugin_nscp_gcc29.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_nscp.so /usr/lib/firefox/plugins/libjavaplugin_nscp.so
ln -s -f -T $JAVA_PATH/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins/libjavaplugin_oji.so
#ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_oji.so /usr/lib/firefox/plugins/libjavaplugin_oji.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_jni.so /usr/lib/firefox/plugins/libjavaplugin_jni.so
ln -s -f -T $JAVA_PATH/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins/libnpjp2.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_nscp_gcc29.so /usr/lib/mozilla/plugins/libjavaplugin_nscp_gcc29.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_nscp.so /usr/lib/mozilla/plugins/libjavaplugin_nscp.so
ln -s -f -T $JAVA_PATH/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin_oji.so
#ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin_oji.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_jni.so /usr/lib/mozilla/plugins/libjavaplugin_jni.so
}
function fix_java_links() {
local ret=0
mkdir -p $TARGET_PATH/usr/bin
#
# Make links to java programs
ln -s -f $JAVA_PATH/bin/keytool /usr/bin/keytool
ln -s -f $JAVA_PATH/bin/pack200 /usr/bin/pack200
ln -s -f $JAVA_PATH/bin/orbd /usr/bin/orbd
ln -s -f $JAVA_PATH/bin/servertool /usr/bin/servertool
ln -s -f $JAVA_PATH/bin/policytool /usr/bin/policytool
ln -s -f $JAVA_PATH/bin/java_vm /usr/bin/java_vm
ln -s -f $JAVA_PATH/bin/javaws /usr/bin/javaws
ln -s -f $JAVA_PATH/bin/rmid /usr/bin/rmid
ln -s -f $JAVA_PATH/bin/rmiregistry /usr/bin/rmiregistry
ln -s -f $JAVA_PATH/bin/java /usr/bin/java
ln -s -f $JAVA_PATH/bin/ControlPanel /usr/bin/ControlPanel
ln -s -f $JAVA_PATH/bin/tnameserv /usr/bin/tnameserv
ln -s -f $JAVA_PATH/bin/unpack200 /usr/bin/unpack200
ln -s -f $JAVA_PATH/bin/jcontrol /usr/bin/jcontrol
return $ret
}
function remove_java_links() { #
local ret=0
rm /usr/bin/keytool
rm /usr/bin/pack200
rm /usr/bin/orbd
rm /usr/bin/servertool
rm /usr/bin/policytool
rm /usr/bin/java_vm
rm /usr/bin/javaws
rm /usr/bin/rmid
rm /usr/bin/rmiregistry
rm /usr/bin/java
rm /usr/bin/ControlPanel
rm /usr/bin/tnameserv
rm /usr/bin/unpack200
rm /usr/bin/jcontrol
return $ret
}
function start() { #
echo "start: $0" >> $LOGFILE
local ret=0
fix_java_links || ret+=$?
fix_plugin_links || ret+=$?
return $ret
}
function stop() { #
echo "stop: $0" >> $LOGFILE
local ret=0
remove_java_links || ret+=$?
remove_plugin_links || ret+=$?
return $ret
}
function script_main() { #
local ret=0
case "$1" in
start)
start || ret=$?
;;
stop)
stop || ret=$?
;;
esac
return $ret
}
script_main $@
exit $?
EOF
sed -i "s@SED_WRITE_JAVA_PATH@/opt/$JAVA_PATH_VERSION_NAME@" $TARGET_PATH/etc/init.d/java.sfs.sh
chmod +x $TARGET_PATH/etc/init.d/java.sfs.sh
}
function java_unpack_java(){ # Unpack the downloaded binaries
# TODO_CODE: Verify that wget did not fail
#
# Unpack java
# TODO_CODE: Verify directories
local ret=0
if [ ! -e $TARGET_PATH/opt ]; then
echo "NOTE: Creating: $TARGET_PATH/opt"
mkdir -p $TARGET_PATH/opt
fi
if [ ! -e $TARGET_PATH/opt/$JAVA_VERSION ]; then
#tar --checkpoint=1500 --directory=$TARGET_PATH/opt/ -axf ./jre-$JAVA_VERSION.tar.gz
echo "NOTE: $(pwd)/jre-$JAVA_VERSION.tar.gz unpacking to $TARGET_PATH/opt/"
tar --checkpoint=1500 --directory=$TARGET_PATH/opt/ -axf ./jre-$JAVA_VERSION.tar.gz
fi
sync
return $ret
}
function java_download_java(){ # Download the java version/bundleid
#
# Download java
local ret=0
if [ ! -z "$JAVA_VERSION" ]; then
if [ ! -z "$JAVA_BUNDLE_ID" ]; then
echo "NOTE: DOWNLOAD: $JAVA_URL$JAVA_BUNDLE_ID"
wget -nc $JAVA_URL$JAVA_BUNDLE_ID -O ./jre-$JAVA_VERSION.tar.gz
else
err 1 "JAVA_BUNDLE_ID unresolved. Terminating."
ret=$?
fi
else
err 1 "JAVA_VERSION:=$JAVA_VERSION is unresolved. Terminating"
ret=$?
fi
return $ret
}
function java_help(){ # Write out help information
echo "TODO: java_help not implemeneted"
}
function java_clean(){ #
local ret=0
if [ "$1" == "--clean" -o "$1" == "--pristine" ]; then
rm -rf $WORK_FOLDER/$TARGET_PATH/opt/$JAVA_PATH_VERSION_NAME
# TODO_CODE: clean up links? Can't just remove directories as
# that will remove other apps stuff.
fi
return $ret
}
function java_pristine(){ #
local ret=0
if [ "$1" == "--pristine" ]; then
rm -f ./$JAVA_VERSION.tar.gz
fi
return $ret
}
function java_make_sfs() { # Make the new sfs file
local ret=0
#
# Create the sfs file
#TODO: Usage of WORK_FOLDER, TARGET_PATH and JAVA_PATH_NAME is
# incosistent with other scripts.
# if [ $WORK_FOLDER=='' || $TARGET_PATH=='' ]; then
# echo "WARNING: could not resolve WORK_FOLDER or TARGET_PATH"
# exit 0
# else
cd $TARGET_PATH/
echo "mksquashfs:= $TARGET_PATH $JAVA_PATH_VERSION_NAME.sfs -noappend"
mksquashfs $TARGET_PATH $JAVA_PATH_VERSION_NAME.sfs -noappend
err $? "mksquashfs failed"
ret=$?
# fi
return $ret
}
function java_link_desktop() { # Copy and modify sun's desktop integration file
local ret=0
mkdir -p $TARGET_PATH/usr/share/applications
mkdir -p $TARGET_PATH/usr/share/icons
mv $TARGET_PATH/opt/$JAVA_PATH_VERSION_NAME/plugin/desktop/*.desktop $TARGET_PATH/usr/share/applications/
mv $TARGET_PATH/opt/$JAVA_PATH_VERSION_NAME/plugin/desktop/*.png $TARGET_PATH/usr/share/icons
err $? "mv failed to move dektop files?"
sed -i 's/Categories.*/Categories=X-SetupEntry/' $TARGET_PATH/usr/share/applications/sun_java.desktop
sed -i 's@Icon.*@Icon=/usr/share/icons/sun_java.png@' $TARGET_PATH/usr/share/applications/sun_java.desktop
sed -i 's@Name=.*@Name=Java control applet@' $TARGET_PATH/usr/share/applications/sun_java.desktop
return $?
}
function java_main() { # Main function in script
java_set_defaults || err 99 "java_set_defaults failed"
java_get_version_info || err 99 "java_get_version_info failed"
java_dump_variables || err 99 "java_dump_variables failed"
java_clean || err 99 "java_clean failed"
#java_pristine || err 99 "java_pristine failed"
java_download_java || err 99 "java_download_java failed"
java_unpack_java || err 99 "java_unpack_java failed"
java_write_init_d_script || err 99 "java_write_init_d_script failed"
java_link_desktop || err 99 "java_link_desktop failed"
java_include_self || err 99 "java_include_self failed"
java_add_mime_support || err 99 "java_add_mime_support failed"
}
#
# TODO_CODE: Make java.desktop and icon references.
if [ "$THIS_FILE_NAME" == $THIS_BASENAME ]; then
#TODO: Shuld use push and pop (folder)?
CUR_FOLDER=$(pwd)
java_main || err 99 "java_main failed"
java_make_sfs || err 99 "java_make_sfs failed"
cd $CUR_FOLDER
else
java_main
fi
|
EDIT: New version 0.2.0. Copy content to /root/my-applications/bin/sfs-java.sh
EDIT: New version 0.2.4
EDIT: Added short tutorial at the top of this post. Moved edit explanation down to the bottom.[/b]
EDIT: Added link to thread with java applications people use ( thanks to @gcmartin for the link ).[url][/url]
Last edited by Uten on Wed 18 Apr 2018, 19:37; edited 5 times in total
|
Back to top
|
|
 |
Uten

Joined: 29 Jan 2008 Posts: 129
|
Posted: Sun 11 Aug 2013, 06:22 Post subject:
|
|
How I use it with firefox is explained here
|
Back to top
|
|
 |
Uten

Joined: 29 Jan 2008 Posts: 129
|
Posted: Wed 25 Mar 2015, 20:17 Post subject:
|
|
New version posted in first post: The old one (version 0.1.x) is here:
Code: | [code]#!/bin/bash
#NOTE: Normally Sourced by configure.sh, seamonkey-sfs.sh, firefox-sfs.sh
THIS_FILE_NAME="sfs-java.sh" #NOTICE: Must be the script file name, used to do test.
THIS_BASENAME=$(basename $0)
echo
echo "START: " $THIS_BASENAME " at " $(pwd)
function java_set_defaults(){
#format: variable=${variable-defaultvalue}
WORK_FOLDER=${WORK_FOLDER-"/tmp"}
TARGET_PATH=${TARGET_PATH-$WORK_FOLDER/java-sfs}
JAVA_VERSION=${JAVA_VERSION-7u25} #jre-7u21-linux-i586
JAVA_PATH_VERSION_NAME=${JAVA_PATH_VERSION_NAME-$(echo $JAVA_VERSION|sed 's/\([0-9]\+\)u\([0-9]\+\)/jre1\.\1\.0_\2/')}
JAVA_BUNDLE_ID=${JAVA_BUNDLE_ID-78695} #78695=7u25, 76851=7u21, 75250
# TODO: Figure out JAVA_PATH from the unpacked JAVA_VERSION file. Should be
# something like ls $TARGET_PATH/opt/jre*
#JAVA_PATH=/opt/$JAVA_VERSION
JAVA_BASE_PATH=${JAVA_BASE_PATH-"/opt"}
JAVA_PATH=${JAVA_PATH-$JAVA_BASE_PATH/$JAVA_PATH_VERSION_NAME} #/opt/jre1.7.0_21
#
# JAVA_URL is the url ju get from the download link at www.java.com
# I think number in BundleId=73132 is the only thing changing
JAVA_URL=${JAVA_URL-"http://javadl.sun.com/webapps/download/AutoDL?BundleId="}
JAVA_WGET_TEMP_FILE=${JAVA_WGET_TEMP_FILE-/tmp/sfs-java.sh.tmp}
}
function java_dump_variables() {
echo "WORK_FOLDER:=" $WORK_FOLDER
echo "TARGET_PATH:=" $TARGET_PATH
echo "JAVA_VERSION:=" $JAVA_VERSION
echo "JAVA_PATH_VERSION_NAME:=" $JAVA_PATH_VERSION_NAME
echo "JAVA_BUNDLE_ID:=" $JAVA_BUNDLE_ID
echo "JAVA_BASE_PATH:=" $JAVA_BASE_PATH
echo "JAVA_PATH:=" $JAVA_PATH
echo "JAVA_URL:=" $JAVA_URL
echo "JAVA_WGET_TEMP_FILE:=" $JAVA_WGET_TEMP_FILE
}
function java_get_version_info () {
echo "#TODO: NOTICE: java_get_version_info NOT COMPLETED!"
# Get information
JAVA_VERSION="~~~"
JAVA_BUNDLE_ID="~~~"
wget -O $JAVA_WGET_TEMP_FILE http://www.java.com/en/download/manual.jsp
if [ -f $JAVA_WGET_TEMP_FILE ]; then
JAVA_BUNDLE_ID=$( grep 'Linux".*" onclick' $JAVA_WGET_TEMP_FILE| sed -n 's/.*=\([0-9]\+\)\".*/\1/p' |sed 1q )
echo "JAVA_BUNDLE_ID:=" $JAVA_BUNDLE_ID
JAVA_VERSION=$( sed -n 's/.*Version \([0-9]\+\) Update \([0-9]\+\) .*/\1u\2/p' "$JAVA_WGET_TEMP_FILE" )
echo "JAVA_VERSION:=" $JAVA_VERSION
rm -f
else
echo "ERROR: Could not locate " $JAVA_WGET_TMP_FILE
fi
JAVA_PATH_VERSION_NAME=$(echo $JAVA_VERSION|sed 's/\([0-9]\+\)u\([0-9]\+\)/jre1\.\1\.0_\2/')
}
function java_fix_java_links() {
mkdir -p $TARGET_PATH/usr/bin
cd $TARGET_PATH
#
# Make links to java programs
ln -s -f -T $JAVA_PATH/bin/keytool ./usr/bin/keytool
ln -s -f -T $JAVA_PATH/bin/pack200 ./usr/bin/pack200
ln -s -f -T $JAVA_PATH/bin/orbd ./usr/bin/orbd
ln -s -f -T $JAVA_PATH/bin/servertool ./usr/bin/servertool
ln -s -f -T $JAVA_PATH/bin/policytool ./usr/bin/policytool
ln -s -f -T $JAVA_PATH/bin/java_vm ./usr/bin/java_vm
ln -s -f -T $JAVA_PATH/bin/javaws ./usr/bin/javaws
ln -s -f -T $JAVA_PATH/bin/rmid ./usr/bin/rmid
ln -s -f -T $JAVA_PATH/bin/rmiregistry ./usr/bin/rmiregistry
ln -s -f -T $JAVA_PATH/bin/java ./usr/bin/java
ln -s -f -T $JAVA_PATH/bin/ControlPanel ./usr/bin/ControlPanel
ln -s -f -T $JAVA_PATH/bin/tnameserv ./usr/bin/tnameserv
ln -s -f -T $JAVA_PATH/bin/unpack200 ./usr/bin/unpack200
ln -s -f -T $JAVA_PATH/bin/jcontrol ./usr/bin/jcontrol
}
function java_fix_plugin_links() {
cd $TARGET_PATH
echo "NOW IN: " $(pwd) " WAS IN: " $CUR_FOLDER
#
# Make nescessary plugin folders
echo "MAKE plugins folders in " $(pwd)
mkdir -p $TARGET_PATH/usr/lib/firefox/plugins/
mkdir -p $TARGET_PATH/usr/lib/mozilla/plugins/
sync
# TODO_CODE: VERIFY
# mkdir -p ./root/.mozilla/plugins
#ln -s -f -T $JAVA_PATH/plugin/i386/ns7/libjavaplugin_oji.so ./root/.mozilla/plugins/libjavaplugin_oji.so
#ln -s -f -T $JAVA_PATH/lib/i386/libnpjp2.so ./root/.mozilla/plugins/libnpjp2.so
if [ 1 -eq 1 ]; then
#
# Create the plugin links so seamonkey and firefox can find java
# RESOURCE: http://plugindoc.mozdev.org/linux.html
# libnpjp2.so is suposed to work with resent versions of firefox and seamonkey.
ln -s -f -T $JAVA_PATH/lib/i386/libnpjp2.so ./usr/lib/firefox/plugins/libnpjp2.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_nscp_gcc29.so ./usr/lib/firefox/plugins/libjavaplugin_nscp_gcc29.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_nscp.so ./usr/lib/firefox/plugins/libjavaplugin_nscp.so
ln -s -f -T $JAVA_PATH/plugin/i386/ns7/libjavaplugin_oji.so ./usr/lib/firefox/plugins/libjavaplugin_oji.so
#ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_oji.so ./usr/lib/firefox/plugins/libjavaplugin_oji.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_jni.so ./usr/lib/firefox/plugins/libjavaplugin_jni.so
ln -s -f -T $JAVA_PATH/lib/i386/libnpjp2.so ./usr/lib/mozilla/plugins/libnpjp2.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_nscp_gcc29.so ./usr/lib/mozilla/plugins/libjavaplugin_nscp_gcc29.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_nscp.so ./usr/lib/mozilla/plugins/libjavaplugin_nscp.so
ln -s -f -T $JAVA_PATH/plugin/i386/ns7/libjavaplugin_oji.so ./usr/lib/mozilla/plugins/libjavaplugin_oji.so
#ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_oji.so ./usr/lib/mozilla/plugins/libjavaplugin_oji.so
ln -s -f -T $JAVA_PATH/lib/i386/libjavaplugin_jni.so ./usr/lib/mozilla/plugins/libjavaplugin_jni.so
fi
}
function java_unpack_java(){
# TODO_CODE: Verify that wget did not fail
#
# Unpack java
# TODO_CODE: Verify directories
if [ ! -e $TARGET_PATH/opt ]; then
echo "NOTE: Creating: $TARGET_PATH/opt"
mkdir -p $TARGET_PATH/opt
fi
if [ ! -e $TARGET_PATH/opt/$JAVA_VERSION ]; then
#tar --checkpoint=1500 --directory=$TARGET_PATH/opt/ -axf ./jre-$JAVA_VERSION.tar.gz
echo "NOTE: ./jre-$JAVA_VERSION.tar.gz unpacking to $TARGET_PATH/opt/"
tar --checkpoint=1500 --directory=$TARGET_PATH/opt/ -axf ./jre-$JAVA_VERSION.tar.gz
fi
sync
}
function java_download_java(){
#
# Download java
if [ ! -z "$JAVA_VERSION" ]; then
if [ ! -z "$JAVA_BUNDLE_ID" ]; then
echo "NOTE: DOWNLOAD: $JAVA_URL$JAVA_BUNDLE_ID"
wget -nc $JAVA_URL$JAVA_BUNDLE_ID -O ./jre-$JAVA_VERSION.tar.gz
else
echo "ERROR: JAVA_BUNDLE_ID unresolved. Terminating."
exit
fi
else
echo "ERROR: JAVA_VERSION:=$JAVA_VERSION is unresolved. Terminating"
exit
fi
}
function java_help(){
echo "TODO: java_help not implemeneted"
}
function java_clean(){
if [ "$1" == "--clean" -o "$1" == "--pristine" ]; then
rm -rf $WORK_FOLDER/$TARGET_PATH/opt/$JAVA_PATH_VERSION_NAME
# TODO_CODE: clean up links? Can't just remove directories as
# that will remove other apps stuff.
fi
}
function java_pristine(){
if [ "$1" == "--pristine" ]; then
rm -f ./$JAVA_VERSION.tar.gz
fi
}
function java_make_sfs() {
#
# Create the sfs file
#TODO: Usage of WORK_FOLDER, TAREGT_PATH and JAVA_PATH_NAME is
# incosistent with other scripts.
# if [ $WORK_FOLDER=='' || $TARGET_PATH=='' ]; then
# echo "WARNING: could not resolve WORK_FOLDER or TARGET_PATH"
# exit 0
# else
cd $TARGET_PATH/
echo "mksquashfs:= $TARGET_PATH $JAVA_PATH_VERSION_NAME.sfs -noappend"
mksquashfs $TARGET_PATH $JAVA_PATH_VERSION_NAME.sfs -noappend
# fi
}
function java_main() {
java_set_defaults
#java_get_version_info
java_dump_variables
java_clean
#java_pristine
java_download_java
java_unpack_java
java_fix_plugin_links
java_fix_java_links
}
#
# TODO_CODE: Make java.desktop and icon references.
if [ "$THIS_FILE_NAME" == $THIS_BASENAME ]; then
#TODO: Shuld use push and pop (folder)?
CUR_FOLDER=$(pwd)
java_main
java_make_sfs
cd $CUR_FOLDER
else
java_main
fi
echo "END: " $THIS_BASENAME " at " $(pwd)[/code] | [/code]
|
Back to top
|
|
 |
Puppus Dogfellow

Joined: 07 Jan 2013 Posts: 1669 Location: nyc
|
Posted: Mon 30 Mar 2015, 17:14 Post subject:
|
|
works well in precise 5.7.1. thanks.
(no sfs, only a gz file in 5.5 for some reason).
|
Back to top
|
|
 |
musher0
Joined: 04 Jan 2009 Posts: 15041 Location: Gatineau (Qc), Canada
|
Posted: Mon 30 Mar 2015, 19:21 Post subject:
|
|
@Uten
Why stop there?
Include lots of java apps in that java sfs too, while you're at it!
Only the java JRE with no java apps to use it with, come on now!!!
BFN.
musher0
_________________ musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
|
Back to top
|
|
 |
Uten

Joined: 29 Jan 2008 Posts: 129
|
Posted: Tue 31 Mar 2015, 17:31 Post subject:
|
|
Puppus Dogfellow wrote: | (no sfs, only a gz file in 5.5 for some reason). |
No error messages? Or rather, it's a bit stupid and I will change it when I get the time. But for now you should look in /tmp/sfs-java to find the sfs unless you modify the paths at the top of the script.
musher0 wrote: | @Uten
Why stop there?
Include lots of java apps in that java sfs too, while you're at it!
Only the java JRE with no java apps to use it with, come on now!!!
BFN.
musher0 |
Basically because I don't use java anymore. It's way to resource hungry for the machines I use
But, who knows. Maybe later.
|
Back to top
|
|
 |
Puppus Dogfellow

Joined: 07 Jan 2013 Posts: 1669 Location: nyc
|
Posted: Wed 01 Apr 2015, 23:59 Post subject:
|
|
Uten wrote: | Puppus Dogfellow wrote: | (no sfs, only a gz file in 5.5 for some reason). |
No error messages? Or rather, it's a bit stupid and I will change it when I get the time. But for now you should look in /tmp/sfs-java to find the sfs unless you modify the paths at the top of the script.
|
my apologies, uten. how i saw it there on one machine but not the other...
anyway, thanks again.
|
Back to top
|
|
 |
Uten

Joined: 29 Jan 2008 Posts: 129
|
Posted: Thu 02 Apr 2015, 13:43 Post subject:
|
|
No problem @Puppus, I have been there and done that myself
|
Back to top
|
|
 |
Marley
Joined: 26 Sep 2014 Posts: 34
|
Posted: Fri 03 Apr 2015, 13:46 Post subject:
Newcomer to code and consoles here . . . Subject description: Need a bit of help - thanks! |
|
Hi,
I copied the code and put it into a file in the appropriate directory - my applications/bin.
I'm using Precise Puppy 5.7.1 and see that it should run no problem - I just don't know how to run it! I'm new to the console commands etc and when I go into the directory and try out a few things I think should work - I just get told the file is not found - very confusing but I'm sure I'm just missing some simple step.
Any guidance is greatly appreciated - I am in awe of your code since I find 10 lines of php a major acheivement for myself being new to coding
Thanks in advance for a little very basic walkthrough. I'm using SeaMonkey btw if that makes a difference.
PS - how did you create your avatar - it's really 'cool'
|
Back to top
|
|
 |
Puppus Dogfellow

Joined: 07 Jan 2013 Posts: 1669 Location: nyc
|
Posted: Fri 03 Apr 2015, 16:55 Post subject:
Re: Newcomer to code and consoles here . . . Subject description: Need a bit of help - thanks! |
|
Marley wrote: | Hi,
I copied the code and put it into a file in the appropriate directory - my applications/bin.
I'm using Precise Puppy 5.7.1 and see that it should run no problem - I just don't know how to run it! I'm new to the console commands etc and when I go into the directory and try out a few things I think should work - I just get told the file is not found - very confusing but I'm sure I'm just missing some simple step.
Any guidance is greatly appreciated - I am in awe of your code since I find 10 lines of php a major acheivement for myself being new to coding
Thanks in advance for a little very basic walkthrough. I'm using SeaMonkey btw if that makes a difference.
PS - how did you create your avatar - it's really 'cool'  |
just click the script to run it (or hit f5 or the execute button if it's opened in geany). if you haven't messed with the stock rox color scheme, it should be green. if it isn't, you'll need to change permissions--right click > permissions > quiet or yes. next thing to check is the /tmp folder--the sfs should be there in a folder named java-sfs.
hth
___
based on this (i'm also new to linux/the terminal), the way to do it from the terminal is
Code: | chmod 755 /root/my-applications/bin/sfs-java.sh; sfs-java.sh; rox /tmp |
(i'd first try the GUI way since it's confirmed to work--i've yet to change permissions on anything from the terminal in actuality.)
|
Back to top
|
|
 |
Marley
Joined: 26 Sep 2014 Posts: 34
|
Posted: Fri 03 Apr 2015, 18:00 Post subject:
|
|
Hi
Thank you! Knowing how things should look so I could know that I was on the right track was a great help! - ie the name being 'green' because phew! I haven't messed with the stock ROX filer colour scheme and yes, there was a tmp file for the sfs-java.sh (since I learn best by doing - I can and do mess with things, forget and then cause some wild issues sometimes which was my fear this time)
Still, when I clicked the file (I thought) nothing happened - since I suspected I have messed with things up on my hard drive installation of puppy I decided to try fresh from the live CD - I mean run the computer on that, install the code in the my-applications folder and follow your instructions.
And then duh! I saw the /root/my-applications/bin/jre-8u40.tar.gz file just appear poof like that! - so fast!!! And I realized that this appeared on the computer puppy installation too! - but all just so fast I didn't think it appeared but had been there all the time and I didn't clue in what jre etc was referring to - that is one fast download! It did download right it wasn't hiding in the script? - I know I must sound like a person who's seen technology for the first time or fire!
In any case, thank you again - maybe now could you guide me - what do I do to extract the files?
When I click on the jre package XArchive pops up and lists all the files - so far so good - then if I click Extract it says - I assume you want them all extracted - which I assume I do - but just so I don't mess up - am I supposed to just then click 'extract' and will that put everything in the appropriate place or do I have to choose a specific folder for the jre files?
Thank you very much for your help. It is good to know someone else is new to the command line
|
Back to top
|
|
 |
Puppus Dogfellow

Joined: 07 Jan 2013 Posts: 1669 Location: nyc
|
Posted: Fri 03 Apr 2015, 18:36 Post subject:
|
|
Marley wrote: | Hi
Thank you! Knowing how things should look so I could know that I was on the right track was a great help! - ie the name being 'green' because phew! I haven't messed with the stock ROX filer colour scheme and yes, there was a tmp file for the sfs-java.sh (since I learn best by doing - I can and do mess with things, forget and then cause some wild issues sometimes which was my fear this time)
Still, when I clicked the file (I thought) nothing happened - since I suspected I have messed with things up on my hard drive installation of puppy I decided to try fresh from the live CD - I mean run the computer on that, install the code in the my-applications folder and follow your instructions.
And then duh! I saw the /root/my-applications/bin/jre-8u40.tar.gz file just appear poof like that! - so fast!!! And I realized that this appeared on the computer puppy installation too! - but all just so fast I didn't think it appeared but had been there all the time and I didn't clue in what jre etc was referring to - that is one fast download! It did download right it wasn't hiding in the script? - I know I must sound like a person who's seen technology for the first time or fire!
In any case, thank you again - maybe now could you guide me - what do I do to extract the files?
When I click on the jre package XArchive pops up and lists all the files - so far so good - then if I click Extract it says - I assume you want them all extracted - which I assume I do - but just so I don't mess up - am I supposed to just then click 'extract' and will that put everything in the appropriate place or do I have to choose a specific folder for the jre files?
Thank you very much for your help. It is good to know someone else is new to the command line  |
you shouldn't have to extract or do anything other than click the sfs file that's now in /tmp/java-sfs--is it there? if it is, it will ask if you want to load, move, or copy it. /tmp is where it was made--that gz file is just part of the process and should delete/transform itself.
fwiw--i tried chmod 755 /root/my-applications/bin/sfs-java.sh in the terminal while i watched the rox folder--it does indeed turn it green/change its permissions. anyway, if the sfs file isn't in that folder in the temp folder, something's gone wrong (enter rox /tmp/java-sfs into a terminal and it will take you there if there in fact exists). you could try rerunning the code from the terminal--that is, just enter the name (sfs-java.sh) now that the permissions are set and it's in a place/PATH that puppy will check, and if there are any error messages, report them here for Uten to see.
|
Back to top
|
|
 |
Marley
Joined: 26 Sep 2014 Posts: 34
|
Posted: Fri 03 Apr 2015, 19:18 Post subject:
|
|
Ahhhh thank you again -
entering rox /tmp/java-sfs
took me to the file - I was looking at the wrong thing - /tmp/sfs-java.sh.tmp which is in the same folder but not the file you were saying to look for.
I saw the SFS file in the folder and clicking on it started the load process -
One question if you don't mind - just to be 'safe' - I get this message:
Do you want to load 'jre 1.8.0_40.sfs (filesize 63MB)?' WARNING: Using this under 'PUPMODE=2' is EXPERIMENTAL.
I'm not sure if I'm under 'PUPMODE=2' or if it's worth worrying about - have you any idea?
Thank you.
|
Back to top
|
|
 |
Puppus Dogfellow

Joined: 07 Jan 2013 Posts: 1669 Location: nyc
|
Posted: Fri 03 Apr 2015, 20:44 Post subject:
|
|
Marley wrote: | Ahhhh thank you again -
entering rox /tmp/java-sfs
took me to the file - I was looking at the wrong thing - /tmp/sfs-java.sh.tmp which is in the same folder but not the file you were saying to look for.
I saw the SFS file in the folder and clicking on it started the load process -
One question if you don't mind - just to be 'safe' - I get this message:
Do you want to load 'jre 1.8.0_40.sfs (filesize 63MB)?' WARNING: Using this under 'PUPMODE=2' is EXPERIMENTAL.
I'm not sure if I'm under 'PUPMODE=2' or if it's worth worrying about - have you any idea?
Thank you. |
shinobar left in a lot of the early warning messages from that program's development, if i've read the forum correctly. it's perfectly safe, as is loading more than 6 sfs files (i think i've read the current limit is something like 256?--that may be after a tweak. at least 12 i'm pretty sure...) and having a save file over 1.8 gig (that was a concern--i've had a few over twenty gig with no problem. one was over forty.) so, yes, it's safe. in fact, i've never come across anything about the running of sfs files as unsafe in any way you can manage to manage it...
a quick check shows pupmode 2 is full install. sfs files load fine if that's indeed what you have.
only type i can't vouch for is livecd/dvd installations. i've booted off cds but don't save to them, though again, i can't remember sfs files being a problem for anyone--it's an integral part of puppy. full installs came later, i believe, and that's why shinobar's warning messages caution you--there was a time (long, long ago in puppy terms) when no one knew for sure some of the options would work.
i'm pretty sure you'll get prompted to make the move anyway, but the sfs file is better off in /mnt/home than in /tmp (which i take as "temporary" and avoid using as much as possible)
further reading on pupmodes and more, if you're interested: http://www.puppylinux.com/development/howpuppyworks.html
|
Back to top
|
|
 |
Uten

Joined: 29 Jan 2008 Posts: 129
|
Posted: Sat 04 Apr 2015, 16:42 Post subject:
|
|
Hi @Marley,
Thanks for your input. I have edited first post and made a short tutorial to ease usage for those of you without to much CLI experience.
I have to admit the Avatar is not my creation. Got it from one of the avatar sites (http://img1.jurko.net/avatar_17337.gif). But I to think it is cool and unfortunately reflects my state of mind quite often
The reason you get the jre*.tar.gz in my-applications/bin/ is that I use a repository for downloaded files in my setup. It should not end up in my-applications/bin/ so I consider that a bug and fix it in the next release.
Thank you @Puppus for taking the time to explain the things I have taken for granted.
EDIT: fixed some spelling errors.
|
Back to top
|
|
 |
|