2
2
# 2004-02-13, modified for Debian by deb@zorglub.s.bawue.de
3
3
# 2004-06-19, rewritten for Linux/UN*X by deb@zorglub.s.bawue.de
4
4
# (based on Jan Schulz's input)
5
# 2005-01-08, removed bashisms (resp. HP-UX posixsms) and made it POSIX conform
5
# 2004-11-28, minor changes for version 0.8.0 by deb@zorglub.s.bawue.de
6
# 2005-01-08, removed bashims to make script POSIX conform
7
# 2005-01-16, added usage of FREEMIND_BASE_DIR variable
8
# 2005-02-18, add -Dfreemind.base.dir to make plugins work, add some ""
9
# and enhance debug mode.
10
# 2005-11-08, adding commons-codec to classpath.
11
# 2005-11-09, add some dpkg/rpm information and check for Sun/Blackdown VM.
12
# 2006-10-29, follow links to this script using readlink.
13
# 2008-02-02, improve Java recognition, add lsb_release, fix -x which being empty
14
# add -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D for non-Sun JREs
15
# 2008-02-03, add debug values script and exit
16
# 2008-05-20 (fc): -Xmx256M added
17
# 2008-08-08 (ewl) accept OpenJDK as valid VM to run FreeMind.
19
# we only want to test the script, not FreeMind itself
20
if ( echo "${DEBUG}" | grep -qe "script" )
25
########## FUNCTIONS DEFINITIONS #######################################
8
28
if [ -n "${DEBUG}" ]
29
49
# We try hard to find the proper 'java' command
30
if [ -n "${FREEMIND_JAVA}" ] && [ -x "${FREEMIND_JAVA}" ]
32
JAVACMD="${FREEMIND_JAVA}"
33
_debug "Using \$FREEMIND_JAVA to find java virtual machine."
34
elif [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]
50
if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]
36
52
_debug "Using \$JAVACMD to find java virtual machine."
37
53
elif [ -n "${JAVA_BINDIR}" ] && [ -x "${JAVA_BINDIR}/java" ]
43
59
JAVACMD="${JAVA_HOME}/bin/java"
44
60
_debug "Using \$JAVA_HOME to find java virtual machine."
45
elif [ -x /usr/lib/jvm/java-7-icedtea/jre/bin/java ]
47
JAVACMD='/usr/lib/jvm/java-7-icedtea/jre/bin/java'
48
_debug "Using /usr/lib/jvm/java-7-icedtea/jre/bin/java to find java virtual machine."
50
62
JAVACMD=$(which java)
51
63
if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]
62
74
if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]
64
76
_debug "Using '$JAVACMD' as java virtual machine..."
79
"$JAVACMD" -version >&2
81
if (! "${JAVACMD}" -version 2>&1 | grep -qe 'Java(TM)' \
84
_error "Your Java VM is not a complete implementation," \
85
"=======================================" \
86
"FREEMIND WILL MOST PROBABLY *NOT* WORK," \
87
"=======================================" \
88
"define JAVACMD, JAVA_BINDIR, JAVA_HOME or PATH in order" \
89
"to point to such a VM. See the manpage of freemind(1) for details."
67
96
_error "Couldn't find a java virtual machine," \
80
_debug "Freemind parameters are '${@}'."
110
output_debug_info() {
115
_debug "Freemind parameters are '${@}'."
117
if [ -x "$(which lsb_release 2>/dev/null)" ]
119
_debug "$(lsb_release -a)"
121
_debug "System is not LSB conform, 'lsb_release' does not exist."
123
if [ -x "$(which dpkg 2>/dev/null)" ]
125
_debug "The following DEB packages are installed:"
126
COLUMNS=132 dpkg -l | grep -i -e freemind >&2
127
elif [ -x "$(which rpm 2>/dev/null)" ]
129
_debug "The following RPM packages are installed:"
130
rpm -qa | grep -i -e freemind >&2
132
_debug "Neither dpkg nor rpm is installed."
136
########## START MAIN PART #############################################
138
#--------- Put the environment together --------------------------------
82
140
_source /etc/freemind/freemindrc
83
141
_source ~/.freemind/freemindrc
91
freepath=$(dirname "$0")
151
if [ -L "$0" ] && [ -x $(which readlink) ]
152
then # if the script is a link and we have 'readlink' to follow it
153
# -m should be faster and link does always resolve, else this script
154
# wouldn't be called, would it?
155
freefile=$(readlink -mn "$0")
156
_debug "Link '$0' resolved to '${freefile}'."
160
freepath=$(dirname "${freefile}")
92
161
freepath="${freepath%/bin}" # nothing happens if freemind is not installed
93
162
# under something/bin
95
164
# we try different possibilities to find freemind.jar
96
for jar in "${freepath}" "${freepath}/share/freemind" "${freepath}/freemind"
165
for jar in "${FREEMIND_BASE_DIR}" \
166
"${freepath}" "${freepath}/share/freemind" "${freepath}/freemind"
98
168
if [ -f "${jar}/lib/freemind.jar" ]
120
190
cp /etc/freemind/patterns.xml ~/.freemind/patterns.xml
193
#--------- Call (at last) FreeMind -------------------------------------
123
195
# The CLASSPATH also lets one specify additional jars, which is good, if
124
196
# you want to add a new Look&Feel jar (the motif one is so ugly...).
125
export CLASSPATH="${ADD_JARS}:${CLASSPATH}:${freedir}/lib/freemind.jar"
126
${JAVACMD} freemind.main.FreeMind $@
127
# ${JAVACMD} -jar "${freedir}/lib/freemind.jar" $@ # original alternative
198
CLASSPATH="${ADD_JARS}:${CLASSPATH}:${freedir}/lib/freemind.jar:\
199
${freedir}/lib/jibx/jibx-run.jar:\
200
${freedir}/lib/jibx/xpp3.jar:\
201
${freedir}/lib/bindings.jar:\
202
${freedir}/lib/commons-lang-2.0.jar:\
203
${freedir}/lib/forms-1.0.5.jar:\
205
if [ "${JAVA_TYPE}" = "sun" ]
207
_debug "Calling: '${JAVACMD} -Dfreemind.base.dir=${freedir} -cp ${CLASSPATH} freemind.main.FreeMindStarter $@'."
208
( echo "${DEBUG}" | grep -qe "exit" ) && exit 0 # do not start FreeMind
209
"${JAVACMD}" -Xmx256M -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@"
210
else # non-Sun environments don't work currently.
211
_debug "Calling: '${JAVACMD} -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -Dfreemind.base.dir=${freedir} -cp ${CLASSPATH} freemind.main.FreeMindStarter $@'."
212
( echo "${DEBUG}" | grep -qe "exit" ) && exit 0 # do not start FreeMind
213
"${JAVACMD}" -Xmx256M -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@"