network/freerapid: Fix compatibilities with new JDK.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Edinaldo P. Silva 2015-08-23 09:48:46 +07:00 committed by Willy Sudiarto Raharjo
parent 9774944746
commit 148ca20de4
5 changed files with 38 additions and 73 deletions

View File

@ -4,6 +4,16 @@ Facebook, Picasa and other file-sharing services, include the new ones like mega
Simply copy and paste your links from a browser to this application.
FreeRapid Downloader will handle the rest itself. No more clicking or uncomfortable waiting.
To use smooth fonts (better appearance), the options " -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true " should be used.
In some distros, the options " -Djava.net.preferIPv4Stack=true -Xmx160m " should be used.
To reduce CPU usage, the option " -Dsun.java2d.opengl=true " should be used.
The options mentioned were added in /usr/bin/freerapid for convenience, simply uncomment the desired option.
Please add /usr/lib{64}/java/bin into your $PATH.
Main Features:
* support for concurrent downloading from multiple services;

View File

@ -1,3 +1,9 @@
set -e
# create links for compatibility with new JDK versions...
ln -sf /usr/lib/java/bin/java /usr/bin/java
ln -sf /usr/lib/java/bin/javaws /usr/bin/javaws
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi

View File

@ -1,79 +1,26 @@
#!/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
# default option.
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 "$@"
cd /usr/share/freerapid-0.9.4/ && exec java -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
# less CPU usage.
#if [ -x "`which java`" ]; then
# cd /usr/share/freerapid-0.9.4/ && exec java -Dsun.java2d.opengl=true -jar frd.jar "$@"
#fi
# 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
# needed for some distros.
#if [ -x "`which java`" ]; then
# cd /usr/share/freerapid-0.9.4/ && exec java -Djava.net.preferIPv4Stack=true -Xmx160m -jar frd.jar "$@"
#fi
exit 1
# better fonts appearance (smooth fonts).
#if [ -x "`which java`" ]; then
# cd /usr/share/freerapid-0.9.4/ && exec java -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Djava.net.preferIPv4Stack=true -Xmx160m -jar frd.jar "$@"
#fi
# all options combined.
#if [ -x "`which java`" ]; then
# cd /usr/share/freerapid-0.9.4/ && exec java -Dsun.java2d.opengl=true -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Djava.net.preferIPv4Stack=true -Xmx160m -jar frd.jar "$@"
#fi

View File

@ -26,7 +26,7 @@ PRGNAM=freerapid
SRCNAM=FreeRapid
VERSION=${VERSION:-0.9.4}
SRCVER=${SRCVER:-0.9u4}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
ARCH=noarch

View File

@ -5,5 +5,7 @@ Comment=Java based download manager
Exec=/usr/bin/freerapid
StartupNotify=true
Icon=freerapid
Terminal=false
X-MultipleArgs=false
Type=Application
Categories=Network;