mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Add IzPack
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright 2001-2005 The Apache Software Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# allow command line pre-set opts
|
||||
if [ -z "$IZPACK_OPTS" ] ; then
|
||||
IZPACK_OPTS=""
|
||||
fi
|
||||
|
||||
# load user izpack configuration (may specify IZPACK_HOME
|
||||
if [ -f "$HOME/.izpackrc" ] ; then
|
||||
. $HOME/.izpackrc
|
||||
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_VERSION" ] ; then
|
||||
JAVA_VERSION="CurrentJDK"
|
||||
else
|
||||
echo "Using Java version: $JAVA_VERSION"
|
||||
fi
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$IZPACK_HOME" ] ; then
|
||||
# try to find IZPACK
|
||||
if [ -d /opt/izpack ] ; then
|
||||
IZPACK_HOME=/opt/izpack
|
||||
fi
|
||||
|
||||
if [ -d "${HOME}/izpack" ] ; then
|
||||
IZPACK_HOME="${HOME}/izpack"
|
||||
fi
|
||||
|
||||
## resolve links - $0 may be a link to izpack's home
|
||||
PRG="$0"
|
||||
progname=`basename "$0"`
|
||||
saveddir=`pwd`
|
||||
|
||||
# need this for relative symlinks
|
||||
dirname_prg=`dirname "$PRG"`
|
||||
cd "$dirname_prg"
|
||||
|
||||
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
|
||||
|
||||
IZPACK_HOME=`dirname "$PRG"`/..
|
||||
|
||||
cd "$saveddir"
|
||||
|
||||
# make it fully qualified
|
||||
IZPACK_HOME=`cd "$IZPACK_HOME" && pwd`
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$IZPACK_HOME" ] &&
|
||||
IZPACK_HOME=`cygpath --unix "$IZPACK_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
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 [ -z "$JAVA_HOME" ] ; then
|
||||
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
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$IZPACK_HOME" ] &&
|
||||
IZPACK_HOME=`cygpath --windows "$IZPACK_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# For Darwin, use classes.jar for TOOLS_JAR
|
||||
TOOLS_JAR="${JAVA_HOME}/lib/tools.jar"
|
||||
if $darwin; then
|
||||
TOOLS_JAR="/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Classes/classes.jar"
|
||||
fi
|
||||
|
||||
MAIN_CLASS=com.izforge.izpack.compiler.bootstrap.CompilerLauncher
|
||||
|
||||
"$JAVACMD" -Xmx512m \
|
||||
$IZPACK_OPTS \
|
||||
-classpath "${IZPACK_HOME}/lib/*" \
|
||||
"-Dtools.jar=$TOOLS_JAR" \
|
||||
"-Dizpack.home=${IZPACK_HOME}" \
|
||||
$MAIN_CLASS "$@"
|
||||
@@ -0,0 +1,100 @@
|
||||
@echo off
|
||||
|
||||
REM Copyright 2001,2004-2005 The Apache Software Foundation
|
||||
REM
|
||||
REM Licensed under the Apache License, Version 2.0 (the "License");
|
||||
REM you may not use this file except in compliance with the License.
|
||||
REM You may obtain a copy of the License at
|
||||
REM
|
||||
REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
REM
|
||||
REM Unless required by applicable law or agreed to in writing, software
|
||||
REM distributed under the License is distributed on an "AS IS" BASIS,
|
||||
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
REM See the License for the specific language governing permissions and
|
||||
REM limitations under the License.
|
||||
|
||||
if "%OS%"=="Windows_NT" @setlocal
|
||||
if "%OS%"=="WINNT" @setlocal
|
||||
|
||||
rem %~dp0 is expanded pathname of the current script
|
||||
set DEFAULT_IZPACK_HOME=%~dp0..
|
||||
|
||||
if "%IZPACK_HOME%"=="" set IZPACK_HOME=%DEFAULT_IZPACK_HOME%
|
||||
set DEFAULT_IZPACK_HOME=
|
||||
|
||||
echo IZPACK_HOME is "%IZPACK_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 IZPACK_CMD_LINE_ARGS=%1
|
||||
if ""%1""=="""" goto doneStart
|
||||
shift
|
||||
:setupArgs
|
||||
if ""%1""=="""" goto doneStart
|
||||
set IZPACK_CMD_LINE_ARGS=%IZPACK_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 IZPACK_HOME if it does not exist due to either
|
||||
rem an invalid value passed by the user or the %0 problem
|
||||
rem on Windows 9x
|
||||
set IZPACK_JAR=lib\izpack-compiler-*.jar
|
||||
if exist "%IZPACK_HOME%\%IZPACK_JAR%" goto checkJava
|
||||
|
||||
rem check for Izpack in Program Files
|
||||
if not exist "%ProgramFiles%\IzPack" goto checkSystemDrive
|
||||
set IZPACK_HOME=%ProgramFiles%\Izpack
|
||||
if exist "%IZPACK_HOME%\%IZPACK_JAR%" goto checkJava
|
||||
|
||||
:checkSystemDrive
|
||||
rem check for Izpack in root directory of system drive
|
||||
if not exist %SystemDrive%\Izpack\%IZPACK_JAR% goto checkCDrive
|
||||
set IZPACK_HOME=%SystemDrive%\Izpack\
|
||||
goto checkJava
|
||||
|
||||
:checkCDrive
|
||||
rem check for Izpack in C:\Izpack for Win9X users
|
||||
if not exist C:\Izpack\%IZPACK_JAR% goto noIzpackHome
|
||||
set IZPACK_HOME=C:\Izpack\
|
||||
goto checkJava
|
||||
|
||||
:noIzpackHome
|
||||
echo IZPACK_HOME is set incorrectly or Izpack could not be located. Please set IZPACK_HOME.
|
||||
goto end
|
||||
|
||||
:checkJava
|
||||
set _JAVACMD=%JAVACMD%
|
||||
|
||||
if "%JAVA_HOME%" == "" goto noJavaHome
|
||||
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
|
||||
if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe
|
||||
goto setClasspath
|
||||
|
||||
:noJavaHome
|
||||
if "%_JAVACMD%" == "" set _JAVACMD=java.exe
|
||||
|
||||
:setClasspath
|
||||
set LOCALCLASSPATH=%IZPACK_HOME%\Izpack.jar;%CLASSPATH%
|
||||
for %%i in ("%IZPACK_HOME%\lib\*.jar") do call "%IZPACK_HOME%\bin\lcp.bat" %%i
|
||||
|
||||
:runIzpack
|
||||
set MAIN_CLASS=com.izforge.izpack.compiler.bootstrap.CompilerLauncher
|
||||
|
||||
"%_JAVACMD%" -Xmx512m %IZPACK_OPTS% -classpath "%LOCALCLASSPATH%" %MAIN_CLASS% %IZPACK_CMD_LINE_ARGS%
|
||||
goto end
|
||||
|
||||
:end
|
||||
set _JAVACMD=
|
||||
set IZPACK_CMD_LINE_ARGS=
|
||||
set LOCALCLASSPATH=
|
||||
set MAIN_CLASS=
|
||||
|
||||
if "%OS%"=="Windows_NT" @endlocal
|
||||
if "%OS%"=="WINNT" @endlocal
|
||||
|
||||
:mainEnd
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
REM
|
||||
REM Copyright 2001-2004 The Apache Software Foundation
|
||||
REM
|
||||
REM Licensed under the Apache License, Version 2.0 (the "License");
|
||||
REM you may not use this file except in compliance with the License.
|
||||
REM You may obtain a copy of the License at
|
||||
REM
|
||||
REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
REM
|
||||
REM Unless required by applicable law or agreed to in writing, software
|
||||
REM distributed under the License is distributed on an "AS IS" BASIS,
|
||||
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
REM See the License for the specific language governing permissions and
|
||||
REM limitations under the License.
|
||||
REM
|
||||
REM
|
||||
|
||||
set _CLASSPATHCOMPONENT=%1
|
||||
if ""%1""=="""" goto gotAllArgs
|
||||
shift
|
||||
|
||||
:argCheck
|
||||
if ""%1""=="""" goto gotAllArgs
|
||||
set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1
|
||||
shift
|
||||
goto argCheck
|
||||
|
||||
:gotAllArgs
|
||||
set LOCALCLASSPATH=%_CLASSPATHCOMPONENT%;%LOCALCLASSPATH%
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ShellScript
|
||||
# - to detect a desktop and their native
|
||||
# File/WebBrowser such as Konqueror (KDE) or Nautilus/Epiphany (Gnome)
|
||||
# Or
|
||||
# - to detect a browser from the mozilla family
|
||||
# The first prefered one will open the given $1 document
|
||||
# which should be a web url (http://host.domain.com/path/index.html) or a
|
||||
# local file like file:///local/folder/document.html
|
||||
# Note: Tested on SuSE, Fedora an Mandriva Linux and Solaris 9 with kde, gnome or a mozilla installed
|
||||
#
|
||||
# This is licensed as part of
|
||||
# IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
|
||||
#
|
||||
# http://izpack.org/
|
||||
# http://izpack.codehaus.org/
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# ./start.sh http://izpack.org/
|
||||
#
|
||||
# author marc.eppelmann@gmx.de
|
||||
# $Id$
|
||||
#
|
||||
|
||||
function usage() {
|
||||
echo "Launch an url with the browser."
|
||||
echo ""
|
||||
echo "Usage : "
|
||||
echo " ./start.sh http://izpack.org/"
|
||||
}
|
||||
|
||||
function detectDesktop() {
|
||||
if [[ "$DISPLAY" = "" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local LC_ALL=C
|
||||
local clients
|
||||
if ! clients=`xlsclients`; then
|
||||
# TODO: should we fall back to using ps?
|
||||
return 1
|
||||
fi
|
||||
|
||||
if echo "$clients" | grep -qE '(gnome-panel|nautilus|metacity)'; then
|
||||
echo gnome
|
||||
elif echo "$clients" | grep -qE '(kicker|slicker|karamba|kwin)'; then
|
||||
echo kde
|
||||
else
|
||||
echo other
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
function lookForRunningGecko(){
|
||||
if command -v firefox &>/dev/null; then
|
||||
tempfile=`mktemp`
|
||||
|
||||
firefox -remote "ping()" 2> $tempfile
|
||||
|
||||
if [ -s $tempfile ]; then
|
||||
rm $tempfile
|
||||
echo "none" # is not running :-)
|
||||
return 1
|
||||
else
|
||||
rm $tempfile
|
||||
echo firefox # is running :-)
|
||||
return 0
|
||||
fi
|
||||
fi # firefox "$1"
|
||||
if command -v mozilla &>/dev/null; then
|
||||
#if mozilla -remote "ping()"
|
||||
if command mozilla -remote "ping()" &>/dev/null; then
|
||||
echo mozilla # is running :-)
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
echo "none"
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
if [[ $# = 0 ]]
|
||||
then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
desktop=`detectDesktop`
|
||||
gecko=`lookForRunningGecko`
|
||||
|
||||
echo "found Desktop: $desktop"
|
||||
echo "found Gecko: $gecko"
|
||||
|
||||
if [[ "$gecko" = "none" ]]; then # try open a new instance if found:
|
||||
if command -v firefox &>/dev/null; then
|
||||
firefox "$1" &
|
||||
elif command -v mozilla &>/dev/null; then
|
||||
mozilla "$1" &
|
||||
elif [[ "$desktop" = "gnome" ]] && command -v gnome-open &>/dev/null; then
|
||||
gnome-open "$1" &
|
||||
elif [[ "$desktop" = "kde" ]]; then
|
||||
kfmclient exec "$1" &
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Launching: $gecko"
|
||||
$gecko -remote "openurl($1)" &
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user