You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2010/09/23 19:13:41 UTC
svn commit: r1000540 - in
/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main:
java/org/apache/directory/daemon/installers/macosxpkg/
java/org/apache/directory/daemon/installers/nsis/
resources/org/apache/directory/daemon/inst...
Author: pamarcelot
Date: Thu Sep 23 17:13:41 2010
New Revision: 1000540
URL: http://svn.apache.org/viewvc?rev=1000540&view=rev
Log:
Updated configuration files and targets to work with both Windows and Mac OS X.
Modified:
directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java
directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java
directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi
directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper-installation.conf
Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java?rev=1000540&r1=1000539&r2=1000540&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java Thu Sep 23 17:13:41 2010
@@ -298,6 +298,7 @@ public class MacOsXPkgInstallerCommand e
filterProperties.put( "instances.directory", "/usr/local/apacheds-"
+ mojo.getProject().getVersion() + "/instances" );
filterProperties.put( "user", "root" );
+ filterProperties.put( "wrapper.java.command", "# wrapper.java.command=<path-to-java-executable>" );
}
Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java?rev=1000540&r1=1000539&r2=1000540&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java Thu Sep 23 17:13:41 2010
@@ -168,6 +168,8 @@ public class NsisInstallerCommand extend
filterProperties.put( "finalname", target.getFinalName() );
filterProperties.put( "installationFiles", INSTALLATION_FILES );
filterProperties.put( "instancesFiles", INSTANCES_FILES );
+
+ filterProperties.put( "wrapper.java.command", "wrapper.java.command=@java.home@\\bin\\java.exe" );
}
Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi?rev=1000540&r1=1000539&r2=1000540&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi Thu Sep 23 17:13:41 2010
@@ -45,7 +45,7 @@
!include "Sections.nsh"
#
-# Macros
+# Macros (which need to be defined before they're used)
#
# Creates an Internet shortcut
!macro CreateInternetShortcut FILENAME URL ;ICONFILE ICONINDEX
@@ -145,8 +145,6 @@
# Languages (the first one is the default one)
#
!insertmacro MUI_LANGUAGE "English"
- #!insertmacro MUI_LANGUAGE "French"
- #!insertmacro MUI_LANGUAGE "German"
#
# Sections
@@ -169,16 +167,17 @@
Push "$SERVER_HOME_DIR\conf"
Push "*.*"
Call ConvertFiles
-
- GetFunctionAddress $R0 ReplaceConfig ; handle to callback fn
- Push $R0
- Push "$SERVER_HOME_DIR\conf\wrapper.conf" ; file to replace in
- Call ReplaceInFile
+
+ # Replacing java home directory in config file
+ GetFunctionAddress $R0 ReplaceJavaHome # handle to callback fn
+ Push $R0
+ Push "$SERVER_HOME_DIR\conf\wrapper.conf" # file to replace in
+ Call ReplaceInFile
- # Creating directory in the start menu
+ # Creating directory in start menu
CreateDirectory "$SMPROGRAMS\Apache Directory Studio"
- # Creating links in the start menu
+ # Creating links in start menu
!insertmacro CreateInternetShortcut "$SMPROGRAMS\ApacheDS\Basic Users Guide" "http://directory.apache.org/apacheds/1.5/apacheds-v15-basic-users-guide.html"
!insertmacro CreateInternetShortcut "$SMPROGRAMS\ApacheDS\Advanced Users Guide" "http://directory.apache.org/apacheds/1.5/apacheds-v15-advanced-users-guide.html"
!insertmacro CreateInternetShortcut "$SMPROGRAMS\ApacheDS\Developers Guide" "http://directory.apache.org/apacheds/1.5/apacheds-v15-developers-guide.html"
@@ -207,23 +206,17 @@
Push "*.*"
Call ConvertFiles
-
-
- #;I am hand picking the files for now, but we could simplify this by creating a template for new instances
- #SetOutPath "$INSTANCES_HOME_DIR\default\conf"
- #File "files\instances\default\conf\log4j.properties"
- #File "files\instances\default\conf\wrapper.conf"
-
-# Push "$INSTANCES_HOME_DIR\default\conf"
- # Push "*.*"
- # Call ConvertFiles
-
+ # Replacing installation directory in config file
+ GetFunctionAddress $R0 ReplaceInstallationDirectory # handle to callback fn
+ Push $R0
+ Push "$INSTANCES_HOME_DIR\conf\wrapper.conf" # file to replace in
+ Call ReplaceInFile
+
# Push "default"
# Push "$INSTANCES_HOME_DIR"
# Call RegisterInstance
SectionEnd
-
# Uninstaller section
Section Uninstall
@@ -245,332 +238,418 @@
SectionEnd
+#
+# Functions
+#
+ #
+ # <ConvertFiles>
+ #
+
+ # Converts Unix to CR/LF for Windows
+ Function ConvertFiles
+ Pop $R0
+ Pop $R1
+
+ FindFirst $R2 $R3 "$R1\$R0"
+ loop:
+ StrCmp $R3 "" done
+ Push "$R1\$R3"
+ Call ConvertUnixNewLines
+ FindNext $R2 $R3
+ Goto loop
+ done:
+ FindClose $R2
+
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $R0
+ FunctionEnd
+
+ #
+ # </ConvertFiles>
+ #
+
+ #
+ # <RegisterInstance>
+ #
+ Function RegisterInstance
+ Pop $0
+ Pop $1
+ nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper" -i "$SERVER_HOME_DIR\conf\wrapper.conf" set.INSTANCE_HOME="$0" "set.INSTANCE=$1" set.APACHEDS_HOME="$SERVER_HOME_DIR" '
+ Pop $1
+ Pop $0
+ FunctionEnd
+
+ #
+ # </RegisterInstance>
+ #
+
+ #
+ # <un.RegisterInstance>
+ #
+ Function un.RegisterInstance
+ Pop $0
+ nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper" -r "$SERVER_HOME_DIR\conf\wrapper.conf" "set.INSTANCE=$0"'
+ Pop $0
+ FunctionEnd
+
+ #
+ # </un.RegisterInstance>
+ #
+
+ #
+ # <.onInstSuccess>
+ #
-
-
-;---------------------------------
-; Functions
-
-; Converts Unix to CR/LF for Windows
-Function ConvertFiles
- Pop $R0
- Pop $R1
-
- FindFirst $R2 $R3 "$R1\$R0"
- loop:
- StrCmp $R3 "" done
- Push "$R1\$R3"
- Call ConvertUnixNewLines
- FindNext $R2 $R3
- Goto loop
- done:
- FindClose $R2
-
- Pop $R3
- Pop $R2
- Pop $R1
- Pop $R0
-FunctionEnd
-
-Function RegisterInstance
- Pop $0
- Pop $1
- nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper" -i "$SERVER_HOME_DIR\conf\wrapper.conf" set.INSTANCE_HOME="$0" "set.INSTANCE=$1" set.APACHEDS_HOME="$SERVER_HOME_DIR" '
- Pop $1
- Pop $0
-FunctionEnd
-
-Function un.RegisterInstance
- Pop $0
- nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper" -r "$SERVER_HOME_DIR\conf\wrapper.conf" "set.INSTANCE=$0"'
- Pop $0
-FunctionEnd
-
-Function .onInstSuccess
- Push "$INSTANCES_HOME_DIR\conf\apacheds-default.conf"
- Call ConvertUnixNewLines
-
- ; Start the server
- MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to start the default server instance?" IDYES startService IDNO End
-startService:
- nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper" --start "$SERVER_HOME_DIR\conf\wrapper.conf" "set.INSTANCE_HOME=$INSTANCES_HOME_DIR" "set.INSTANCE=default" "set.APACHEDS_HOME=$SERVER_HOME_DIR"'
+ Function .onInstSuccess
+ # Start the server
+ MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to start the default server instance?" IDYES startService IDNO End
+ startService:
+ nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper" --start "$SERVER_HOME_DIR\conf\wrapper.conf" "set.INSTANCE_HOME=$INSTANCES_HOME_DIR" "set.INSTANCE=default" "set.APACHEDS_HOME=$SERVER_HOME_DIR"'
-End:
-FunctionEnd
-
-;--------------------------------
-;Installer Functions
+ End:
+ FunctionEnd
+
+ #
+ # </.onInstSuccess>
+ #
+
+ #
+ # <.onInit>
+ #
-Function .onInit
- SetCurInstType 0
- SetAutoClose false
- StrCpy $SERVER_HOME_DIR "$PROGRAMFILES\ApacheDS"
- Call CheckInstalledJRE
- StrCpy $JAVA_HOME_DIR "$JREPath"
-FunctionEnd
-
-Function PreInstancesDir
- StrCpy $INSTANCES_HOME_DIR $SERVER_HOME_DIR\instances
-FunctionEnd
-
-Function CheckInstalledJRE
- Push "${JREVersion}"
- Call DetectJRE
- Exch $0 ; Get return value from stack
- StrCmp $0 "0" End
- StrCmp $0 "-1" End
- Goto JREAlreadyInstalled
-
-JREAlreadyInstalled:
- StrCpy $JREPath "$0"
- Pop $0 # Restore $0
- Return
-
-End:
-FunctionEnd
+ Function .onInit
+ SetCurInstType 0
+ SetAutoClose false
+ StrCpy $SERVER_HOME_DIR "$PROGRAMFILES\ApacheDS"
+ Call CheckInstalledJRE
+ StrCpy $JAVA_HOME_DIR "$JREPath"
+ FunctionEnd
+
+ #
+ # </.onInit>
+ #
+
+ #
+ # <PreInstancesDir>
+ #
+ Function PreInstancesDir
+ StrCpy $INSTANCES_HOME_DIR $SERVER_HOME_DIR\instances
+ FunctionEnd
+
+ #
+ # </PreInstancesDir>
+ #
+
+ #
+ # <CheckInstalledJRE>
+ #
-; DetectJRE. Version requested is on the stack.
-; Returns (on stack): 0 - JRE not found. -1 - JRE found but too old. Otherwise - Path to JAVA EXE
-; Stack value will be overwritten!
-Function DetectJRE
- Exch $0 ; Get version requested
- ; Now the previous value of $0 is on the stack, and the asked for version of JDK is in $0
- Push $1 ; $1 = Java version string (ie 1.5.0)
- Push $2 ; $2 = Javahome
- Push $3 ; $3 and $4 are used for checking the major/minor version of java
- Push $4
- ;MessageBox MB_OK "Detecting JRE"
- ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
- ;MessageBox MB_OK "Read : $1"
- StrCmp $1 "" DetectTry2
- ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
- ;MessageBox MB_OK "Read 3: $2"
- StrCmp $2 "" DetectTry2
- Goto GetJRE
-
-DetectTry2:
- ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
- ;MessageBox MB_OK "Detect Read : $1"
- StrCmp $1 "" NoFound
- ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
- ;MessageBox MB_OK "Detect Read 3: $2"
- StrCmp $2 "" NoFound
-
-GetJRE:
-; $0 = version requested. $1 = version found. $2 = javaHome
- ;MessageBox MB_OK "Getting JRE"
- IfFileExists "$2\bin\java.exe" 0 NoFound
- StrCpy $3 $0 1 ; Get major version. Example: $1 = 1.5.0, now $3 = 1
- StrCpy $4 $1 1 ; $3 = major version requested, $4 = major version found
- ;MessageBox MB_OK "Want $3 , found $4"
- IntCmp $4 $3 0 FoundOld FoundNew
- StrCpy $3 $0 1 2
- StrCpy $4 $1 1 2 ; Same as above. $3 is minor version requested, $4 is minor version installed
- ;MessageBox MB_OK "Want $3 , found $4"
- IntCmp $4 $3 FoundNew FoundOld FoundNew
-
-NoFound:
- ;MessageBox MB_OK "JRE not found"
- Push "0"
- Goto DetectJREEnd
-
-FoundOld:
- MessageBox MB_OK "JRE too old: $3 is older than $4"
-; Push ${TEMP2}
- Push "-1"
- Goto DetectJREEnd
-FoundNew:
- ;MessageBox MB_OK "JRE is new: $3 is newer than $4"
-
- Push "$2"
-; Push "OK"
-; Return
- Goto DetectJREEnd
-DetectJREEnd:
- ; Top of stack is return value, then r4,r3,r2,r1
- Exch ; => r4,rv,r3,r2,r1,r0
- Pop $4 ; => rv,r3,r2,r1r,r0
- Exch ; => r3,rv,r2,r1,r0
- Pop $3 ; => rv,r2,r1,r0
- Exch ; => r2,rv,r1,r0
- Pop $2 ; => rv,r1,r0
- Exch ; => r1,rv,r0
- Pop $1 ; => rv,r0
- Exch ; => r0,rv
- Pop $0 ; => rv
-FunctionEnd
-
-
-
-
-Function ConvertUnixNewLines
- ; Usage:
- ;Push "path\to\text_file.txt"
- ;Call ConvertUnixNewLines
-
- Exch $R0 ;file #1 path
- Push $R1 ;file #1 handle
- Push $R2 ;file #2 path
- Push $R3 ;file #2 handle
- Push $R4 ;data
- Push $R5
-
- FileOpen $R1 $R0 r
- GetTempFileName $R2
- FileOpen $R3 $R2 w
-
- loopRead:
- ClearErrors
- FileRead $R1 $R4
- IfErrors doneRead
-
- StrCpy $R5 $R4 1 -1
- StrCmp $R5 $\n 0 +4
- StrCpy $R5 $R4 1 -2
- StrCmp $R5 $\r +3
- StrCpy $R4 $R4 -1
- StrCpy $R4 "$R4$\r$\n"
-
- FileWrite $R3 $R4
-
- Goto loopRead
- doneRead:
-
- FileClose $R3
- FileClose $R1
-
- SetDetailsPrint none
- Delete $R0
- Rename $R2 $R0
- SetDetailsPrint both
-
- Pop $R5
- Pop $R4
- Pop $R3
- Pop $R2
- Pop $R1
- Pop $R0
-FunctionEnd
-
-Function ReplaceInFile
- ;
- Exch $R0 ;file name to search in
- Exch
- Exch $R4 ;callback function handle
- Push $R1 ;file handle
- Push $R2 ;temp file name
- Push $R3 ;temp file handle
- Push $R5 ;line read
-
- GetTempFileName $R2
- FileOpen $R1 $R0 r ;file to search in
- FileOpen $R3 $R2 w ;temp file
-
-loop_read:
- ClearErrors
- FileRead $R1 $R5 ;read line
- Push $R5 ; put line on stack
- Call $R4
- Pop $R5 ; read line from stack
- IfErrors exit
- FileWrite $R3 $R5 ;write modified line
- Goto loop_read
-exit:
- FileClose $R1
- FileClose $R3
-
- SetDetailsPrint none
- Delete $R0
- Rename $R2 $R0
- Delete $R2
- SetDetailsPrint both
-
- ; pop in reverse order
- Pop $R5
- Pop $R3
- Pop $R2
- Pop $R1
- Pop $R4
- Pop $R0
-FunctionEnd
-
-Function ReplaceConfig
- ; Example usage of ReplaceInFile
- ; Called Like this:
- ;
- ;GetFunctionAddress $R0 ReplaceInSQL ; handle to callback fn
- ;Push $R0
- ;Push "$INSTDIR\template.sql" ; file to replace in
- ;Call ReplaceInFile
- ;
- ;
- ; save R1
- Push $R1
- Exch
- ;
- ;
- ; A sequence of replacements.
- ; the string to replace in is at the top of the stack
- Push "@app.java.home@" ; string to find
- Push "$JAVA_HOME_DIR\bin\java.exe"
- Call StrReplace
-
- ; restore stack
- Exch
- Pop $R1
-FunctionEnd
-
-Var STR_REPLACE_VAR_0
-Var STR_REPLACE_VAR_1
-Var STR_REPLACE_VAR_2
-Var STR_REPLACE_VAR_3
-Var STR_REPLACE_VAR_4
-Var STR_REPLACE_VAR_5
-Var STR_REPLACE_VAR_6
-Var STR_REPLACE_VAR_7
-Var STR_REPLACE_VAR_8
-
-Function StrReplace
- Exch $STR_REPLACE_VAR_2
- Exch 1
- Exch $STR_REPLACE_VAR_1
- Exch 2
- Exch $STR_REPLACE_VAR_0
- StrCpy $STR_REPLACE_VAR_3 -1
- StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
- StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
- loop:
- IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
- StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
- StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
- StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
- Goto loop
- found:
- StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
- IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
- StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
- StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
- StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
- Goto loop
- done:
- Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
- Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
- Exch $STR_REPLACE_VAR_0
-FunctionEnd
-
-!macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
- Push "${HAYSTACK}"
- Push "${NEEDLE}"
- Push "${NEEDLE2}"
- Call StrReplace
- Pop "${OUT}"
-!macroend
+ Function CheckInstalledJRE
+ Push "${JREVersion}"
+ Call DetectJRE
+ Exch $0 ; Get return value from stack
+ StrCmp $0 "0" End
+ StrCmp $0 "-1" End
+ Goto JREAlreadyInstalled
+
+ JREAlreadyInstalled:
+ StrCpy $JREPath "$0"
+ Pop $0 # Restore $0
+ Return
+
+ End:
+ FunctionEnd
+
+ #
+ # </CheckInstalledJRE>
+ #
+
+ #
+ # <DetectJRE>
+ #
-!define StrReplace '!insertmacro "_strReplaceConstructor"'
+ # DetectJRE. Version requested is on the stack.
+ # Returns (on stack): 0 - JRE not found. -1 - JRE found but too old. Otherwise - Path to JAVA EXE
+ # Stack value will be overwritten!
+ Function DetectJRE
+ Exch $0 ; Get version requested
+ ; Now the previous value of $0 is on the stack, and the asked for version of JDK is in $0
+ Push $1 ; $1 = Java version string (ie 1.5.0)
+ Push $2 ; $2 = Javahome
+ Push $3 ; $3 and $4 are used for checking the major/minor version of java
+ Push $4
+ ;MessageBox MB_OK "Detecting JRE"
+ ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
+ ;MessageBox MB_OK "Read : $1"
+ StrCmp $1 "" DetectTry2
+ ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
+ ;MessageBox MB_OK "Read 3: $2"
+ StrCmp $2 "" DetectTry2
+ Goto GetJRE
+
+ DetectTry2:
+ ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
+ ;MessageBox MB_OK "Detect Read : $1"
+ StrCmp $1 "" NoFound
+ ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
+ ;MessageBox MB_OK "Detect Read 3: $2"
+ StrCmp $2 "" NoFound
+
+ GetJRE:
+ ; $0 = version requested. $1 = version found. $2 = javaHome
+ ;MessageBox MB_OK "Getting JRE"
+ IfFileExists "$2\bin\java.exe" 0 NoFound
+ StrCpy $3 $0 1 ; Get major version. Example: $1 = 1.5.0, now $3 = 1
+ StrCpy $4 $1 1 ; $3 = major version requested, $4 = major version found
+ ;MessageBox MB_OK "Want $3 , found $4"
+ IntCmp $4 $3 0 FoundOld FoundNew
+ StrCpy $3 $0 1 2
+ StrCpy $4 $1 1 2 ; Same as above. $3 is minor version requested, $4 is minor version installed
+ ;MessageBox MB_OK "Want $3 , found $4"
+ IntCmp $4 $3 FoundNew FoundOld FoundNew
+
+ NoFound:
+ ;MessageBox MB_OK "JRE not found"
+ Push "0"
+ Goto DetectJREEnd
+
+ FoundOld:
+ MessageBox MB_OK "JRE too old: $3 is older than $4"
+ ; Push ${TEMP2}
+ Push "-1"
+ Goto DetectJREEnd
+ FoundNew:
+ ;MessageBox MB_OK "JRE is new: $3 is newer than $4"
+
+ Push "$2"
+ ; Push "OK"
+ ; Return
+ Goto DetectJREEnd
+ DetectJREEnd:
+ ; Top of stack is return value, then r4,r3,r2,r1
+ Exch ; => r4,rv,r3,r2,r1,r0
+ Pop $4 ; => rv,r3,r2,r1r,r0
+ Exch ; => r3,rv,r2,r1,r0
+ Pop $3 ; => rv,r2,r1,r0
+ Exch ; => r2,rv,r1,r0
+ Pop $2 ; => rv,r1,r0
+ Exch ; => r1,rv,r0
+ Pop $1 ; => rv,r0
+ Exch ; => r0,rv
+ Pop $0 ; => rv
+ FunctionEnd
+
+ #
+ # </DetectJRE>
+ #
+
+ #
+ # <ConvertUnixNewLines>
+ #
+
+ Function ConvertUnixNewLines
+ ; Usage:
+ ;Push "path\to\text_file.txt"
+ ;Call ConvertUnixNewLines
+
+ Exch $R0 ;file #1 path
+ Push $R1 ;file #1 handle
+ Push $R2 ;file #2 path
+ Push $R3 ;file #2 handle
+ Push $R4 ;data
+ Push $R5
+
+ FileOpen $R1 $R0 r
+ GetTempFileName $R2
+ FileOpen $R3 $R2 w
+
+ loopRead:
+ ClearErrors
+ FileRead $R1 $R4
+ IfErrors doneRead
+
+ StrCpy $R5 $R4 1 -1
+ StrCmp $R5 $\n 0 +4
+ StrCpy $R5 $R4 1 -2
+ StrCmp $R5 $\r +3
+ StrCpy $R4 $R4 -1
+ StrCpy $R4 "$R4$\r$\n"
+
+ FileWrite $R3 $R4
+
+ Goto loopRead
+ doneRead:
+
+ FileClose $R3
+ FileClose $R1
+
+ SetDetailsPrint none
+ Delete $R0
+ Rename $R2 $R0
+ SetDetailsPrint both
+
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $R0
+ FunctionEnd
+
+ #
+ # </ConvertUnixNewLines>
+ #
+ #
+ # <ReplaceInFile>
+ #
+ Function ReplaceInFile
+ ;
+ Exch $R0 ;file name to search in
+ Exch
+ Exch $R4 ;callback function handle
+ Push $R1 ;file handle
+ Push $R2 ;temp file name
+ Push $R3 ;temp file handle
+ Push $R5 ;line read
+
+ GetTempFileName $R2
+ FileOpen $R1 $R0 r ;file to search in
+ FileOpen $R3 $R2 w ;temp file
+
+ loop_read:
+ ClearErrors
+ FileRead $R1 $R5 ;read line
+ Push $R5 ; put line on stack
+ Call $R4
+ Pop $R5 ; read line from stack
+ IfErrors exit
+ FileWrite $R3 $R5 ;write modified line
+ Goto loop_read
+ exit:
+ FileClose $R1
+ FileClose $R3
+
+ SetDetailsPrint none
+ Delete $R0
+ Rename $R2 $R0
+ Delete $R2
+ SetDetailsPrint both
+
+ ; pop in reverse order
+ Pop $R5
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $R4
+ Pop $R0
+ FunctionEnd
+
+ #
+ # </ReplaceInFile>
+ #
+ #
+ # <ReplaceJavaHome>
+ #
+
+ # Replaces the '@java.home@' placeholder
+ Function ReplaceJavaHome
+ Push $R1
+ Exch
+
+ Push "@java.home@" # String to find
+ Push "$JAVA_HOME_DIR" # Replacement string
+ Call StrReplace
+
+ ; restore stack
+ Exch
+ Pop $R1
+ FunctionEnd
+
+ #
+ # </ReplaceJavaHome>
+ #
+ #
+ # <ReplaceInstallationDirectory>
+ #
+
+ # Replaces the '@installation.directory@' placeholder
+ Function ReplaceInstallationDirectory
+ Push $R1
+ Exch
+
+ Push "@installation.directory@" # String to find
+ Push "$SERVER_HOME_DIR" # Replacement string
+ Call StrReplace
+
+ ; restore stack
+ Exch
+ Pop $R1
+ FunctionEnd
+
+ #
+ # </ReplaceInstallationDirectory>
+ #
+ #
+ # <StrReplace>
+ #
+
+ Var STR_REPLACE_VAR_0
+ Var STR_REPLACE_VAR_1
+ Var STR_REPLACE_VAR_2
+ Var STR_REPLACE_VAR_3
+ Var STR_REPLACE_VAR_4
+ Var STR_REPLACE_VAR_5
+ Var STR_REPLACE_VAR_6
+ Var STR_REPLACE_VAR_7
+ Var STR_REPLACE_VAR_8
+
+ Function StrReplace
+ Exch $STR_REPLACE_VAR_2
+ Exch 1
+ Exch $STR_REPLACE_VAR_1
+ Exch 2
+ Exch $STR_REPLACE_VAR_0
+ StrCpy $STR_REPLACE_VAR_3 -1
+ StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
+ StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+ loop:
+ IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
+ StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
+ StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
+ StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
+ Goto loop
+ found:
+ StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
+ IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
+ StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
+ StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
+ StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+ Goto loop
+ done:
+ Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
+ Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
+ Exch $STR_REPLACE_VAR_0
+ FunctionEnd
+
+ !macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
+ Push "${HAYSTACK}"
+ Push "${NEEDLE}"
+ Push "${NEEDLE2}"
+ Call StrReplace
+ Pop "${OUT}"
+ !macroend
+
+ !define StrReplace '!insertmacro "_strReplaceConstructor"'
+
+ #
+ # </StrReplace>
+ #
Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper-installation.conf
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper-installation.conf?rev=1000540&r1=1000539&r2=1000540&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper-installation.conf (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/wrapper-installation.conf Thu Sep 23 17:13:41 2010
@@ -17,7 +17,8 @@
# under the License.
#
-wrapper.java.command=@app.java.home@
+# Path to java executable
+${wrapper.java.command}
wrapper.java.mainclass=org.apache.directory.server.ApacheDsTanukiWrapper