1 ##############################################################################
3 # Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
5 # WARNING: This program as such is intended to be used by professional
6 # programmers who take the whole responsability of assessing all potential
7 # consequences resulting from its eventual inadequacies and bugs
8 # End users who are looking for a ready-to-use solution with commercial
9 # garantees and support are strongly adviced to contract a Free Software
12 # This program is Free Software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License
14 # as published by the Free Software Foundation; either version 3
15 # of the License, or (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 ###############################################################################
27 !error "Do not forget to specify the version of OpenERP - /DVERSION=<VERSION>"
30 ;--------------------------------
35 ;--------------------------------
40 OutFile "openerp-server-setup-${VERSION}.exe"
44 ;Default installation folder
45 InstallDir "$PROGRAMFILES\OpenERP Server"
47 ;Get installation folder from registry if available
48 InstallDirRegKey HKCU "Software\OpenERP Server" ""
50 BrandingText "OpenERP Server ${VERSION}"
52 ;Vista redirects $SMPROGRAMS to all users without this
53 RequestExecutionLevel admin
55 ;--------------------------------
61 ;--------------------------------
64 !define MUI_ABORTWARNING
66 ;--------------------------------
69 !define MUI_ICON ".\pixmaps\openerp-icon.ico"
70 !define MUI_WELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
71 !define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
72 !define MUI_HEADERIMAGE
73 !define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
74 !define MUI_HEADER_TRANSPARENT_TEXT ""
75 !define MUI_HEADERIMAGE_BITMAP ".\pixmaps\openerp-slogan.bmp"
76 !define MUI_LICENSEPAGE_TEXT_BOTTOM "Usually, a proprietary license provides 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."
78 !insertmacro MUI_PAGE_WELCOME
79 !insertmacro MUI_PAGE_LICENSE "doc\License.rtf"
80 !insertmacro MUI_PAGE_DIRECTORY
82 ;Start Menu Folder Page Configuration
83 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
84 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenERP Server"
85 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "OpenERP Server"
87 !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
89 !insertmacro MUI_PAGE_INSTFILES
91 !define MUI_FINISHPAGE_NOAUTOCLOSE
92 !define MUI_FINISHPAGE_RUN
93 !define MUI_FINISHPAGE_RUN_CHECKED
94 !define MUI_FINISHPAGE_RUN_TEXT "Start OpenERP Server"
95 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
96 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
97 !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.txt
98 !insertmacro MUI_PAGE_FINISH
101 !insertmacro MUI_UNPAGE_WELCOME
102 !insertmacro MUI_UNPAGE_CONFIRM
103 !insertmacro MUI_UNPAGE_INSTFILES
105 ;--------------------------------
108 !insertmacro MUI_LANGUAGE "English"
110 !macro CreateInternetShortcut FILENAME URL
111 WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
114 ;--------------------------------
118 ReadRegStr $0 HKCU "Software\OpenERP Server" ""
120 MessageBox MB_OK "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."
125 Section "OpenERP Server" SecOpenERPServer
126 nsExec::Exec "net stop openerp-service"
129 SetOutPath "$INSTDIR"
131 ;ADD YOUR OWN FILES HERE...
134 SetOutPath "$INSTDIR\service"
135 File /r "win32\dist\*"
136 File "win32\start.bat"
137 File "win32\stop.bat"
139 ;Store installation folder
140 WriteRegStr HKCU "Software\OpenERP Server" "" $INSTDIR
143 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Server" "DisplayName" "OpenERP Server ${VERSION}"
144 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Server" "UninstallString" "$INSTDIR\Uninstall.exe"
145 WriteUninstaller "$INSTDIR\Uninstall.exe"
147 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
149 CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
150 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenERP Server.lnk" "$INSTDIR\openerp-server.exe"
151 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start service.lnk" "$INSTDIR\service\start.bat"
152 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Stop service.lnk" "$INSTDIR\service\stop.bat"
153 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Edit config.lnk" "notepad.exe" "$INSTDIR\openerp-server.conf"
154 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\View log.lnk" "notepad.exe" "$INSTDIR\openerp-server.log"
155 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe"
156 !insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Forum" "http://www.openerp.com/forum"
157 !insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Translation" "https://translations.launchpad.net/openobject"
158 !insertmacro MUI_STARTMENU_WRITE_END
160 nsExec::Exec '"$INSTDIR\openerp-server.exe" --stop-after-init --logfile "$INSTDIR\openerp-server.log" -s'
161 nsExec::Exec '"$INSTDIR\service\OpenERPServerService.exe" -auto -install'
168 LangString DESC_SecOpenERPServer ${LANG_ENGLISH} "OpenERP Server."
170 ;Assign language strings to sections
171 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
172 !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenERPServer} $(DESC_SecOpenERPServer)
173 !insertmacro MUI_FUNCTION_DESCRIPTION_END
175 ;--------------------------------
179 nsExec::Exec "net stop openerp-service"
181 nsExec::Exec '"$INSTDIR\service\OpenERPServerService.exe" -remove'
185 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
187 Delete "$SMPROGRAMS\$MUI_TEMP\Forum.url"
188 Delete "$SMPROGRAMS\$MUI_TEMP\Translation.url"
189 Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
190 Delete "$SMPROGRAMS\$MUI_TEMP\OpenERP Server.lnk"
191 Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
192 Delete "$SMPROGRAMS\$MUI_TEMP\Start service.lnk"
193 Delete "$SMPROGRAMS\$MUI_TEMP\Stop service.lnk"
194 Delete "$SMPROGRAMS\$MUI_TEMP\Edit config.lnk"
195 Delete "$SMPROGRAMS\$MUI_TEMP\View log.lnk"
197 ;Delete empty start menu parent diretories
198 StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
203 GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
205 IfErrors startMenuDeleteLoopDone
207 StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
209 startMenuDeleteLoopDone:
211 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Server"
212 DeleteRegKey /ifempty HKCU "Software\OpenERP Server"
217 nsExec::Exec "net start openerp-service"