File: 20_freeplane_sh.patch

package info (click to toggle)
freeplane 1.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 35,988 kB
  • sloc: java: 130,441; xml: 2,373; sh: 172; perl: 138; makefile: 30
file content (118 lines) | stat: -rw-r--r-- 3,745 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
Description: JAVACMD->JAVA_CMD, use java-wrappers.sh instead of findjava
  if available, set org.freeplane.basedirectory to /usr/share/freeplane
  (not the path to the knopflerfish jar)
Author: Felix Natter <fnatter@gmx.net>
Forwarded: no
Last-Update: 2016-05-05
--- a/freeplane_framework/script/freeplane.sh
+++ b/freeplane_framework/script/freeplane.sh
@@ -5,6 +5,13 @@
 	set -x
 fi
 
+# debug also java-wrapper
+if [ -n "${DEBUG}" ]
+then
+	DEBUG_WRAPPER=1
+	export DEBUG_WRAPPER
+fi
+
 ########## FUNCTIONS DEFINITIONS #######################################
 
 _debug() {
@@ -29,34 +36,34 @@
 
 findjava() {
 	# We try hard to find the proper 'java' command
-	if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]; then
-		_debug "Using \$JAVACMD to find java virtual machine."
+	if [ -n "${JAVA_CMD}" ] && [ -x "${JAVA_CMD}" ]; then
+		_debug "Using \$JAVA_CMD to find java virtual machine."
 	elif [ -n "${JAVA_BINDIR}" ] && [ -x "${JAVA_BINDIR}/java" ]; then
-		JAVACMD="${JAVA_BINDIR}/java"
+		JAVA_CMD="${JAVA_BINDIR}/java"
 		_debug "Using \$JAVA_BINDIR to find java virtual machine."
 	elif [ -n "${FREEPLANE_JAVA_HOME}" ] && [ -x "${FREEPLANE_JAVA_HOME}/bin/java" ]; then
-		JAVACMD="${FREEPLANE_JAVA_HOME}/bin/java"
+		JAVA_CMD="${FREEPLANE_JAVA_HOME}/bin/java"
 		_debug "Using \$FREEPLANE_JAVA_HOME to find java virtual machine."
 	elif [ -n "${JAVA_HOME}" ] && [ -x "${JAVA_HOME}/bin/java" ]; then
-		JAVACMD="${JAVA_HOME}/bin/java"
+		JAVA_CMD="${JAVA_HOME}/bin/java"
 		_debug "Using \$JAVA_HOME to find java virtual machine."
 	else
-		JAVACMD=$(which java)
-		if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]; then
+		JAVA_CMD=$(which java)
+		if [ -n "${JAVA_CMD}" ] && [ -x "${JAVA_CMD}" ]; then
 			_debug "Using \$PATH to find java virtual machine."
 		elif [ -x /usr/bin/java ]; then
 			_debug "Using /usr/bin/java to find java virtual machine."
-			JAVACMD=/usr/bin/java
+			JAVA_CMD=/usr/bin/java
 		fi
 	fi
 
 	# if we were successful, we return 0 else we complain and return 1
-	if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]; then
-		_debug "Using '$JAVACMD' as java virtual machine..."
+	if [ -n "${JAVA_CMD}" ] && [ -x "${JAVA_CMD}" ]; then
+		_debug "Using '$JAVA_CMD' as java virtual machine..."
 		if [ -n "${DEBUG}" ]; then
-			"$JAVACMD" -version >&2
+			"$JAVA_CMD" -version >&2
 		fi
-		if "${JAVACMD}" -version 2>&1 | grep -qe OpenJDK; then
+		if "${JAVA_CMD}" -version 2>&1 | grep -qe OpenJDK; then
 			JAVA_TYPE=other
 		else
 			JAVA_TYPE=sun
@@ -64,7 +71,7 @@
 		return 0
 	else
 		_error "Couldn't find a java virtual machine," \
-		       "define JAVACMD, JAVA_BINDIR, JAVA_HOME or PATH."
+		       "define JAVA_CMD, JAVA_BINDIR, JAVA_HOME or PATH."
 		return 1
 	fi
 }
@@ -115,9 +122,16 @@
 _source /etc/freeplane/freeplanerc
 _source "${userfpdir}/freeplanerc"
 
-findjava
-if [ $? -ne 0 ]; then
-	exit 1
+if [ -r /usr/lib/java-wrappers/java-wrappers.sh ]
+then # the Debian method
+	. /usr/lib/java-wrappers/java-wrappers.sh
+	require_java_runtime java8
+else
+	findjava
+	if [ $? -ne 0 ]
+	then
+		exit 1
+	fi
 fi
 
 output_debug_info
@@ -179,7 +193,8 @@
 fi
 
 _debug "Calling: "\
-"${JAVACMD}" -Xmx512m\
+"${JAVA_CMD}" -Xmx512m\
+ "-Dorg.freeplane.basedirectory=${freedir}"\
  "-Dorg.freeplane.userfpdir=$userfpdir"\
  "-Dorg.freeplane.old_userfpdir=$old_userfpdir"\
  "-Dorg.freeplane.globalresourcedir=${freedir}/resources"\
@@ -191,7 +206,8 @@
 ( echo "${DEBUG}" | grep -qe "exit" ) && exit 0 # do not start Freeplane
 
 # now actually launch Freeplane
-"${JAVACMD}" -Xmx512m\
+"${JAVA_CMD}" -Xmx512m\
+ "-Dorg.freeplane.basedirectory=${freedir}"\
  "-Dorg.freeplane.userfpdir=$userfpdir"\
  "-Dorg.freeplane.old_userfpdir=$old_userfpdir"\
  "-Dorg.freeplane.globalresourcedir=${freedir}/resources"\