ADempiere with Java6, PostgreSQL8.3

From NSIS Wiki

Download ADempiereInstaller1111.zip
  • This installer runs under MS Windows platform and will install everything you need:
    • Java JDK (version 1.6.0.130)
    • Postgres Database (version 8.3)
    • ADempiere (release 360Trunk/SUPER1s)
    • Setup ADempiere's environment and home settings
    • Import the latest 360LTS migrated to Trunk 1st January 2011 database dump

You can follow How to Use Installer. You can also look at its main NSIS files.

Credits to Kai Schaeffer

The end product is to get these installed
  • This amazing for Windows only installer is kindly contributed by Kai Schaeffer, based on NSIS. He has even put the source to create the installer in the SVN! Find it there under this path:
contributions/WindowsInstaller/src/

Upgrading The NSIS Installer

  • Doing this is very easy.
  • Google for NSIS information and download NSIS Setup software which is free.
  • Take the script contributed by Kai from the SVN/contributions folder.
  • Study the script on what changes to make. Hint - read the readme.
  • Point your NSIS to your scripts and compile a new one.

Upgraded for 360LTS+

  • Redhuan D. Oon upgraded a new NSIS from the Adempiere.nsi renaming it to RestoreAdempiere.nsi
  • The idea is to make it restore from an ExpDat.dmp that is exported from a latest trunk migration script for 360LTS.
  • To install ExecDOS, just put its DLL in the plugin folder of the NSIS installation in Windows you are compiling from.
  • To create the installer exe file, right-click the main NSI and select 'compile script'.

Environment

  • Java 6
  • PostgreSQL 8.3
  • Windows 7

Issue

PG Installer

  • As of PGv8.2 onwards, to execute the PG-int.msi installer, ADDLOCAL is limited to the following params, dropping such as 'jdbc' to avoid creation error 2711:
ExecWait ... ADDLOCAL=server,psql,pgadmin ...
  • At the moment, NSIS does not copy over some files for RUN_silentsetup.bat. My suspicion is the way i interpreted Kai's instruction: ' Main/  : Containing the ADempiere files. Just extract the desired ADempiere version into this folder'.
    • Now does Kai mean, extract the Adempiere folder level into it, or the contents below the Adempiere level?
    • This point arise after i noticed in the prompts that 2 files were uncopied as if they are not at ${INSTDIR} which is <ADEMPIERE_HOME> directory.
      • "$INSTDIR\AdempiereEnvTemplate.properties" and
      • "$INSTDIR\AdempiereEnvTemplate.properties" which both won't be there as they are one level lower. i.e. /$INSTDIR/Adempiere.
    • Thus if there is no extra folder 'Adempiere' then the path will be correct.
    • I recompiled with the Main/ contents been without /Adempiere but its contents.
    • Then i execute the Installer and it worked!!! I am the master of the universe. :) :)

JDK Installer

  • Not so fast. I did not get to test the JDK installer yet as my target machine has Java and the installer can bypass installed portions of the stack (including for ADempiere and PG).
  • When i test on a non-Java machine the JDK portion just throw out a dialog box showing its arguments and when click its ok box, just abort and move on without any error message why Java is not there.
  • The NSIS script:
ExecWait '"$INSTDIR\${JDK_INSTALLER}" /S /v"/qr ADDLOCAL=ToolsFeature INSTALLDIR=\"$JDK_INSTDIR\"'
  • It is solved by tidying up the script:
ExecWait '"$INSTDIR\${JDK_INSTALLER}" /s /v "/qr INSTALLDIR=\"$JDK_INSTDIR\""'

NSI Script

  • The following is presently my NSI script/bat which is tested well in the field by the community:
  • Note that i changed ImportAdempiere to RestoreAdempiere and Adempiere_pg.dmp to ExpDat.dmp which i upgraded prior to latest trunk code and migration scripts.

RestoreAdempiere.nsi

/* ADempiere Windows installer, Copyright (C) 2008  Kai Schaeffer - Schaeffer AG
 * http://www.adempiereerp.de
 * Upgraded by Redhuan D. OOn (www.red1.org)
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
Â¥*/
 
; Common basic defines
!define PRODUCT_NAME "ADempiere"
!define PRODUCT_VERSION "360Trunk"
!define PRODUCT_PUBLISHER "ADempiere Deutschland e.V. / red1"
!define PRODUCT_WEB_SITE "http://www.adempiere.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Adempiere.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
 
; Adempiere defines
!define SOURCE_FILE_DIR "..\..\AdempiereFiles"
!define INSTALLER_SOURCE_DIR "."
!define OUT_DIR ${SOURCE_FILE_DIR}
 
; JDK defines
!define JDK_DEFAULT_DIR "$PROGRAMFILES\Java"
!define JDK_INSTALLER "java6.exe"
 
; PostgreSQL defines
!define PG_DEFAULT_DIR "$PROGRAMFILES\PostgreSQL\8.3"
!define PG_INSTALLER_BASE "postgresql-8.3"
 
 
; Include files
!include "MUI.nsh"
!include "LogicLib.nsh"
!include "EnvVarUpdate.nsh"
!include "nsDialogs.nsh"
!include "AdempiereLib.nsh"
!include "TextFunc.nsh"
!include "WordFunc.nsh"
 
!insertmacro ConfigWrite
!insertmacro ConfigRead
 
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON ..\AD.ico
!define MUI_UNICON ..\adempiere.ico
!define MUI_CUSTOMFUNCTION_GUIINIT CustomGUIInit
; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
 
; Needed Variables
VAR JDK_VERSION 	; Version of the installed JDK
VAR JDK_DIR         ; Directory of the installed JDK (empty string if no JDK)
VAR JDK_INSTDIR     ; Directory to install a new JDK
 
VAR PG_INSTDIR      ; Directory to install PostgreSQL
VAR PG_PASSWORD     ; Password for PostgreSQL installtion (and all the rest for now)
VAR PG_OLD_VERSION  ; Version of an installed PG
VAR PG_OLD_DIR      ; Directory of an installed PG (Empty string if no PG)
VAR PG_PORT         ; PostgreSQL Port (5432)
VAR PG_CREATEUSER   ; 1=Create PG system account, 0=Don't create
VAR PG_USER         ; Username of PG system account
 
VAR COMPUTER_NAME
 
# Reserved Files
ReserveFile "${NSISDIR}\Plugins\AdvSplash.dll"
!insertmacro VersionCompare
 
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "${INSTALLER_SOURCE_DIR}\license.txt"
 
; Insert our own pages: Directory selection and password query
!include "CustomPages.nsh"
 
!insertmacro MUI_PAGE_INSTFILES
; Finish page
;!define MUI_FINISHPAGE_RUN "$INSTDIR\AppMainExe.exe"
;!insertmacro MUI_PAGE_FINISH
 
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
 
; Language files
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE German
!insertmacro MUI_LANGUAGE Malay
!insertmacro MUI_LANGUAGE SimpChinese
!insertmacro MUI_LANGUAGE Japanese
!insertmacro MUI_LANGUAGE Spanish
!insertmacro MUI_LANGUAGE Thai
!insertmacro MUI_LANGUAGE Italian
!insertmacro MUI_LANGUAGE Russian
!insertmacro MUI_LANGUAGE Korean
!insertmacro MUI_LANGUAGE French
!insertmacro MUI_LANGUAGE Arabic
!include "LangStrings.nsh"
 
; MUI end ------
 
Var PRODUCT_VERSION
Var EXPECTED_LINES_BUILD
Var EXPECTED_LINES_IMPORT
 
Name "${PRODUCT_NAME} $PRODUCT_VERSION"
OutFile "${OUT_DIR}\Adempiere${PRODUCT_VERSION}_Setup.exe"
InstallDir "$PROGRAMFILES\ADempiere"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
 
Function CustomGUIInit
    Push $R6
    Push $R7
    BgImage::SetReturn /NOUNLOAD on
    BgImage::SetBg /NOUNLOAD /GRADIENT 0 128 0 0 0 0
    Pop $R6
    Strcmp $R6 success 0 error
    File /oname=$PLUGINSDIR\bgimage.bmp ..\rednook.bmp
    System::call "user32::GetSystemMetrics(i 0)i.R6"
    System::call "user32::GetSystemMetrics(i 1)i.R7"
    IntOp $R6 $R6 - 783
    IntOp $R6 $R6 / 2
    IntOp $R7 $R7 - 369
    IntOp $R7 $R7 / 2
    BGImage::AddImage /NOUNLOAD $PLUGINSDIR\bgimage.bmp $R6 $R7
    CreateFont $R6 "Times New Roman" 26 700 /ITALIC
    BGImage::AddText /NOUNLOAD "$(^SetupCaption)" $R6 255 255 255 16 8 500 100
    Pop $R6
    Strcmp $R6 success 0 error
    BGImage::Redraw /NOUNLOAD
    File /oname=$PLUGINSDIR\bgimage.wav ..\promise.wav
    BGImage::Sound /NOUNLOAD /LOOP $PLUGINSDIR\bgimage.wav
    Goto done
error:
    MessageBox MB_OK|MB_ICONSTOP $R6
done:
    Pop $R7
    Pop $R6
FunctionEnd
 
Function .onGUIEnd
    BGImage::Sound /NOUNLOAD /STOP
    BGImage::Destroy
FunctionEnd
 
Function .onInit
    InitPluginsDir
    Push $R5
    File /oname=$PLUGINSDIR\spltmp.bmp ..\ADBox.bmp
    advsplash::show 2220 999 999 -1 $PLUGINSDIR\spltmp
    Pop $R5
    Pop $R5
    !insertmacro MUI_LANGDLL_DISPLAY
	;Read Settings from .ini-File
    File /oname=$TEMP\InstallerSettings.ini "${INSTALLER_SOURCE_DIR}\InstallerSettings.ini"
 
    ${ConfigRead} "$TEMP\InstallerSettings.ini" "Version=" $PRODUCT_VERSION
	IfErrors 0 +2
    strcpy $PRODUCT_VERSION ${PRODUCT_VERSION}
 
    ${ConfigRead} "$TEMP\InstallerSettings.ini" "ExpectedLinesBuild=" $EXPECTED_LINES_BUILD
	IfErrors 0 +2
    strcpy $EXPECTED_LINES_BUILD "135"
 
    ${ConfigRead} "$TEMP\InstallerSettings.ini" "ExpectedLinesImport=" $EXPECTED_LINES_IMPORT
	IfErrors 0 +2
    strcpy $EXPECTED_LINES_IMPORT "4600"
 
	Delete "$TEMP\InstallerSettings.ini"
 
    !insertmacro IsUserAdmin $0
	; Check is User is admin
    ${if} $0 != "1"
		 MessageBox MB_ICONEXCLAMATION|MB_OK $(LocS_Admin)
		 Abort
	${endif}
 
	; Get computer name
    ReadRegStr $COMPUTER_NAME HKLM "SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" "ComputerName"
 
	; Check if JDK is installed
	ReadRegStr $JDK_VERSION HKLM "Software\JavaSoft\Java Development Kit" "CurrentVersion"
    ${VersionCompare} $JDK_VERSION "1.6" $0
	; if installed JDK version < 1.5 then install the new one.
	${if} $0 == "2"
       StrCpy $JDK_VERSION ""
	${endif}
    ReadRegStr $JDK_DIR HKLM "Software\JavaSoft\Java Development Kit\$JDK_VERSION" "JavaHome"
 
    ; Set defaults for PG installation
    StrCpy $PG_PASSWORD ""
	StrCpy $PG_USER "postgres"
	StrCpy $PG_PORT "5432"
 
	; Check if another PostgreSQL is installed
    EnumRegKey $1 HKLM SOFTWARE\PostgreSQL\Installations\ "0"
  	${if} $1 != ""
        ReadRegStr $PG_OLD_VERSION HKLM "SOFTWARE\PostgreSQL\Installations\$1" "Version"
    	ReadRegStr $PG_OLD_DIR HKLM "SOFTWARE\PostgreSQL\Installations\$1" "Base Directory"
    	; if installed version is < 8.3 then abort
    	${VersionCompare} $PG_OLD_VERSION "8.3" $0
		${if} $0 == "2"
		    MessageBox MB_ICONEXCLAMATION|MB_OK  $(LocS_PostgresOld)
		 	Abort
		${endif}
		;MessageBox MB_OKCANCEL|MB_ICONQUESTION "PostgreSQL $PG_OLD_VERSION is already installed on this computer. This installation will be used for ADempiere." IDOK pg_ok
		;Abort "Installation aborted!"
      pg_ok:
	${endif}
FunctionEnd
 
 
Section "JDK" SEC01
	SetOutPath "$INSTDIR"
	SetOverwrite ifnewer
	; install JDK if no recent is installed
	${if} $JDK_DIR == ""
		File "${SOURCE_FILE_DIR}\Tools\${JDK_INSTALLER}"
		ExecWait '"$INSTDIR\${JDK_INSTALLER}" /s /v "/qr INSTALLDIR=\"$JDK_INSTDIR\""'
		StrCpy $JDK_DIR $JDK_INSTDIR
		Delete "$INSTDIR\${JDK_INSTALLER}"
	${else}
		DetailPrint "Skipping JDK installation"
	${endif}
	; Check JAVA_HOME enviroment variable. If already set to another destination we should correct it
	ReadEnvStr $0 "JAVA_HOME"
	${if} $0 != $JDK_DIR
	${andif} $0 != ""
	    MessageBox MB_YESNO $(LocS_JavaHome) /SD IDYES IDNO JavaHomeNo
	${endif}
	; Set JAVA_HOME on the system ...
    WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "JAVA_HOME" $JDK_DIR
    ; ... and for this context
	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("JAVA_HOME", "$JDK_DIR").r0'
	; Update path. We need all this that pl/java is working
    ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$JDK_DIR\bin" ; Append
    ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$JDK_DIR\jre\bin" ; Append
    ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$JDK_DIR\jre\bin\client" ; Append
	ReadEnvStr $0 "PATH"
	StrCpy $1 "$0;$JDK_DIR\bin;$JDK_DIR\jre\bin;$JDK_DIR\jre\bin\client"
    System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", "$1").r0'
 
  JavaHomeNo:
 
SectionEnd
 
Section "PostgreSQL" SEC02
	; Install PostgreSQL is no recent version is installed
	${if} $PG_OLD_DIR == ""
        File "${SOURCE_FILE_DIR}\Tools\${PG_INSTALLER_BASE}*.*"
    	ExecWait 'msiexec /i "$INSTDIR\${PG_INSTALLER_BASE}-int.msi" /qr INTERNALLAUNCH=1 ADDLOCAL=server,pgadmin SERVICEDOMAIN="$COMPUTER_NAME" SERVICEACCOUNT="$PG_USER" SERVICEPASSWORD="$PG_PASSWORD" SUPERPASSWORD="$PG_PASSWORD" CREATESERVICEUSER=$PG_CREATEUSER PERMITREMOTE=1 ENCODING=UTF-8 BASEDIR="$PG_INSTDIR"'
    	Delete "$INSTDIR\${PG_INSTALLER_BASE}-int.msi"
    	Delete "$INSTDIR\${PG_INSTALLER_BASE}.msi"
	${else}
		DetailPrint "Skipping PostgreSQL installation"
    ${endif}
    ; Include the bin dir to the path. Is needed by some ADempiere batch files.
    ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$PG_INSTDIR\bin" ; Append
	ReadEnvStr $0 "PATH"
	StrCpy $1 "$0;$PG_INSTDIR\bin"
    System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", "$1").r0'
SectionEnd
 
; Helper function for ADempiere database import
; It's called for every line of the output. It writes these lines to
; a log file and updates the %-display. For newer versions the
; "EXPECTED_LINES_*" defines may be adjusted.
Function ImportProgress
	Pop $0 ; Get outpur line
	IntOp $R8 $R8 + 1
	FileWrite $R9 $0
	FileWriteByte $R9 "13"
    FileWriteByte $R9 "10"
 
	SetDetailsPrint textonly
	IntOp $1 $R8 * 100
	IntOp $1 $1 / $EXPECTED_LINES_IMPORT
	DetailPrint "Importing Database ... $1%"
 
FunctionEnd
 
; Helper function for ADempiere build 
; It's called for every line of the output. It writes these lines to
; the DetailPrint and updates the %-display. For newer versions the
; "EXPECTED_LINES_*" defines may be adjusted.
Function BuildProgress
	Pop $0
	SetDetailsPrint listonly
	DetailPrint $0
	IntOp $R8 $R8 + 1
	SetDetailsPrint textonly
	IntOp $1 $R8 * 100
	IntOp $1 $1 / $EXPECTED_LINES_BUILD
	DetailPrint "Building Adempiere ... $1%"
FunctionEnd
 
Section "MainSection" SEC03
	; Extract the ADempiere files
    File /r "${SOURCE_FILE_DIR}\Main\*.*"
    ; Extract new import batch file which is not included in the standard distribution
    ; This file is not waiting for an input like the original one and is working if the
    ; "utils"-directory is not the active one.
    File /oname=utils\RUN_RestoreAdempiereMSI.bat "${INSTALLER_SOURCE_DIR}\HelpBatchFiles\RUN_RestoreAdempiereMSI.bat"
    ; Get ADempiereEnv.properties template for the silent setup
	CopyFiles /SILENT "$INSTDIR\AdempiereEnvTemplate.properties" "$INSTDIR\AdempiereEnv.properties"
	; Set ADempiere home enviroment var
    WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "ADEMPIERE_HOME" $INSTDIR
    System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("ADEMPIERE_HOME", "$INSTDIR").r0'
 
	; Set values in the properties file
    ${StrReplaceV4} $R0 "\" "\\" $INSTDIR
    ${StrReplaceV4} $R1 ":" "\:" $R0
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_HOME=" $R1 $R0
    ${StrReplaceV4} $R9 "\" "\\" $JDK_DIR
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "JAVA_HOME=" $R9 $R0
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_DB_PASSWORD=" $PG_PASSWORD $R0
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_DB_SYSTEM=" $PG_PASSWORD $R0
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_DB_PORT=" $PG_PORT $R0
 
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_WEB_PORT=" "8080" $R0
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_SSL_PORT=" "8443" $R0
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_APPS_SERVER=" $COMPUTER_NAME $R0
 
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_KEYSTORE=" "$R9\\keystore\\myKeystore" $R0
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_KEYSTOREPASS=" $PG_PASSWORD $R0
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_CERT_CN=" $COMPUTER_NAME $R0
    ${ConfigWrite} "$INSTDIR\AdempiereEnv.properties" "ADEMPIERE_CERT_COUNTRY=" "US" $R0
 
	CopyFiles /SILENT "$INSTDIR\AdempiereEnv.properties" "$INSTDIR\AdempiereEnv.properties.save"
 
	; Now start the silent setup. The output is pushed to the function "BuildProgress"
	SetDetailsPrint both
	DetailPrint $(LocS_AdempiereBuild)
 
    StrCpy $R8 "0"
    GetFunctionAddress $0 BuildProgress
    ExecDos::exec /NOUNLOAD /TOFUNC "$INSTDIR\RUN_silentsetup.bat" "" $0
    Pop $0
 
	SetDetailsPrint listonly
	; Could be used the determine the total number for the "EXPECTED_LINES_*" defines
	DetailPrint "Total lines (Build): $R8"
 
	; Now start the database import. The output is pushed to the function "ImportProgress"
	DetailPrint $(LocS_AdempiereImport1)
	DetailPrint $(LocS_AdempiereImport2)
 
    StrCpy $R8 "0"
    FileOpen $R9 "$INSTDIR\Import.log" w
    GetFunctionAddress $0 ImportProgress
    ExecDos::exec /NOUNLOAD /TOFUNC "$INSTDIR\utils\RUN_RestoreAdempiereMSI.bat" "" $0
    Pop $0
    FileClose $R9
 
	SetDetailsPrint both
	DetailPrint "Total lines (Import): $R8"
 
 
	; Create entries in the start menu
    CreateDirectory "$SMPROGRAMS\ADempiere"
    CreateShortCut "$SMPROGRAMS\ADempiere\ADempiere Client.lnk" "$INSTDIR\lib\Adempiere.exe"
    CreateShortCut "$SMPROGRAMS\ADempiere\About ADempiere.lnk" "$INSTDIR\index.html"
    CreateDirectory "$SMPROGRAMS\ADempiere\Server"
    CreateShortCut "$SMPROGRAMS\ADempiere\Server\Run ADempiere server.lnk" "$INSTDIR\utils\RUN_Server2.bat"
    CreateShortCut "$SMPROGRAMS\ADempiere\Server\Stop ADempiere server.lnk" "$INSTDIR\utils\RUN_Server2Stop.bat"
    CreateShortCut "$SMPROGRAMS\ADempiere\Server\Install ADempiere server as a service.lnk" "$INSTDIR\utils\windows\Adempiere_Service_Install.bat"
    CreateShortCut "$SMPROGRAMS\ADempiere\Server\Remove ADempiere server service.lnk" "$INSTDIR\utils\windows\Adempiere_Service_Uninstall.bat"
 
SectionEnd
 
Section -AdditionalIcons
  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
  CreateShortCut "$SMPROGRAMS\ADempiere\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
  CreateShortCut "$SMPROGRAMS\ADempiere\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
 
Section -Post
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\RUN_ADempiere.bat"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\lib\Adempiere.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
 
 
Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
 
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
  Abort
FunctionEnd
 
Section Uninstall
  Delete "$INSTDIR\RUN_*"
  Delete "$INSTDIR\AdempiereEnvTemplate.properties"
  Delete "$INSTDIR\build.xml"
  Delete "$INSTDIR\index.html"
  Delete "$INSTDIR\install.html"
  Delete "$INSTDIR\install-fyracle.html"
  Delete "$INSTDIR\license.html"
  Delete "$INSTDIR\rel253.html"
  RMDir /r "$INSTDIR\data"
  RMDir /r "$INSTDIR\images\"
  RMDir /r "$INSTDIR\jboss\"
  RMDir /r "$INSTDIR\lib\"
  RMDir /r "$INSTDIR\packages\"
  RMDir /r "$INSTDIR\utils\"
  RMDir /r "$INSTDIR\keystore"
  Delete "$INSTDIR\${PRODUCT_NAME}.url"
  Delete "$INSTDIR\uninst.exe"
 
  Delete "$SMPROGRAMS\ADempiere\Uninstall.lnk"
  Delete "$SMPROGRAMS\ADempiere\ADempiere.lnk"
  Delete "$SMPROGRAMS\ADempiere\Website.lnk"
  Delete "$SMPROGRAMS\ADempiere\ADempiere Client.lnk"
  Delete "$SMPROGRAMS\ADempiere\About ADempiere.lnk"
  Delete "$SMPROGRAMS\ADempiere\Server\Run ADempiere server.lnk"
  Delete "$SMPROGRAMS\ADempiere\Server\Stop ADempiere server.lnk"
  Delete "$SMPROGRAMS\ADempiere\Server\Install ADempiere server as a service.lnk"
  Delete "$SMPROGRAMS\ADempiere\Server\Remove ADempiere server service.lnk"
 
  Delete "$DESKTOP\ADempiere.lnk"
  Delete "$DESKTOP\Adempiere Web Site.url"
 
  RMDir "$SMPROGRAMS\ADempiere\Server"
  RMDir "$SMPROGRAMS\ADempiere"
  RMDir "$INSTDIR"
 
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  SetAutoClose true
SectionEnd

RUN_RestoreAdempiereMSI.bat

@Rem $Id: RUN_ImportAdempiereMSI.bat,v 1.12 2005/01/22 21:59:15 $
@Rem Verion for Windows Installer - Kai Schaeffer - 2008-11-21 
 
@if (%ADEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %ADEMPIERE_HOME%\utils\myEnvironment.bat Server)
@Title Restore Adempiere - %ADEMPIERE_HOME% (%ADEMPIERE_DB_NAME%)
 
 
@echo Re-Create Adempiere User and import %ADEMPIERE_HOME%\data\ExpDat.dmp - (%ADEMPIERE_DB_NAME%)
@dir %ADEMPIERE_HOME%\data\ExpDat.dmp
@echo == DBRestore from ExpDat.dmp that has migration scripts applied. The import will show warnings. This is OK ==
 
@Rem Parameter: <systemAccount> <AdempiereID> <AdempierePwd>
@Rem globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres (ignored in oracle)
@call %ADEMPIERE_DB_HOME%\DBRestore system/%ADEMPIERE_DB_SYSTEM% %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD% %ADEMPIERE_DB_SYSTEM%
 
@call %ADEMPIERE_HOME%\utils\RUN_SignDatabaseBuild > NUL 2>&1

Latest DB Dump

  • I am able to upgrade the installer to restore from a better prepared DB instance:
    • Expdat dump updated to include open periods for 2010 and 2011
    • For this year 2011 in GardenWorld, 2 POS processed order and one posted of its Invoice
    • Login as GardenWorld/Store to get to the unprocessed invoice of the first completed SO and zoom across its invoice to post the accts and view it.

Troubleshooting

  • A possible issue you might encountered is during first launch where the properties may need some caching.
  • If the connection dialog box opens, select the database preference as Postgres. I have removed the Oracle and MySQL jar files to make room for my song to be in the installer.
  • Choose 'localhost' for the DB Host.
  • Choose 'adempiere' as the DB name.
  • To avoid confusion you should put 'adempiere' for any passwords setting until you get things running.

Bells and Whistles

  • I put in something fun. You have to logout other applications and turn on the speakers to medium for the maximum impact.

Languages supported

  • I turned on the knob quite full blast and have all the common country languages included to guide the installation process.
  • So if you think there are more relevant languages that this installer needs to be in, please add to the list below and i shall have that included in my next compilation:
    • English
    • German
    • Spanish
    • French
    • Italian
    • Russian
    • Chinese
    • Japanese
    • Korean
    • Arabic
    • Malay
    • Thai
  • But in order for some words to come out for unique prompts please help me to translate to your language. Add the lines below as shown:
LangString LocS_Admin ${LANG_GERMAN}  "Sie m¸ssen ¸ber Administratorrechte verf¸gen um mit der Installation fortfahren zu kˆnnen."
LangString LocS_Admin ${LANG_ENGLISH} "You must be an administrator to process with the installtion."
LangString LocS_Admin ${LANG_MALAY} "Anda mesti mempunyai hak Admin untuk memproses pemasangan."
 
LangString LocS_DestHeadLong ${LANG_ENGLISH} "Choose the folders for the installation of $(^NameDA)."
LangString LocS_DestHeadLong ${LANG_GERMAN}  "Bitten w‰hlen Sie die Verzeichnisse f¸r die Installation von $(^NameDA)."
LangString LocS_DestHeadLong ${LANG_MALAY} "Pilih direktori untuk pemasangan $(^NameDA)."
 
 
LangString LocS_DestHeadShort ${LANG_ENGLISH} "Choose Install Location"
LangString LocS_DestHeadShort ${LANG_GERMAN} "Installationsverzeichnisse w‰hlen"
LangString LocS_DestHeadShort ${LANG_ENGLISH} "Pilih lokasi untuk dipasang"
 
LangString LocS_DestDesc ${LANG_ENGLISH} "Please select the destination directories for different components:"
LangString LocS_DestDesc ${LANG_GERMAN}  "Bitte w‰hlen Sie die Zielverzeichnisse f¸r die Verschiedenen Komponenten:"
LangString LocS_DestDesc ${LANG_MALAY} "Sila pilih direktori sasaran untuk lain-lain komponen:"
 
LangString LocS_Installed ${LANG_ENGLISH} "Already installed under:"
LangString LocS_Installed ${LANG_GERMAN} "Bereits installiert unter:"
LangString LocS_Installed ${LANG_MALAY} "Telah terpasang di bawah:"
 
 
LangString LocS_PostgresOld ${LANG_ENGLISH} "The installed version of PostgreSQL is too old (<8.1). Please uninstall this version or try a manual installtion of PostgreSQL."
LangString LocS_PostgresOld ${LANG_GERMAN} "Die installierte Version von PostgresSQL is zu alt (<8.1). Bitte entfernen Sie diese Version oder versuchen Sie eine manuelle Installtion von PostgreSQL."
LangString LocS_PostgresOld ${LANG_MALAY} "Versi PostgreSQL yang terpasang adalah terlalu lama (<8.1). Sila uninstall versi itu atau cuba pasang PostgreSQL secara manual."
 
LangString LocS_JavaHome ${LANG_ENGLISH} "The enviroment variable JAVA_HOME is already set to $0. It should be set to the installation folder of the JDK ($JDK_DIR). Should I correct this? (Say 'yes' if you are not sure.)"
LangString LocS_JavaHome ${LANG_GERMAN} "Die Umgebungsvariable JAVA_HOME ist bereits auf $0 gesetzt. Sie sollte aber auf das Installationsverzeichnis des JDK gesetzt werden ($JDK_DIR). Soll dies korrigiert werden? (Antworten Sie mit 'Ja' wenn Sie unsichern sind.)"
LangString LocS_JavaHome ${LANG_MALAY} "Petunjuk JAVA_HOME sudah dipasang ke $0. Ia sepatutnya dipasang ke direktori JDK ($JDK_DIR). Haruskah dibetulkan? (Jawab 'Ya' jika tidak pasti.)"
 
LangString LocS_AdempiereBuild ${LANG_ENGLISH} "Building ADempiere ... Please wait, this could take some minutes."
LangString LocS_AdempiereBuild ${LANG_GERMAN} "Erzeuge ADempiere-Umgebung ... Bitte warten, dies kann einige Minuten dauern."
LangString LocS_AdempiereBuild ${LANG_MALAY} "Membina ADempiere ... Sila tunggu, ini mungkin mengambil beberapa minit."
 
LangString LocS_AdempiereImport1 ${LANG_ENGLISH} "Importing Database ... Please wait, this could take a while."
LangString LocS_AdempiereImport1 ${LANG_GERMAN} "Importiere Datenbank ... Bitte warten, dies kann einen Moment dauern."
LangString LocS_AdempiereImport1 ${LANG_MALAY} "Mengimpot Pengkalan Data ... Sila tunggu, Ini mungkin mengambil masa."
 
LangString LocS_AdempiereImport2 ${LANG_ENGLISH} "For problems, please check the log file: $INSTDIR\Import.log"
LangString LocS_AdempiereImport2 ${LANG_GERMAN} "Sollten Probleme auftreten, schauen Sie bitte in die Log-Datei: $INSTDIR\Import.log"
LangString LocS_AdempiereImport2 ${LANG_MALAY} "Untuk Masalah, sila periksa fail log: $INSTDIR\Import.log"

Some Links

  • This is interesting to have in the next release: NSIS Log plugin that writes the installation output for later checking what has gone ok or not during the installation process.
Personal tools
donate
ads