comparison contrib/installer/MXD2map-installer.nsi @ 266:713ea6f42e55

Added missing files and removed libraries.
author Administrator@vbox-server2003.hq.intevation.de
date Thu, 08 Sep 2011 15:54:34 +0200
parents
children b2df9936d4f8
comparison
equal deleted inserted replaced
264:42c89821a868 266:713ea6f42e55
1 ; NSIS script to build Windows installer of MXD2map
2 ;
3 ; Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
4 ;
5 ; This file is part of MXD2map.
6 ;
7 ; This program is free software under the LGPL (>=v2.1)
8 ; Read the file LICENCE.txt coming with the software for details
9 ; or visit http://www.gnu.org/licenses/ if it does not exist.
10 ;
11 ; MXD2map has been developed on behalf of the
12 ; Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
13 ; by Intevation GmbH.
14 ;
15 ; Authors:
16 ; Raimund Renkert <raimund.renkert@intevation.de>
17 ; Bjoern Schilberg <bjoern.schilberg@intevation.de>
18 ; Stephan Holl <stephan.holl@intevation.de>
19 ;
20
21
22 ; Product defines ------------
23 !define PRODUCT_NAME "MXD2map"
24 !define PRODUCT_VERSION "0.9"
25 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\mxd2map"
26 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
27 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
28 !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
29 ; ---------------------------
30
31
32 ; MUI 2 compatible ----------
33 !include "MUI2.nsh"
34 !include "Sections.nsh"
35 !include "InstallOptions.nsh"
36 ; ---------------------------
37
38
39 ; MUI Settings --------------
40 !define MUI_ABORTWARNING
41 !define MUI_ICON "favicon.ico"
42 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
43 !define MUI_HEADERIMAGE
44 !define MUI_HEADERIMAGE_BITMAP "logo_wide.bmp"
45 !define MUI_WELCOMEPAGE_TITLE_3LINES
46 !define MUI_FINISHPAGE_TITLE_3LINES
47 !define MUI_FINISHPAGE_TEXT $(TXT_FIN)
48
49 ; Language selection dialog settings
50 !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
51 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
52 !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
53
54 ; Check for Admin
55 !define MUI_PAGE_CUSTOMFUNCTION_SHOW PrintNonAdminWarning
56
57 ; Welcome page
58 !insertmacro MUI_PAGE_WELCOME
59
60 ; License page
61 !insertmacro MUI_PAGE_LICENSE "LICENCE.txt"
62
63 ; Components page
64 !define MUI_COMPONENTSPAGE_SMALLDESC
65 !insertmacro MUI_PAGE_COMPONENTS
66
67 ; Directory page
68 !insertmacro MUI_PAGE_DIRECTORY
69
70 ; Start menu page
71 var ICONS_GROUP
72 !define MUI_STARTMENUPAGE_NODISABLE
73 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "MXD2map"
74 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
75 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
76 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
77 !insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
78
79 ; Instfiles page
80 !insertmacro MUI_PAGE_INSTFILES
81
82 ; Uninstaller pages
83 !define MUI_PAGE_CUSTOMFUNCTION_SHOW un.PrintNonAdminWarning
84 !insertmacro MUI_UNPAGE_INSTFILES
85
86 ; Language files
87 !insertmacro MUI_LANGUAGE "English"
88 !insertmacro MUI_LANGUAGE "German"
89 ; ---------------------------
90
91
92 ; Language strings ----------
93 LangString DESC_SEC_MXD2MAP ${LANG_ENGLISH} \
94 "MXD2map is a converter for ArcGIS MXD-files into UMN MapServer Mapfiles."
95 LangString DESC_SEC_MXD2MAP ${LANG_GERMAN} \
96 "MXD2map wird zur Erzeugung von UMN MapServer- Konfigurationsdateien aus ArcGIS MXD-Dateien verwendet."
97 LangString DESC_SEC_EXAMPLES ${LANG_ENGLISH} \
98 "The examples show how to use and configure MXD2map."
99 LangString DESC_SEC_EXAMPLES ${LANG_GERMAN} \
100 "Die Beispiele zeigen, wie MXD2map benutzt und konfiguriert werden kann."
101 LangString UN_PRE ${LANG_ENGLISH} \
102 "Do you want to remove $(^Name) and all of its components?"
103 LangString UN_PRE ${LANG_GERMAN} \
104 "Möchten Sie $(^Name) mit allen Komponenten deinstallieren?"
105 LangString UN_POST ${LANG_ENGLISH} "Uninstall of $(^Name) successful."
106 LangString UN_POST ${LANG_GERMAN} "Deinstallation von $(^Name) erfolgreich."
107 LangString MISSING_ARCGIS ${LANG_ENGLISH} \
108 "ArcGIS is not installed. Please install an ArcGIS Environment first."
109 LangString MISSING_ARCGIS ${LANG_GERMAN} \
110 "ArcGIS ist nicht installiert. Bitte installieren Sie eine ArcGIS Umgebung."
111 LangString TXT_DOC ${LANG_ENGLISH} "Documentation"
112 LangString TXT_DOC ${LANG_GERMAN} "Dokumentation"
113 LangString TXT_ADMIN ${LANG_ENGLISH} \
114 "Warning: Administrator permissions required for the installation of ${PRODUCT_NAME}."
115 LangString TXT_ADMIN ${LANG_GERMAN} \
116 "Achtung: Für die Installation von ${PRODUCT_NAME} werden Administratorrechte benötigt."
117 LangString TXT_ADMIN_UN ${LANG_ENGLISH} \
118 "Warning: Administrator permissions required for the uninstallation of ${PRODUCT_NAME}."
119 LangString TXT_ADMIN_UN ${LANG_GERMAN} \
120 "Achtung: Für die Deinstallation von ${PRODUCT_NAME} werden Administratorrechte benötigt."
121
122 ; ---------------------------
123
124
125 ; Install settings ----------
126 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
127 OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}.exe"
128 InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
129 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
130 ShowInstDetails show
131 ShowUnInstDetails show
132 RequestExecutionLevel admin
133 ; ---------------------------
134
135
136 ; MXD2map -------------------
137 Section "MXD2map" SEC01
138 SectionIn RO
139 SetOutPath "$INSTDIR"
140 SetShellVarContext all
141 SetOverwrite ifnewer
142 File "LICENCE.txt"
143 File /r "bin\*.*"
144 File "favicon.ico"
145
146 ReadEnvStr $R0 "HOMEDRIVE"
147 ReadEnvStr $R1 "HOMEPATH"
148 CreateDirectory "$R0$R1\MXD2map"
149 CreateDirectory "$R0$R1\MXD2map\logs"
150
151 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
152 CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
153 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\MXD2map Shell.lnk" \
154 "$INSTDIR\MXD2map-Shell.bat" "" "$INSTDIR\favicon.ico"
155 CreateShortCut "$DESKTOP\MXD2map Shell.lnk" \
156 "$INSTDIR\MXD2map-Shell.bat" "" "$INSTDIR\favicon.ico"
157 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\$(TXT_DOC).lnk"\
158 "http://mxd2map.org/documentation/index.html" "" "$INSTDIR\favicon.ico" 0
159 !insertmacro MUI_STARTMENU_WRITE_END
160 SectionEnd
161 ; ---------------------------
162
163
164 ; Examples ------------------
165 Section "Examples" SEC02
166 SetOverwrite ifnewer
167 SetShellVarContext all
168 File /r "example\*.*"
169
170 ReadEnvStr $R0 "HOMEDRIVE"
171 ReadEnvStr $R1 "HOMEPATH"
172 CreateDirectory "$R0$R1\MXD2map\example"
173
174 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
175 CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
176 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Run Example.lnk" \
177 "$INSTDIR\RunExample.bat"
178 !insertmacro MUI_STARTMENU_WRITE_END
179 SectionEnd
180 ; ---------------------------
181
182
183 ; Section descriptions ------
184 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
185 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_SEC_MXD2MAP)
186 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(DESC_SEC_EXAMPLES)
187 !insertmacro MUI_FUNCTION_DESCRIPTION_END
188 ; ---------------------------
189
190
191 ; Icons ---------------------
192 Section -AdditionalIcons
193 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
194 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
195 !insertmacro MUI_STARTMENU_WRITE_END
196 SectionEnd
197 ; ---------------------------
198
199
200 ; Post install --------------
201 Section -Post
202 WriteUninstaller "$INSTDIR\uninst.exe"
203 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\"
204 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
205 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
206 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\"
207 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
208 SectionEnd
209 ; ---------------------------
210
211
212 ; Uninstall -----------------
213 Section Uninstall
214 SetShellVarContext all
215 !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
216 RMDir /r "$SMPROGRAMS\$ICONS_GROUP"
217 RMDir /r "$INSTDIR"
218
219 Delete "$DESKTOP\MXD2map Shell.lnk"
220
221 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
222 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
223 SetAutoClose true
224 SectionEnd
225 ; ---------------------------
226
227
228 ; On startup ----------------
229 Function .onInit
230 ; Check to see if ArcGIS installed
231 ReadRegStr $R0 HKLM "SOFTWARE\ESRI\ArcGIS\" "InstallDir"
232 StrCmp $R0 "" +2
233 IfFileExists "$R0*.*" Installed +1
234 messagebox MB_DEFBUTTON1|MB_OK $(MISSING_ARCGIS)
235 Quit
236 Installed:
237 ; Continue installing the MXD2map converter.
238 FunctionEnd
239 ; ---------------------------
240
241
242 ; On uninstaller startup ----
243 Function un.onInit
244 ; Ask for removal.
245 !insertmacro MUI_UNGETLANGUAGE
246 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UN_PRE) IDYES +2
247 Abort
248 FunctionEnd
249 ; ---------------------------
250
251
252 ; On uninstaller succuss ----
253 Function un.onUninstSuccess
254 ; Close window and show success dialog
255 HideWindow
256 MessageBox MB_ICONINFORMATION|MB_OK $(UN_POST)
257 FunctionEnd
258 ; ---------------------------
259
260 Function PrintNonAdminWarning
261 ClearErrors
262 UserInfo::GetName
263 IfErrors leave
264 POP $0
265 UserInfo::GetAccountType
266 POP $1
267 StrCmp $1 "Admin" leave +1
268 MessageBox MB_OK|MB_ICONEXCLAMATION "$(TXT_ADMIN)"
269 Quit
270
271 leave:
272 FunctionEnd
273
274 Function un.PrintNonAdminWarning
275 ClearErrors
276 UserInfo::GetName
277 IfErrors leave
278 POP $0
279 UserInfo::GetAccountType
280 POP $1
281 StrCmp $1 "Admin" leave +1
282 MessageBox MB_OK|MB_ICONEXCLAMATION "$(TXT_ADMIN_UN)"
283 Quit
284
285 leave:
286 FunctionEnd
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)