ruper2/dist/bin ruper.bat,NONE,1.1 ruper,NONE,1.1

[email protected]
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/ruper2/dist/bin
In directory sc8-pr-cvs1:/tmp/cvs-serv6983/dist/bin

Added Files:
	ruper.bat ruper 
Log Message:
Final commit, before I check out & prepare for move to Apache.

--- NEW FILE: ruper.bat ---
@echo off

REM   Ruper interface (first quick hack)

if exist "%HOME%\ruperrc_pre.bat" call "%HOME%\ruperrc_pre.bat"

if "%OS%"=="Windows_NT" @setlocal

rem %~dp0 is expanded pathname of the current script under NT
set DEFAULT_RUPER_HOME=%~dp0..

if "%RUPER_HOME%"=="" set RUPER_HOME=%DEFAULT_RUPER_HOME%
set DEFAULT_RUPER_HOME=

rem Slurp the command line arguments. This loop allows for an unlimited number
rem of arguments (up to the command line limit, anyway).
set RUPER_CMD_LINE_ARGS=%1
if ""%1""=="""" goto doneStart
shift
:setupArgs
if ""%1""=="""" goto doneStart
set RUPER_CMD_LINE_ARGS=%RUPER_CMD_LINE_ARGS% %1
shift
goto setupArgs
rem This label provides a place for the argument list loop to break out 
rem and for NT handling to skip to.

:doneStart
rem find RUPER_HOME if it does not exist due to either an invalid value passed
rem by the user or the %0 problem on Windows 9x
if exist "%RUPER_HOME%\lib\ruper.jar" goto checkJava

rem check for ruper in Program Files on system drive
if not exist "%SystemDrive%\Program Files\ruper" goto checkSystemDrive
set RUPER_HOME=%SystemDrive%\Program Files\ruper
goto checkJava

:checkSystemDrive
rem check for ruper in root directory of system drive
if not exist %SystemDrive%\ruper\lib\ruper.jar goto checkCDrive
set RUPER_HOME=%SystemDrive%\ruper
goto checkJava

:checkCDrive
rem check for ruper in C:\ruper for Win9X users
if not exist C:\ruper\lib\ruper.jar goto noRuperHome
set RUPER_HOME=C:\ruper
goto checkJava

:noRuperHome
echo RUPER_HOME is set incorrectly or ruper could not be located. Please set RUPER_HOME.
goto end

:checkJava
set _JAVACMD=%JAVACMD%
set LOCALCLASSPATH=%CLASSPATH%
for %%i in ("%RUPER_HOME%\lib\*.jar") do call "%RUPER_HOME%\bin\lcp.bat" %%i

if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe
if exist "%JAVA_HOME%\lib\tools.jar" set LOCALCLASSPATH=%JAVA_HOME%\lib\tools.jar;%LOCALCLASSPATH%
if exist "%JAVA_HOME%\lib\classes.zip" set LOCALCLASSPATH=%JAVA_HOME%\lib\classes.zip;%LOCALCLASSPATH%
goto runRuper

:noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=java.exe
echo.
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.
echo.

:runRuper
"%_JAVACMD%" %RUPER_OPTS% -classpath "%LOCALCLASSPATH%" "-Druper.home=%RUPER_HOME%" org.krysalis.ruper2.tool.X %RUPER_ARGS% %RUPER_CMD_LINE_ARGS%
goto end

:end
set LOCALCLASSPATH=
set _JAVACMD=
set RUPER_CMD_LINE_ARGS=

if "%OS%"=="Windows_NT" @endlocal

:mainEnd
if exist "%HOME%\ruperrc_post.bat" call "%HOME%\ruperrc_post.bat"


--- NEW FILE: ruper ---
#! /bin/sh


# load system-wide ruper configuration
if [ -f "/etc/ruper.conf" ] ; then 
  . /etc/ruper.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 ruper configuration
if [ -f "$HOME/.ruperrc" ] ; then 
  . "$HOME/.ruperrc"
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 "$RUPER_HOME" ] ; then
  # try to find RUPER
  if [ -d /opt/ruper ] ; then 
    RUPER_HOME=/opt/ruper
  fi

  if [ -d "${HOME}/opt/ruper" ] ; then 
    RUPER_HOME="${HOME}/opt/ruper"
  fi

  ## resolve links - $0 may be a link to ruper'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
  
  RUPER_HOME=`dirname "$PRG"`/..

  # make it fully qualified
  RUPER_HOME=`cd "$RUPER_HOME" && pwd`

fi

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
  [ -n "$RUPER_HOME" ] &&
    RUPER_HOME=`cygpath --unix "$RUPER_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi

# set RUPER_LIB location
RUPER_LIB="${RUPER_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=`which java 2> /dev/null `
    if [ -z "$JAVACMD" ] ; then 
        JAVACMD=java
    fi
  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 ruper/optional/xml parser&api from JAVALIBDIR 
if $rpm_mode; then
  JAVALIBDIR=/usr/share/java
  for i in ruper ruper-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 ruper/lib is in /usr/share/java/ruper
  RUPER_LIB="${JAVALIBDIR}/ruper"
fi

# add in the dependency .jar files in non-RPM mode (the default)
for i in "${RUPER_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

else
  echo "Warning: JAVA_HOME environment variable is not set (or not exported)."
  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


# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
  RUPER_HOME=`cygpath --windows "$RUPER_HOME"`
  JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
  CYGHOME=`cygpath --windows "$HOME"`
fi

if [ -n "$CYGHOME" ]; then
 	exec "$JAVACMD" $RUPER_OPTS -classpath "$LOCALCLASSPATH" -Druper.home="${RUPER_HOME}" -Dcygwin.user.home="$CYGHOME" org.krysalis.ruper2.tool.DownloaderTool $RUPER_ARGS "$@"
else
	exec "$JAVACMD" $RUPER_OPTS -classpath "$LOCALCLASSPATH" -Druper.home="${RUPER_HOME}"  org.krysalis.ruper2.tool.DownloaderTool $RUPER_ARGS "$@"
fi




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.