diff options
author | Edinaldo P. Silva <edps.mundognu@gmail.com> | 2015-05-29 04:55:49 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2015-05-31 10:36:19 +0700 |
commit | b0ff6382cd60c74652ae1bac1c474d852b76f4cc (patch) | |
tree | 08f4816c6e97beab936a1c3f1b058314e7ed3318 /network/freerapid/frd.sh | |
parent | 71d431bc41e76f5ff14953a869b6d48262985e9a (diff) | |
download | slackbuilds-b0ff6382cd60c74652ae1bac1c474d852b76f4cc.tar.gz |
network/freerapid: Added (Java downloader manager).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/freerapid/frd.sh')
-rw-r--r-- | network/freerapid/frd.sh | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/network/freerapid/frd.sh b/network/freerapid/frd.sh new file mode 100644 index 0000000000..20a8bb1daf --- /dev/null +++ b/network/freerapid/frd.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# FRD requires Sun Java 6, NO Shity GCJ, NO buggy OpenJDK, but Sun Java 6! +# some crappy distros needed to add switch -Djava.net.preferIPv4Stack=true +# Look for java in these directories +LOOKUP_JRE_DIRS="/usr/lib/jvm/* /opt/java* /opt/jre*" +#Created by Petris 2009 -> Many thanks! +# Required version +REQ_JVER1=1 +REQ_JVER2=6 +REQ_JVER3=0 +REQ_JVER4=5 + +check_java_version () { + JVER1=`echo $JAVA_VERSION_OUTPUT | sed 's/java version "\([0-9]*\)\.[0-9]*\.[0-9]*_[0-9]*".*/\1/'` + JVER2=`echo $JAVA_VERSION_OUTPUT | sed 's/java version "[0-9]*\.\([0-9]*\)\.[0-9]*_[0-9]*".*/\1/'` + JVER3=`echo $JAVA_VERSION_OUTPUT | sed 's/java version "[0-9]*\.[0-9]*\.\([0-9]*\)_[0-9]*".*/\1/'` + JVER4=`echo $JAVA_VERSION_OUTPUT | sed 's/java version "[0-9]*\.[0-9]*\.[0-9]*_\([0-9]*\)".*/\1/'` + + if [ $JVER1 -gt $REQ_JVER1 ]; then + return 0 + elif [ $JVER1 -lt $REQ_JVER1 ]; then + return 1 + fi + + if [ $JVER2 -gt $REQ_JVER2 ]; then + return 0 + elif [ $JVER2 -lt $REQ_JVER2 ]; then + return 1 + fi + + if [ $JVER3 -gt $REQ_JVER3 ]; then + return 0 + elif [ $JVER3 -lt $REQ_JVER3 ]; then + return 1 + fi + + if [ $JVER4 -lt $REQ_JVER4 ]; then + return 1 + fi + + return 0 +} + +# Handle symlinks +PROGRAM="$0" +while [ -L "$PROGRAM" ]; do + PROGRAM=`readlink -f "$PROGRAM"` +done +cd "`dirname \"$PROGRAM\"`" + +# Check default java +if [ -x "`which java`" ]; then + JAVA_VERSION_OUTPUT=`java -version 2>&1` + check_java_version && cd /usr/share/freerapid-0.9.4/ && exec java -Djava.net.preferIPv4Stack=true -Xmx160m -jar frd.jar "$@" +fi + +# Test other possible Java locations +for JRE_PATH in $LOOKUP_JRE_DIRS; do + if [ -x "$JRE_PATH/bin/java" ]; then + JAVA_VERSION_OUTPUT=`"$JRE_PATH/bin/java" -version 2>&1` + check_java_version && { + export JRE_PATH + cd /usr/share/freerapid-0.94/ && exec $JRE_PATH/bin/java -Djava.net.preferIPv4Stack=true -Xmx160m -jar frd.jar "$@" + } + fi +done + +# Failed +if [ -x "`which xmessage`" ]; then + xmessage -nearmouse -file - <<EOF +Failed to find a suitable java version. +Required: $REQ_JVER1.$REQ_JVER2.$REQ_JVER3_$REQ_JVER4 or newer. +EOF +else + echo Failed to find a suitable java version. + echo Required: $REQ_JVER1.$REQ_JVER2.$REQ_JVER3_$REQ_JVER4 or newer. +fi + +exit 1 |