2008-11-03 15:57:36 +00:00
##############################################################################
#
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
2008-11-03 18:11:49 +00:00
# as published by the Free Software Foundation; either version 3
2008-11-03 15:57:36 +00:00
# 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, USA.
###############################################################################
!ifndef VERSION
!error "Do not forget to specify the version of OpenERP - /DVERSION=<VERSION>"
!endif
2007-06-05 13:05:35 +00:00
2008-10-29 11:22:51 +00:00
!include "MUI.nsh"
2007-06-05 13:05:35 +00:00
;--------------------------------
;General
2008-10-29 11:22:51 +00:00
;Name and file
2008-11-03 18:37:17 +00:00
Name "OpenERP Server"
2008-11-03 15:57:36 +00:00
OutFile "openerp-server-setup-${VERSION}.exe"
SetCompressor lzma
SetCompress auto
2007-06-05 13:05:35 +00:00
2008-10-29 11:22:51 +00:00
;Default installation folder
InstallDir "$PROGRAMFILES\OpenERP Server"
2007-06-05 13:05:35 +00:00
2008-10-29 11:22:51 +00:00
;Get installation folder from registry if available
2008-12-21 20:20:02 +00:00
InstallDirRegKey HKLM "Software\OpenERP Server" ""
2008-10-29 11:22:51 +00:00
2008-11-03 15:57:36 +00:00
BrandingText "OpenERP Server ${VERSION}"
2008-10-31 11:51:49 +00:00
2008-10-29 11:22:51 +00:00
;Vista redirects $SMPROGRAMS to all users without this
RequestExecutionLevel admin
2007-06-05 13:05:35 +00:00
;--------------------------------
;Variables
2008-10-29 11:22:51 +00:00
Var MUI_TEMP
Var STARTMENU_FOLDER
2007-06-05 13:05:35 +00:00
;--------------------------------
;Interface Settings
2008-10-29 11:22:51 +00:00
!define MUI_ABORTWARNING
2007-06-05 13:05:35 +00:00
2008-12-22 13:10:16 +00:00
!define REGKEY "SOFTWARE\$(^Name)"
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
!insertmacro MUI_RESERVEFILE_LANGDLL
2007-06-05 13:05:35 +00:00
;--------------------------------
;Pages
2008-11-03 17:16:02 +00:00
!define MUI_ICON ".\pixmaps\openerp-icon.ico"
2008-10-29 11:22:51 +00:00
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
2008-10-30 12:31:27 +00:00
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
2008-10-29 11:22:51 +00:00
!define MUI_HEADERIMAGE
2008-10-30 12:31:27 +00:00
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_HEADER_TRANSPARENT_TEXT ""
!define MUI_HEADERIMAGE_BITMAP ".\pixmaps\openerp-slogan.bmp"
2008-12-22 13:10:16 +00:00
!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LicenseText)"
!define MUI_LICENSEPAGE_BUTTON "$(LicenseNext)"
2008-10-29 11:22:51 +00:00
!insertmacro MUI_PAGE_WELCOME
2008-10-31 11:51:49 +00:00
!insertmacro MUI_PAGE_LICENSE "doc\License.rtf"
2008-10-29 11:22:51 +00:00
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
2008-12-21 20:20:02 +00:00
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
2008-10-29 11:22:51 +00:00
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenERP Server"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "OpenERP Server"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED
2008-12-22 13:10:16 +00:00
!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageText)"
2008-10-29 11:22:51 +00:00
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.txt
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
2007-06-05 13:05:35 +00:00
;--------------------------------
;Languages
2008-10-29 11:22:51 +00:00
!insertmacro MUI_LANGUAGE "English"
2008-12-22 13:10:16 +00:00
!insertmacro MUI_LANGUAGE "French"
2007-06-05 13:05:35 +00:00
2008-10-31 11:51:49 +00:00
!macro CreateInternetShortcut FILENAME URL
WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
!macroend
2007-06-05 13:05:35 +00:00
;--------------------------------
;Installer Sections
2008-11-03 14:04:48 +00:00
Function .onInit
2008-12-22 14:05:47 +00:00
!ifndef ALLINONE
2008-12-22 13:10:16 +00:00
;Language selection dialog
Push ""
Push ${LANG_ENGLISH}
Push English
Push ${LANG_FRENCH}
Push French
Push A ; A means auto count languages
; for the auto count to work the first empty push (Push "") must remain
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
2008-12-22 14:05:47 +00:00
!endif
2008-12-22 13:10:16 +00:00
2008-10-31 20:28:22 +00:00
ClearErrors
2008-12-21 20:20:02 +00:00
ReadRegStr $0 HKLM "Software\OpenERP Server" ""
2008-10-31 21:32:01 +00:00
IfErrors DoInstall 0
2008-12-22 13:10:16 +00:00
MessageBox MB_OK "$(CannotInstallServerText)"
2008-10-31 21:02:49 +00:00
Quit
2008-10-31 21:32:01 +00:00
DoInstall:
2008-11-03 14:04:48 +00:00
FunctionEnd
Section "OpenERP Server" SecOpenERPServer
2008-10-29 11:22:51 +00:00
nsExec::Exec "net stop openerp-service"
sleep 2
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
2008-10-31 11:51:49 +00:00
File /r "dist\*"
2008-10-29 11:22:51 +00:00
SetOutPath "$INSTDIR\service"
2008-10-31 11:51:49 +00:00
File /r "win32\dist\*"
File "win32\start.bat"
File "win32\stop.bat"
2008-10-29 11:22:51 +00:00
;Store installation folder
2008-12-21 20:20:02 +00:00
WriteRegStr HKLM "Software\OpenERP Server" "" $INSTDIR
2008-10-29 11:22:51 +00:00
2008-12-21 20:20:02 +00:00
!ifndef ALLINONE
2008-10-29 11:22:51 +00:00
;Create uninstaller
2008-11-03 15:57:36 +00:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Server" "DisplayName" "OpenERP Server ${VERSION}"
2008-10-29 11:22:51 +00:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Server" "UninstallString" "$INSTDIR\Uninstall.exe"
2008-12-21 20:20:02 +00:00
!else
WriteRegStr HKLM "Software\OpenERP AllInOne" "UninstallServer" "$INSTDIR\Uninstall.exe"
!endif
2008-10-29 11:22:51 +00:00
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenERP Server.lnk" "$INSTDIR\openerp-server.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start service.lnk" "$INSTDIR\service\start.bat"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Stop service.lnk" "$INSTDIR\service\stop.bat"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Edit config.lnk" "notepad.exe" "$INSTDIR\openerp-server.conf"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\View log.lnk" "notepad.exe" "$INSTDIR\openerp-server.log"
2008-12-21 20:20:02 +00:00
!ifndef ALLINONE
2008-10-30 12:31:27 +00:00
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe"
2008-12-21 20:20:02 +00:00
!endif
2008-10-31 11:51:49 +00:00
!insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Forum" "http://www.openerp.com/forum"
!insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Translation" "https://translations.launchpad.net/openobject"
2008-10-29 11:22:51 +00:00
!insertmacro MUI_STARTMENU_WRITE_END
2008-10-31 11:51:49 +00:00
nsExec::Exec '"$INSTDIR\openerp-server.exe" --stop-after-init --logfile "$INSTDIR\openerp-server.log" -s'
nsExec::Exec '"$INSTDIR\service\OpenERPServerService.exe" -auto -install'
2007-06-11 11:10:47 +00:00
2007-06-05 13:05:35 +00:00
SectionEnd
;Descriptions
;--------------------------------
;Uninstaller Section
Section "Uninstall"
2008-10-29 11:22:51 +00:00
nsExec::Exec "net stop openerp-service"
sleep 2
2008-10-31 11:51:49 +00:00
nsExec::Exec '"$INSTDIR\service\OpenERPServerService.exe" -remove'
2008-10-29 11:22:51 +00:00
sleep 2
RMDIR /r "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
2008-10-31 11:51:49 +00:00
Delete "$SMPROGRAMS\$MUI_TEMP\Forum.url"
Delete "$SMPROGRAMS\$MUI_TEMP\Translation.url"
2008-12-21 20:20:02 +00:00
!ifndef ALLINONE
2008-10-30 12:31:27 +00:00
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
2008-12-21 20:20:02 +00:00
!endif
2008-10-29 11:22:51 +00:00
Delete "$SMPROGRAMS\$MUI_TEMP\OpenERP Server.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Start service.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Stop service.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Edit config.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\View log.lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
2007-06-05 13:05:35 +00:00
2008-10-29 11:22:51 +00:00
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
2008-12-21 20:20:02 +00:00
!ifndef ALLINONE
2008-10-29 11:22:51 +00:00
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Server"
2008-12-21 20:20:02 +00:00
!else
DeleteRegKey HKLM "Software\OpenERP AllInOne\UninstallServer"
!endif
DeleteRegKey /ifempty HKLM "Software\OpenERP Server"
2007-06-05 13:05:35 +00:00
SectionEnd
2007-06-11 11:10:47 +00:00
Function LaunchLink
2008-10-29 11:22:51 +00:00
nsExec::Exec "net start openerp-service"
2007-06-11 11:10:47 +00:00
FunctionEnd
2008-12-22 13:10:16 +00:00
LangString LicenseText ${LANG_ENGLISH} "Usually, a proprietary license is provided with the software: limited number of users, limited in time usage, etc. This Open Source license is the opposite: it garantees you the right to use, copy, study, distribute and modify Open ERP for free."
2008-12-22 13:27:07 +00:00
LangString LicenseText ${LANG_FRENCH} "Normalement, une licence propri<72> taire est fournie avec le logiciel: limitation du nombre d'utilisateurs, limitation dans le temps, etc. Cette licence Open Source est l'oppos<6F> : Elle vous garantie le droit d'utiliser, de copier, d'<27> tudier, de distribuer et de modifier Open ERP librement."
2008-12-22 13:10:16 +00:00
LangString LicenseNext ${LANG_ENGLISH} "Next >"
LangString LicenseNext ${LANG_FRENCH} "Suivant >"
LangString FinishPageText ${LANG_ENGLISH} "Start OpenERP Server"
LangString FinishPageText ${LANG_FRENCH} "Lancer le serveur OpenERP"
;Language strings
LangString DESC_SecOpenERPServer ${LANG_ENGLISH} "OpenERP Server."
LangString DESC_SecOpenERPServer ${LANG_FRENCH} "Serveur OpenERP."
LangString CannotInstallServerText ${LANG_ENGLISH} "Can not install the Open ERP Server because a previous installation already exists on this system. Please uninstall your current installation and relaunch this setup wizard."
2008-12-22 13:27:07 +00:00
LangString CannotInstallServerText ${LANG_FRENCH} "Ne peut pas installer le serveur Open ERP parce qu'une installation existe d<> j<EFBFBD> <6A> sur ce syst<73> me. S'il vous plait, d<> sinstallez votre installation actuelle et relancer l'installeur."
2008-12-22 13:10:16 +00:00
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenERPServer} $(DESC_SecOpenERPServer)
!insertmacro MUI_FUNCTION_DESCRIPTION_END