Talk:Windows Installer

From ADempiere ERP Wiki

Jump to: navigation, search

Updating the main page. Copied the previous page contents here.

Image:Note.gif Note:

Latest version 361Aug installer contributed by Redhuan D. Oon/Kai Schaeffer based on CarlosRuiz's stable 361 with Fixed Assets, Maintenance and JavaPOS included. End-user guide provided. Thanks to Cozy for Japanese guide. There is also a Developer's page.

Microsoft Windows installer now makes it even easier to setup ADempiere. Get it installed within 15 minutes!
Fig.i 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 migrated from CarlosRuiz's maintained version of August 15th 2011 database dump
    • Includes latest upgraded Fixed Assets, Maintenance, and JavaPOS.

All you need to do after this is just to double-click on the application icon and it runs!

Contents

Download Installer

Fig.ii Right click to Run as administrator
  • Download the latest tested ADempiereInstaller1111.zip from here. (Fig.i)
  • Its size is 270Mb. Full execution on a Windows PC may take as fast as 15 minutes.
  • Related Sourceforge forum thread.
  • NOTE: When executing the installer, ensure you have UAC (User Account Control - needed in Vista) off and Run as administrator. (Fig.ii)

This installer has been tested many times to work quite easily. If you should hit an error, just Windows Uninstall the option concerned, ensure clean delete of old files and run the installer again.

  • Opening screen
Verification that File is not broken
Select your language

Just click Next and listen to the music

Screen 1 - 360Trunk/SUPER1S Welcome message
Screen 2 - Agreement on where to get warranty. Click on 'I Agree'
Screen 3 - Setting locations to save. Click 'Next'
Screen 4 - Starting Java install. Listen to music
Screen 5 - Now trying to install PostgreSQL
Screen 6 - PostgreSQL DB Install window opens. If it fails, it will rollback
Screen 7 - Now trying to build ADempiere
Screen 8 - Build ending. The only installer that works over 700%
Screen 9 - Restoring the Database from ExpDat.dmp
Screen 10 - Completed. The music ends

Uninstalling

  • Now you have succesfully installed everything as you can see on the screen below. From here you can do uninstall when needed.
Control Panel shows what you have installed which is Java 6.0.13, Postgres 8.3 and ADempiere
  • If you wish to uninstall due to some fault, you can do so from the Control Panel and select 'Uninstall Programs'.
  • Uninstall in the ADempiere_Home folder only removes the ADempiere binary and its folders and contents but do not remove Java nor Postgres.
  • You have to delete the folder of the packages you uninstalled to ensure it is cleanly removed. Otherwise a reinstall won't guarantee to work.

Troubleshooting

  • If ADempiere cannot launch at all.
    • Go to the DOS prompt and cd to your adempiere_home to launch adempiere. I.e. D:/Adempiere/RUN_Adempiere.bat
    • Note the prompt lines to tell you what are the errors for your further action. (see FiG 1)
FIG 1 - Going to DOS prompt to run ADempiere
FIG 2- Running Setup from DOS prompt

Run Setup

  • One way is to RUN_setup again to make sure all the settings are right. You can run this many times and it does not disrupt your database. See FIG 2.
    • D:/Adempiere/RUN_setup.bat FIG 3 will appear.
    • Put localhost as your Database Server name
FIG 3 - Setup Settings window
    • Click on TEST and on success click on SAVE.

Connection Test

  • If it launches but cannot connect to database.
    • Click on the Server connection icon. See FIG 4.
    • Select Postgres as database
    • Put localhost as your Database Server name.
    • Put 'adempiere' (or what you gave above) as password
    • Press the Test Database button only. All these refers to FIG 5.
    • If it turns green then only go to the Application Server.
FIG 4 - Click on the Server connection icon
FIG 5 - Try some settings and then Test

How To Upgrade To Latest Version

  • With ADempiere you can easily do that.
  • First you have to download the latest binary with data dump
  • Then you go and replace the binary in your home directory, and place the Adempiere.dmp in /data folder.
  • Then go to and run <ADempiere-Home>/RUN_Setup.bat or better still RUN_silentsetup.bat.
  • Then execute <ADempiere-Home>/utils/RUN_ImportAdempiere.bat

How Not To Overwrite Your Previous Version

  • Then do not run ImportAdempiere.bat but just run all the migration scripts since the last version.

How To Keep Updating to latest from Trunk

  • You run all the migration scripts from last release
  • You compile the latest trunk source and replace the newly compiled binary at <ADempiere-Home>
  • RUN_silentsetup.bat again

Upgrade

  • The installer development has moved to OSGi version.
  • There a constant new migration scripts upgrade installer is in development to handle any changes without the need to do it manually.



Image:Note.gif Note:

This page is for developers only. For newbie installation guide, just refer to the page tab above. These pages are maintained by Redhuan D. Oon. He also contributed this back to NSIS

Credits to Kai Schaeffer

  • 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. (What can't you say about microsoft windows?)
  • 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\""'

Space

  • There seems to be a problem if the path if C:\Programs Files\ADempiere with a space in it.
  • Temporary solution is to remove blank in default so i did that as C:\ADempiere.
  • Kai commented that it is not good solution and should be solved in the NSIS script or our binary.

NSI Script

  • The following is presently my NSI script/bat in progress:
  • 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.

Roadmap

  • Let's discuss what to put into the next installer.
  • I am thinking of a language pack follow through. That means if the user selects the home language, the installer asks if the user also wants it as the entire language pack. Cool huh?
  • Busines template. Now this probably will be a mind-blowing or SAP and the rest of the world experience as now the user can select the business most likely ADempiere is configured for:
    • Please select your business solution:-
    1. Simple trading company (PackIn package that has minimal items and windows with minimal columns)
    2. Simple POS (PackIn above package with POS Terminal setup as main menu starting workflow)
    3. Power Financials (PackIn with Cost Engine and GL Reconcilation)
    4. Power Manufacturer (PackIn with Libero Mfg)
    5. HR Payroll (PackIn with Libero HR Payroll)
    6. All of the above!
Personal tools