Contents of /trunk/azureus/azureus
Parent Directory
|
Revision Log
Revision 144 -
(show annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years ago) by niro
File size: 2612 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years ago) by niro
File size: 2612 byte(s)
-import
1 | #!/bin/bash |
2 | |
3 | # 29.09.2004 <niro@magellan-linux.de> |
4 | # fixed PROGRAMM_DIR PATH to suitable location |
5 | # PROGRAMM_DIR=/usr/lib/azureus |
6 | |
7 | |
8 | ######## CONFIGURE ######## |
9 | JAVA_PROGRAM_DIR="" # use full path to java bin dir, ex. "/usr/java/j2sdk1.4.2/bin/" |
10 | ########################### |
11 | |
12 | MSG0="Loading Azureus:" |
13 | MSG1="Starting Azureus..." |
14 | MSG2="Java exec found in " |
15 | MSG3="OOPS, your java version is too old " |
16 | MSG4="You need to upgrade to JRE 1.4.x or newer from http://java.sun.com" |
17 | MSG5="Suitable java version found " |
18 | MSG6="Configuring environment..." |
19 | MSG7="OOPS, you don't seem to have a valid JRE " |
20 | MSG8="OOPS, unable to locate java exec in " |
21 | MSG9=" hierarchy" |
22 | MSG10="Java exec not found in PATH, starting auto-search..." |
23 | MSG11="Java exec found in PATH. Verifying..." |
24 | |
25 | look_for_java() |
26 | { |
27 | JAVADIR=/usr/java |
28 | IFS=$'\n' |
29 | potential_java_dirs=(`ls -1 "$JAVADIR" | sort | tac`) |
30 | IFS= |
31 | for D in "${potential_java_dirs[@]}"; do |
32 | if [[ -d "$JAVADIR/$D" && -x "$JAVADIR/$D/bin/java" ]]; then |
33 | JAVA_PROGRAM_DIR="$JAVADIR/$D/bin/" |
34 | echo $MSG2 $JAVA_PROGRAM_DIR |
35 | if check_version ; then |
36 | return 0 |
37 | else |
38 | return 1 |
39 | fi |
40 | fi |
41 | done |
42 | echo $MSG8 "${JAVADIR}/" $MSG9 ; echo $MSG4 |
43 | return 1 |
44 | } |
45 | |
46 | check_version() |
47 | { |
48 | JAVA_HEADER=`${JAVA_PROGRAM_DIR}java -version 2>&1 | head -n 1` |
49 | JAVA_IMPL=`echo ${JAVA_HEADER} | cut -f1 -d' '` |
50 | if [ "$JAVA_IMPL" = "java" ] ; then |
51 | VERSION=`echo ${JAVA_HEADER} | sed "s/java version \"\(.*\)\"/\1/"` |
52 | if echo $VERSION | grep "^1.[0-3]" ; then |
53 | echo $MSG3 "[${JAVA_PROGRAM_DIR}java = ${VERSION}]" ; echo $MSG4 |
54 | return 1 |
55 | else |
56 | echo $MSG5 "[${JAVA_PROGRAM_DIR}java = ${VERSION}]" ; echo $MSG6 |
57 | return 0 |
58 | fi |
59 | else |
60 | echo $MSG7 "[${JAVA_PROGRAM_DIR}java = ${JAVA_IMPL}]" ; echo $MSG4 |
61 | return 1 |
62 | fi |
63 | } |
64 | |
65 | echo $MSG1 |
66 | |
67 | # locate and test the java executable |
68 | if [ "$JAVA_PROGRAM_DIR" == "" ]; then |
69 | if ! command -v java &>/dev/null; then |
70 | echo $MSG10 |
71 | if ! look_for_java ; then |
72 | exit 1 |
73 | fi |
74 | else |
75 | echo $MSG11 |
76 | if ! check_version ; then |
77 | if ! look_for_java ; then |
78 | exit 1 |
79 | fi |
80 | fi |
81 | fi |
82 | fi |
83 | |
84 | # get the app dir |
85 | #PROGRAM_DIR=`dirname "$0"` |
86 | #PROGRAM_DIR=`cd "$PROGRAM_DIR"; pwd` |
87 | PROGRAM_DIR=/usr/lib/azureus |
88 | |
89 | |
90 | cd ${PROGRAM_DIR} |
91 | |
92 | # build the classpath |
93 | for FILE in *.jar; do CLASSPATH="${CLASSPATH}:${FILE}"; done |
94 | |
95 | echo $MSG0 |
96 | |
97 | echo "${JAVA_PROGRAM_DIR}java -cp ${CLASSPATH} -Djava.library.path=${PROGRAM_DIR} org.gudy.azureus2.ui.swt.Main '$@'" |
98 | ${JAVA_PROGRAM_DIR}java -cp ${CLASSPATH} -Djava.library.path="${PROGRAM_DIR}" org.gudy.azureus2.ui.swt.Main "$@" |
99 | |
100 | echo "Azureus TERMINATED." |
101 |