You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@depot.apache.org by Nick Chalko <ni...@chalko.com> on 2004/08/18 21:05:42 UTC
Generateing shell scripts for depot was: Distribution
Nick Chalko wrote:
> Adam R. B. Jack wrote:
>
>>> the dist is easy, just do a "ant dist"
>>> hmm not sure it get dependent jars. I will check this weekend.
>>> But you want a install to "DEPOT_HOME"
>>> I will also do that this weekend.
>>
>>
>>
>> Yup, it is the 'extras' I am looking for. If we can put some effort
>> into this aspect, I think we can start using it more. Usage usage
>> usage...
>>
> Ok build a new scripts-antlet then give ant dist a try
> You will see it generates bat and bash scripts to run java files.
>
> You can modify the scripts antlet to also add .py scripts
>
>
>
> Here is a what the generated bash script looks like
> #! /bin/sh
>
> # Autogenerated script to execute the java class
> # org.apache.depot.update.tool.DownloaderTool
>
> # load system-wide depot-update configuration
> if [ -f "/etc/depot-update.conf" ] ; then
> . /etc/depot-update.conf
> fi
>
> # provide default values for people who don't use RPMs
> if [ -z "$rpm_mode" ] ; then
> rpm_mode=false;
> fi
> if [ -z "$usejikes" ] ; then
> usejikes=false;
> fi
>
> # load user depot-update configuration
> if [ -f "$HOME/.depot-updaterc" ] ; then
> . $HOME/.depot-updaterc
> fi
>
> # OS specific support. $var _must_ be set to either true or false.
> cygwin=false;
> darwin=false;
> case "`uname`" in
> CYGWIN*) cygwin=true ;;
> Darwin*) darwin=true
> if [ -z "$JAVA_HOME" ] ; then
>
> JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home fi
> ;;
> esac
>
> if [ -z "${depot-update_HOME}" ] ; then
> # try to find depot-update
> if [ -d /opt/depot-update ] ; then
> depot-update_HOME=/opt/depot-update
> fi
>
> if [ -d "${HOME}/opt/depot-update" ] ; then
> depot-update_HOME="${HOME}/opt/depot-update"
> fi
>
> ## resolve links - $0 may be a link to depot-update's home
> PRG="$0"
> progname=`basename "$0"`
>
> # need this for relative symlinks
> while [ -h "$PRG" ] ; do
> ls=`ls -ld "$PRG"`
> link=`expr "$ls" : '.*-> \(.*\)$'`
> if expr "$link" : '.*/.*' > /dev/null; then
> PRG="$link"
> else
> PRG=`dirname "$PRG"`"/$link"
> fi
> done
>
> depot-update_HOME=`dirname "$PRG"`/..
>
> # make it fully qualified
> depot-update_HOME=`cd "${depot-update_HOME}" && pwd`
>
> fi
>
> # For Cygwin, ensure paths are in UNIX format before anything is touched
> if $cygwin ; then
> [ -n "${depot-update_HOME}" ] &&
> depot-update_HOME=`cygpath --unix "${depot-update_HOME}"`
> [ -n "$JAVA_HOME" ] &&
> JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
> [ -n "$CLASSPATH" ] &&
> CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
> fi
>
> # set depot-update_LIB location
> depot-update_LIB="${depot-update_HOME}/lib"
>
> if [ -z "$JAVACMD" ] ; then
> if [ -n "$JAVA_HOME" ] ; then
> if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
> # IBM's JDK on AIX uses strange locations for the executables
> JAVACMD="$JAVA_HOME/jre/sh/java"
> else
> JAVACMD="$JAVA_HOME/bin/java"
> fi
> else
> JAVACMD=java
> fi
> fi
>
> if [ ! -x "$JAVACMD" ] ; then
> echo "Error: JAVA_HOME is not defined correctly."
> echo " We cannot execute $JAVACMD"
> exit 1
> fi
>
> if [ -n "$CLASSPATH" ] ; then
> LOCALCLASSPATH="$CLASSPATH"
> fi
>
> # in rpm_mode get depot-update/optional/xml parser&api from JAVALIBDIR
> if $rpm_mode; then
> JAVALIBDIR="/usr/share/java"
> for i in depot-update depot-update-optional jaxp_parser xml_apis
> do
> if [ -z "$LOCALCLASSPATH" ] ; then
> LOCALCLASSPATH="$JAVALIBDIR/$i.jar"
> else
> LOCALCLASSPATH="$JAVALIBDIR/$i.jar:$LOCALCLASSPATH"
> fi
> done
>
> # in rpm mode depot-update/lib is in /usr/share/java/depot-update
> depot-update_LIB="${JAVALIBDIR}/depot-update"
>
> fi
>
> # add in the dependency .jar files in non-RPM mode (the default)
> for i in "${depot-update_LIB}"/*.jar
> do
> # if the directory is empty, then it will return the input string
> # this is stupid, so case for it
> if [ -f "$i" ] ; then
> if [ -z "$LOCALCLASSPATH" ] ; then
> LOCALCLASSPATH="$i"
> else
> LOCALCLASSPATH="$i:$LOCALCLASSPATH"
> fi
> fi
> done
>
> if [ -n "$JAVA_HOME" ] ; then
> if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
> LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar"
> fi
>
> if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
> LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip"
> fi
>
> # OSX hack to make depot-update work with jikes
> if $darwin ; then
>
> OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
>
> if [ -d "${OSXHACK}" ] ; then
> for i in "${OSXHACK}"/*.jar
> do
> JIKESPATH="$JIKESPATH:$i"
> done
> fi
> fi
> else
> echo "Warning: JAVA_HOME environment variable is not set."
> echo " If build fails because sun.* classes could not be found"
> echo " you will need to set the JAVA_HOME environment variable"
> echo " to the installation directory of java."
> fi
> #add the Project Jar
> LOCALCLASSPATH=$LOCALCLASSPATH:${depot-update_HOME}/${project.version.package-jar}
>
> # add the extra classpath
> LOCALCLASSPATH=$LOCALCLASSPATH:
>
> # For Cygwin, switch paths to Windows format before running java
> if $cygwin; then
> depot-update_HOME=`cygpath --path --windows "${depot-update_HOME}"`
> JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
> CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
> LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
> CYGHOME=`cygpath --path --windows "$HOME"`
> fi
>
> if [ -n "$CYGHOME" ]; then
> exec "$JAVACMD" -classpath "$LOCALCLASSPATH"
> -Ddepot-update.home="${depot-update_HOME}"
> -Dcygwin.user.home="$CYGHOME" ${depot-update_OPTS}
> org.apache.depot.update.tool.DownloaderTool ${depot-update_ARGS} "$@"
>
> else
> exec "$JAVACMD" -classpath "$LOCALCLASSPATH"
> -Ddepot-update.home="${depot-update_HOME}" ${depot-update_OPTS}
> org.apache.depot.update.tool.DownloaderTool ${depot-update_ARGS} "$@"
>
> fi
>