~jfb-tempo-consulting/unifield-web/US-10064

« back to all changes in this revision

Viewing changes to win32/setup.nsi

  • Committer: ame (Tiny/Axelor)
  • Date: 2009-01-07 05:36:41 UTC
  • Revision ID: ame@tinyerp.com-20090107053641-9hanwak1pgz7etow
* Windows Installer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##############################################################################
 
2
#
 
3
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
 
4
#
 
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
 
10
# Service Company
 
11
#
 
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.
 
16
#
 
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.
 
21
#
 
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
###############################################################################
 
26
!ifndef VERSION
 
27
    !error "Do not forget to specify the version of OpenERP - /DVERSION=<VERSION>"
 
28
!endif 
 
29
 
 
30
!include "MUI.nsh"
 
31
 
 
32
;--------------------------------
 
33
;General
 
34
 
 
35
;Name and file
 
36
Name "OpenERP Web Client"
 
37
OutFile "openerp-web-setup-${VERSION}.exe"
 
38
SetCompressor lzma
 
39
SetCompress auto
 
40
 
 
41
;Default installation folder
 
42
InstallDir "$PROGRAMFILES\OpenERP Web"
 
43
 
 
44
;Get installation folder from registry if available
 
45
InstallDirRegKey HKLM "Software\OpenERP Web" ""
 
46
 
 
47
BrandingText "OpenERP Web ${VERSION}"
 
48
 
 
49
;Vista redirects $SMPROGRAMS to all users without this
 
50
RequestExecutionLevel admin
 
51
 
 
52
;--------------------------------
 
53
;Variables
 
54
 
 
55
Var MUI_TEMP
 
56
Var STARTMENU_FOLDER
 
57
 
 
58
;--------------------------------
 
59
;Interface Settings
 
60
 
 
61
!define MUI_ABORTWARNING
 
62
 
 
63
!define REGKEY "SOFTWARE\$(^Name)"
 
64
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
 
65
!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
 
66
!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
 
67
 
 
68
!insertmacro MUI_RESERVEFILE_LANGDLL
 
69
;--------------------------------
 
70
;Pages
 
71
 
 
72
!define MUI_ICON ".\pixmaps\openerp-icon.ico"
 
73
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
 
74
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
 
75
!define MUI_HEADERIMAGE
 
76
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
 
77
!define MUI_HEADER_TRANSPARENT_TEXT ""
 
78
!define MUI_HEADERIMAGE_BITMAP ".\pixmaps\openerp-slogan.bmp"
 
79
!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LicenseText)"
 
80
!define MUI_LICENSEPAGE_BUTTON "$(LicenseNext)"
 
81
 
 
82
!insertmacro MUI_PAGE_WELCOME
 
83
!insertmacro MUI_PAGE_LICENSE "..\doc\LICENSE.TXT"
 
84
!insertmacro MUI_PAGE_DIRECTORY
 
85
 
 
86
;Start Menu Folder Page Configuration
 
87
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" 
 
88
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenERP Web"
 
89
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "OpenERP Web"
 
90
 
 
91
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
 
92
 
 
93
!insertmacro MUI_PAGE_INSTFILES
 
94
 
 
95
!define MUI_FINISHPAGE_NOAUTOCLOSE
 
96
!define MUI_FINISHPAGE_RUN
 
97
!define MUI_FINISHPAGE_RUN_CHECKED
 
98
!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageText)" 
 
99
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
 
100
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
 
101
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.txt
 
102
!insertmacro MUI_PAGE_FINISH
 
103
 
 
104
 
 
105
!insertmacro MUI_UNPAGE_WELCOME
 
106
!insertmacro MUI_UNPAGE_CONFIRM
 
107
!insertmacro MUI_UNPAGE_INSTFILES
 
108
 
 
109
;--------------------------------
 
110
;Languages
 
111
 
 
112
!insertmacro MUI_LANGUAGE "English"
 
113
!insertmacro MUI_LANGUAGE "French"
 
114
 
 
115
!macro CreateInternetShortcut FILENAME URL
 
116
        WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
 
117
!macroend
 
118
 
 
119
;--------------------------------
 
120
;Installer Sections
 
121
Function .onInit 
 
122
!ifndef ALLINONE
 
123
    ;Language selection dialog
 
124
    Push ""
 
125
    Push ${LANG_ENGLISH}
 
126
    Push English
 
127
    Push ${LANG_FRENCH}
 
128
    Push French
 
129
    Push A ; A means auto count languages
 
130
    ; for the auto count to work the first empty push (Push "") must remain
 
131
    LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
 
132
 
 
133
    Pop $LANGUAGE
 
134
    StrCmp $LANGUAGE "cancel" 0 +2
 
135
        Abort
 
136
!endif
 
137
 
 
138
    ClearErrors
 
139
    ReadRegStr $0 HKLM "Software\OpenERP Web" ""
 
140
    IfErrors DoInstall 0
 
141
        MessageBox MB_OK "$(CannotInstallWebText)"
 
142
        Quit
 
143
    DoInstall:
 
144
FunctionEnd
 
145
 
 
146
Section "OpenERP Web" SecOpenERPWeb
 
147
    nsExec::Exec "net stop openerp-web"
 
148
    sleep 2
 
149
 
 
150
    SetOutPath "$INSTDIR\python24"
 
151
 
 
152
    ;ADD YOUR OWN FILES HERE...
 
153
    File /r /x "*.pyc" /x "*.pyo" /x "*.msi" /x "*~" "build\python24\*"
 
154
 
 
155
    SetOutPath "$INSTDIR\bin"
 
156
    File "start.bat"
 
157
    File "stop.bat"
 
158
    File "OpenERPWebService.py"
 
159
 
 
160
    SetOutPath "$INSTDIR\conf"
 
161
    File "/oname=openerp-web.cfg" "..\config\default.cfg"
 
162
 
 
163
    ;Store installation folder
 
164
    WriteRegStr HKLM "Software\OpenERP Web" "" $INSTDIR
 
165
 
 
166
!ifndef ALLINONE
 
167
    ;Create uninstaller
 
168
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Web" "DisplayName" "OpenERP Web ${VERSION}"
 
169
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Web" "UninstallString" "$INSTDIR\Uninstall.exe"
 
170
!else
 
171
    WriteRegStr HKLM  "Software\OpenERP AllInOne" "UninstallWeb" "$INSTDIR\Uninstall.exe"
 
172
!endif
 
173
    WriteUninstaller "$INSTDIR\Uninstall.exe"
 
174
 
 
175
    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
 
176
        ;Create shortcuts
 
177
        CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
 
178
        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start Web Client.lnk" "$INSTDIR\bin\start.bat"
 
179
        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Stop Web Client.lnk" "$INSTDIR\bin\stop.bat"
 
180
        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Edit Web Config.lnk" "notepad.exe" "$INSTDIR\conf\openerp-web.cfg"
 
181
!ifndef ALLINONE
 
182
        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe"
 
183
!endif
 
184
        !insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Forum" "http://www.openerp.com/forum"
 
185
        !insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Translation" "https://translations.launchpad.net/openobject"
 
186
    !insertmacro MUI_STARTMENU_WRITE_END
 
187
 
 
188
    nsExec::Exec '"$INSTDIR\python24\python.exe" "$INSTDIR\python24\Scripts\fixps.py"'
 
189
    nsExec::Exec '"$INSTDIR\python24\python.exe" "$INSTDIR\bin\OpenERPWebService.py" install'
 
190
 
 
191
SectionEnd
 
192
 
 
193
;Descriptions
 
194
 
 
195
 
 
196
;--------------------------------
 
197
;Uninstaller Section
 
198
 
 
199
Section "Uninstall"
 
200
    nsExec::Exec "net stop openerp-web"
 
201
    sleep 2
 
202
    nsExec::Exec '"$INSTDIR\python24\python.exe" "$INSTDIR\bin\OpenERPWebService.py" remove'
 
203
    sleep 2
 
204
 
 
205
    RMDIR /r "$INSTDIR" 
 
206
    !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
 
207
 
 
208
    Delete "$SMPROGRAMS\$MUI_TEMP\Forum.url"
 
209
    Delete "$SMPROGRAMS\$MUI_TEMP\Translation.url"
 
210
!ifndef ALLINONE
 
211
    Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
 
212
!endif 
 
213
    Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
 
214
    Delete "$SMPROGRAMS\$MUI_TEMP\Start Web Client.lnk"
 
215
    Delete "$SMPROGRAMS\$MUI_TEMP\Stop Web Client.lnk"
 
216
    Delete "$SMPROGRAMS\$MUI_TEMP\Edit Web Config.lnk"
 
217
 
 
218
    ;Delete empty start menu parent diretories
 
219
    StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
 
220
 
 
221
    startMenuDeleteLoop:
 
222
        ClearErrors
 
223
        RMDir $MUI_TEMP
 
224
        GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
 
225
 
 
226
        IfErrors startMenuDeleteLoopDone
 
227
 
 
228
        StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
 
229
 
 
230
    startMenuDeleteLoopDone:
 
231
 
 
232
!ifndef ALLINONE
 
233
        DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Web"
 
234
!else 
 
235
        DeleteRegKey HKLM "Software\OpenERP AllInOne\UninstallWeb"
 
236
!endif
 
237
        DeleteRegKey /ifempty HKLM "Software\OpenERP Web"
 
238
 
 
239
SectionEnd
 
240
 
 
241
Function LaunchLink
 
242
    nsExec::Exec "net start openerp-web"
 
243
FunctionEnd
 
244
 
 
245
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."
 
246
LangString LicenseText ${LANG_FRENCH} "Normalement, une licence propri�taire est fournie avec le logiciel: limitation du nombre d'utilisateurs, limitation dans le temps, etc. Cette licence Open Source est l'oppos�: Elle vous garantie le droit d'utiliser, de copier, d'�tudier, de distribuer et de modifier Open ERP librement."
 
247
 
 
248
LangString LicenseNext ${LANG_ENGLISH} "Next >"
 
249
LangString LicenseNext ${LANG_FRENCH} "Suivant >"
 
250
 
 
251
LangString FinishPageText ${LANG_ENGLISH} "Start OpenERP Web Client"
 
252
LangString FinishPageText ${LANG_FRENCH} "Lancer le serveur OpenERP"
 
253
 
 
254
;Language strings
 
255
LangString DESC_SecOpenERPWeb ${LANG_ENGLISH} "OpenERP Web Client."
 
256
LangString DESC_SecOpenERPWeb ${LANG_FRENCH} "Serveur OpenERP."
 
257
 
 
258
LangString CannotInstallWebText ${LANG_ENGLISH} "Can not install the OpenERP Web Client because a previous installation already exists on this system. Please uninstall your current installation and relaunch this setup wizard."
 
259
LangString CannotInstallWebText ${LANG_FRENCH} "Ne peut pas installer le serveur Open ERP parce qu'une installation existe d�j� sur ce syst�me. S'il vous plait, d�sinstallez votre installation actuelle et relancer l'installeur."
 
260
 
 
261
 
 
262
;Assign language strings to sections
 
263
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 
264
    !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenERPWeb} $(DESC_SecOpenERPWeb)
 
265
!insertmacro MUI_FUNCTION_DESCRIPTION_END