root / photovault.sh

Revision 579:65d79734f1e4, 2.9 kB (checked in by Harri Kaimio <harri@…>, 3 years ago)

Increased heap size to 384 MB also in generic distirbution

  • Property exe set to *
Line 
1#!/bin/sh
2# Copyright (c) 2006 Harri Kaimio
3# Based on Freemind startup script, copyright (c) 2004 Joerg Mueller
4#
5# This file is part of Photovault.
6#
7# Photovault is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# Photovault is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with Photovault; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20
21_debug() {
22        if [ -n "${DEBUG}" ]
23        then
24                echo "DEBUG:   $1" >&2 
25                shift
26                for text in "$@"
27                do
28                        echo "         ${text}" >&2
29                done
30        fi
31}
32
33_error() {
34        echo "ERROR:   $1" >&2
35        shift
36        for text in "$@"
37        do
38                echo "         ${text}" >&2
39        done
40}
41
42findjava() {
43        # We try hard to find the proper 'java' command
44        if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]
45        then
46                _debug "Using \$JAVACMD to find java virtual machine."
47        elif [ -n "${JAVA_BINDIR}" ] && [ -x "${JAVA_BINDIR}/java" ]
48        then
49                JAVACMD="${JAVA_BINDIR}/java"
50                _debug "Using \$JAVA_BINDIR to find java virtual machine."
51        elif [ -n "${JAVA_HOME}" ] && [ -x "${JAVA_HOME}/bin/java" ]
52        then
53                JAVACMD="${JAVA_HOME}/bin/java"
54                _debug "Using \$JAVA_HOME to find java virtual machine."
55        else
56                JAVACMD=$(which java)
57                if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]
58                then
59                        _debug "Using \$PATH to find java virtual machine."
60                elif [ -x /usr/bin/java ]
61                then
62                        _debug "Using /usr/bin/java to find java virtual machine."
63                        JAVACMD=/usr/bin/java
64                fi
65        fi
66
67        # if we were successful, we return 0 else we complain and return 1
68        if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]
69        then
70                _debug "Using '$JAVACMD' as java virtual machine..."
71                if [ -n "${DEBUG}" ]
72                then
73                        "$JAVACMD" -version
74                fi
75                return 0
76        else
77                _error "Couldn't find a java virtual machine," \
78                       "define JAVACMD, JAVA_BINDIR, JAVA_HOME or PATH."
79                return 1
80        fi
81}
82
83_source() {
84        if [ -f "$1" ]
85        then
86                _debug "Sourcing '$1'."
87                . "$1"
88        fi
89}
90
91_debug "Photovault parameters are '${@}'."
92_debug "$(uname -a)"
93
94findjava
95if [ $? -ne 0 ]
96then
97        exit 1
98fi
99
100pvpath=$(dirname "$0")
101pvpath="${pvpath%/bin}"
102
103for jar in "${PVAULT_BASE_DIR}" \
104        "${pvpath}" "${pvpath}/share/photovault" "${pvpath}/photovault"
105do
106        if [ -f "${jar}/lib/photovault.jar" ]
107        then
108                pvdir="${jar}"
109                _debug "Photovault Directory is '${jar}'."
110                break
111        fi
112done
113
114if [ -z "${pvdir}" ]
115then
116        _error "Couldn't find Photovault under '${freepath}'."
117        exit 1
118fi
119
120
121_debug "Calling: '${JAVACMD} -Xmx384M -jar ${jar}/lib/photovault.jar $@"
122"${JAVACMD}" -Xmx384M "-Dpv.basedir=${pvdir}" -jar "${jar}/lib/photovault.jar" "$@"
Note: See TracBrowser for help on using the browser.