Initial Commit
[Projects.git] / pkgbuilds / gdocsfs / src / gdocsfs / gdocsfs / bin / mount.gdocsfs
bloba80a39ce45766da9c5cc7ad55843e5c84b6aaa5a
1 #!/bin/sh
2 # ----------------------------------------------------------------------------
3 # Copyright (C) 2008 Jonhnny Weslley.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ----------------------------------------------------------------------------
18 # -----------------------------------------------------------------------------
19 # GDocsFS Start Up Batch script
20 # -----------------------------------------------------------------------------
21 # This utility allows GDocsFS filesystems to be mounted with the regular
22 # 'mount' command, or even to be listed in /etc/fstab
24 # Usage:
25 # 1. mount.gdocsfs /path/to/gdocsfs/home /path/of/mount/point [options]
26 # 2. in /etc/fstab, add:
27 # /path/to/gdocsfs/home /path/of/mount/point gdocsfs noauto[,options]
28 # -----------------------------------------------------------------------------
29 # Environment Variables
31 # GDOCSFS_HOME Must point at your GDocsFS installation.
33 # GDOCSFS_OPTS The parameters passed to the Java VM when running GDocsFS.
34 # e.g. to set the maximum amount of heap to use, in MB
35 # set GDOCSFS_OPTS=-Xmx1000m
37 # JAVA_HOME Must point at your Java Development Kit installation.
39 # -----------------------------------------------------------------------------
41 if [ "$#" -lt "2" ] ; then
42 echo "Google Docs Filesystem (gdocsfs)"
43 echo ""
44 echo "Usage:"
45 echo " 1. mount.gdocsfs /path/to/gdocsfs/home /path/of/mount/point [options]"
46 echo " 2. in /etc/fstab, add:"
47 echo " /path/to/gdocsfs/home /path/of/mount/point gdocsfs noauto[,options]"
48 exit 1
51 # the root of the GDocsFS installation
52 GDOCSFS_HOME=$1
53 GDOCSFS_CONF_DIR=${GDOCSFS_HOME}/conf
54 GDOCSFS_OPTS="-Xmx1000m"
55 QUOTED_ARGS=""
57 if [ "$1" != "" ] ; then
58 shift
62 # JAVA_HOME
63 if [ "$JAVA_HOME" = "" ]; then
64 . $GDOCSFS_HOME/bin/java-config.sh
67 if [ "$JAVA_HOME" != "" ]; then
68 # echo "run java in $JAVA_HOME"
69 JAVA_HOME=$JAVA_HOME
72 if [ "$JAVA_HOME" = "" ]; then
73 echo "Error: JAVA_HOME is not set."
74 exit 1
77 JAVA=$JAVA_HOME/bin/java
79 # CLASSPATH initially contains $GDOCSFS_CONF_DIR
80 CLASSPATH="${GDOCSFS_CONF_DIR}"
81 CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
83 # get all the GDocsFS jars to load
84 for jar in `ls $GDOCSFS_HOME/lib/*.jar` ; do
85 CLASSPATH=$CLASSPATH:$jar
86 done
88 LD_LIBRARY_PATH=$GDOCSFS_HOME/native:$GDOCSFS_HOME/lib \
89 $JAVA $GDOCSFS_OPTS \
90 -classpath "$CLASSPATH" \
91 -Dgdocsfs.home="$GDOCSFS_HOME" \
92 com.google.gdocsfs.Mounter "$@"