Administrator@266: ; NSIS script to build Windows installer of MXD2map Administrator@266: ; Administrator@266: ; Copyright (c) 2011 by Intevation GmbH, Germany Administrator@266: ; Administrator@266: ; This file is part of MXD2map. Administrator@266: ; Administrator@266: ; This program is free software under the LGPL (>=v2.1) Administrator@266: ; Read the file LICENCE.txt coming with the software for details Administrator@266: ; or visit http://www.gnu.org/licenses/ if it does not exist. Administrator@266: ; Administrator@266: ; MXD2map has been developed on behalf of the Administrator@266: ; Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg Administrator@266: ; by Intevation GmbH. Administrator@266: ; Administrator@266: ; Authors: Administrator@266: ; Raimund Renkert Administrator@266: ; Bjoern Schilberg Administrator@266: ; Stephan Holl Administrator@266: ; Administrator@266: Administrator@266: Administrator@266: ; Product defines ------------ Administrator@266: !define PRODUCT_NAME "MXD2map" stephan@277: !define PRODUCT_VERSION "1.0" Administrator@266: !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\mxd2map" Administrator@266: !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" Administrator@266: !define PRODUCT_UNINST_ROOT_KEY "HKLM" Administrator@266: !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; MUI 2 compatible ---------- Administrator@266: !include "MUI2.nsh" Administrator@266: !include "Sections.nsh" Administrator@266: !include "InstallOptions.nsh" Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; MUI Settings -------------- Administrator@266: !define MUI_ABORTWARNING Administrator@266: !define MUI_ICON "favicon.ico" Administrator@266: !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" Administrator@266: !define MUI_HEADERIMAGE Administrator@266: !define MUI_HEADERIMAGE_BITMAP "logo_wide.bmp" Administrator@266: !define MUI_WELCOMEPAGE_TITLE_3LINES Administrator@266: !define MUI_FINISHPAGE_TITLE_3LINES Administrator@266: !define MUI_FINISHPAGE_TEXT $(TXT_FIN) Administrator@266: Administrator@266: ; Language selection dialog settings Administrator@266: !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" Administrator@266: !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" Administrator@266: !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language" Administrator@266: Administrator@266: ; Check for Admin Administrator@266: !define MUI_PAGE_CUSTOMFUNCTION_SHOW PrintNonAdminWarning Administrator@266: Administrator@266: ; Welcome page Administrator@266: !insertmacro MUI_PAGE_WELCOME Administrator@266: Administrator@266: ; License page Administrator@266: !insertmacro MUI_PAGE_LICENSE "LICENCE.txt" Administrator@266: Administrator@266: ; Components page Administrator@266: !define MUI_COMPONENTSPAGE_SMALLDESC Administrator@266: !insertmacro MUI_PAGE_COMPONENTS Administrator@266: Administrator@266: ; Directory page Administrator@266: !insertmacro MUI_PAGE_DIRECTORY Administrator@266: Administrator@266: ; Start menu page Administrator@266: var ICONS_GROUP Administrator@266: !define MUI_STARTMENUPAGE_NODISABLE Administrator@266: !define MUI_STARTMENUPAGE_DEFAULTFOLDER "MXD2map" Administrator@266: !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" Administrator@266: !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" Administrator@266: !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}" Administrator@266: !insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP Administrator@266: Administrator@266: ; Instfiles page Administrator@266: !insertmacro MUI_PAGE_INSTFILES Administrator@266: Administrator@266: ; Uninstaller pages Administrator@266: !define MUI_PAGE_CUSTOMFUNCTION_SHOW un.PrintNonAdminWarning Administrator@266: !insertmacro MUI_UNPAGE_INSTFILES Administrator@266: Administrator@266: ; Language files Administrator@266: !insertmacro MUI_LANGUAGE "English" Administrator@266: !insertmacro MUI_LANGUAGE "German" Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; Language strings ---------- Administrator@266: LangString DESC_SEC_MXD2MAP ${LANG_ENGLISH} \ Administrator@266: "MXD2map is a converter for ArcGIS MXD-files into UMN MapServer Mapfiles." Administrator@266: LangString DESC_SEC_MXD2MAP ${LANG_GERMAN} \ Administrator@266: "MXD2map wird zur Erzeugung von UMN MapServer- Konfigurationsdateien aus ArcGIS MXD-Dateien verwendet." Administrator@266: LangString DESC_SEC_EXAMPLES ${LANG_ENGLISH} \ Administrator@266: "The examples show how to use and configure MXD2map." Administrator@266: LangString DESC_SEC_EXAMPLES ${LANG_GERMAN} \ Administrator@266: "Die Beispiele zeigen, wie MXD2map benutzt und konfiguriert werden kann." Administrator@266: LangString UN_PRE ${LANG_ENGLISH} \ Administrator@266: "Do you want to remove $(^Name) and all of its components?" Administrator@266: LangString UN_PRE ${LANG_GERMAN} \ Administrator@266: "Möchten Sie $(^Name) mit allen Komponenten deinstallieren?" Administrator@266: LangString UN_POST ${LANG_ENGLISH} "Uninstall of $(^Name) successful." Administrator@266: LangString UN_POST ${LANG_GERMAN} "Deinstallation von $(^Name) erfolgreich." Administrator@266: LangString MISSING_ARCGIS ${LANG_ENGLISH} \ Administrator@266: "ArcGIS is not installed. Please install an ArcGIS Environment first." Administrator@266: LangString MISSING_ARCGIS ${LANG_GERMAN} \ Administrator@266: "ArcGIS ist nicht installiert. Bitte installieren Sie eine ArcGIS Umgebung." Administrator@266: LangString TXT_DOC ${LANG_ENGLISH} "Documentation" Administrator@266: LangString TXT_DOC ${LANG_GERMAN} "Dokumentation" Administrator@266: LangString TXT_ADMIN ${LANG_ENGLISH} \ Administrator@266: "Warning: Administrator permissions required for the installation of ${PRODUCT_NAME}." Administrator@266: LangString TXT_ADMIN ${LANG_GERMAN} \ Administrator@266: "Achtung: Für die Installation von ${PRODUCT_NAME} werden Administratorrechte benötigt." Administrator@266: LangString TXT_ADMIN_UN ${LANG_ENGLISH} \ Administrator@266: "Warning: Administrator permissions required for the uninstallation of ${PRODUCT_NAME}." Administrator@266: LangString TXT_ADMIN_UN ${LANG_GERMAN} \ Administrator@266: "Achtung: Für die Deinstallation von ${PRODUCT_NAME} werden Administratorrechte benötigt." Administrator@266: Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; Install settings ---------- Administrator@266: Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" Administrator@266: OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}.exe" Administrator@266: InstallDir "$PROGRAMFILES\${PRODUCT_NAME}" Administrator@266: InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" Administrator@266: ShowInstDetails show Administrator@266: ShowUnInstDetails show Administrator@266: RequestExecutionLevel admin Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; MXD2map ------------------- Administrator@266: Section "MXD2map" SEC01 Administrator@266: SectionIn RO Administrator@266: SetOutPath "$INSTDIR" Administrator@266: SetShellVarContext all Administrator@266: SetOverwrite ifnewer Administrator@266: File "LICENCE.txt" Administrator@266: File /r "bin\*.*" Administrator@266: File "favicon.ico" Administrator@266: Administrator@266: ReadEnvStr $R0 "HOMEDRIVE" Administrator@266: ReadEnvStr $R1 "HOMEPATH" Administrator@266: CreateDirectory "$R0$R1\MXD2map" Administrator@266: CreateDirectory "$R0$R1\MXD2map\logs" Administrator@266: Administrator@266: !insertmacro MUI_STARTMENU_WRITE_BEGIN Application Administrator@266: CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" Administrator@266: CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\MXD2map Shell.lnk" \ Administrator@266: "$INSTDIR\MXD2map-Shell.bat" "" "$INSTDIR\favicon.ico" Administrator@266: CreateShortCut "$DESKTOP\MXD2map Shell.lnk" \ Administrator@266: "$INSTDIR\MXD2map-Shell.bat" "" "$INSTDIR\favicon.ico" Administrator@266: CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\$(TXT_DOC).lnk"\ Administrator@266: "http://mxd2map.org/documentation/index.html" "" "$INSTDIR\favicon.ico" 0 Administrator@266: !insertmacro MUI_STARTMENU_WRITE_END Administrator@266: SectionEnd Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; Examples ------------------ Administrator@266: Section "Examples" SEC02 Administrator@266: SetOverwrite ifnewer Administrator@266: SetShellVarContext all Administrator@266: File /r "example\*.*" Administrator@266: Administrator@266: ReadEnvStr $R0 "HOMEDRIVE" Administrator@266: ReadEnvStr $R1 "HOMEPATH" Administrator@266: CreateDirectory "$R0$R1\MXD2map\example" Administrator@266: Administrator@266: !insertmacro MUI_STARTMENU_WRITE_BEGIN Application Administrator@266: CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" Administrator@266: CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Run Example.lnk" \ Administrator@266: "$INSTDIR\RunExample.bat" Administrator@266: !insertmacro MUI_STARTMENU_WRITE_END Administrator@266: SectionEnd Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; Section descriptions ------ Administrator@266: !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN Administrator@266: !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_SEC_MXD2MAP) Administrator@266: !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(DESC_SEC_EXAMPLES) Administrator@266: !insertmacro MUI_FUNCTION_DESCRIPTION_END Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; Icons --------------------- Administrator@266: Section -AdditionalIcons Administrator@266: !insertmacro MUI_STARTMENU_WRITE_BEGIN Application Administrator@266: CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe" Administrator@266: !insertmacro MUI_STARTMENU_WRITE_END Administrator@266: SectionEnd Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; Post install -------------- Administrator@266: Section -Post Administrator@266: WriteUninstaller "$INSTDIR\uninst.exe" Administrator@266: WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\" Administrator@266: WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" Administrator@266: WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" Administrator@266: WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\" Administrator@266: WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" Administrator@266: SectionEnd Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; Uninstall ----------------- Administrator@266: Section Uninstall Administrator@266: SetShellVarContext all Administrator@266: !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP Administrator@266: RMDir /r "$SMPROGRAMS\$ICONS_GROUP" Administrator@266: RMDir /r "$INSTDIR" Administrator@266: Administrator@266: Delete "$DESKTOP\MXD2map Shell.lnk" Administrator@266: Administrator@266: DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" Administrator@266: DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" Administrator@266: SetAutoClose true Administrator@266: SectionEnd Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; On startup ---------------- Administrator@266: Function .onInit Administrator@266: ; Check to see if ArcGIS installed Administrator@266: ReadRegStr $R0 HKLM "SOFTWARE\ESRI\ArcGIS\" "InstallDir" Administrator@266: StrCmp $R0 "" +2 Administrator@266: IfFileExists "$R0*.*" Installed +1 Administrator@266: messagebox MB_DEFBUTTON1|MB_OK $(MISSING_ARCGIS) Administrator@266: Quit Administrator@266: Installed: Administrator@266: ; Continue installing the MXD2map converter. Administrator@266: FunctionEnd Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; On uninstaller startup ---- Administrator@266: Function un.onInit Administrator@266: ; Ask for removal. Administrator@266: !insertmacro MUI_UNGETLANGUAGE Administrator@266: MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UN_PRE) IDYES +2 Administrator@266: Abort Administrator@266: FunctionEnd Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Administrator@266: ; On uninstaller succuss ---- Administrator@266: Function un.onUninstSuccess Administrator@266: ; Close window and show success dialog Administrator@266: HideWindow Administrator@266: MessageBox MB_ICONINFORMATION|MB_OK $(UN_POST) Administrator@266: FunctionEnd Administrator@266: ; --------------------------- Administrator@266: Administrator@266: Function PrintNonAdminWarning Administrator@266: ClearErrors Administrator@266: UserInfo::GetName Administrator@266: IfErrors leave Administrator@266: POP $0 Administrator@266: UserInfo::GetAccountType Administrator@266: POP $1 Administrator@266: StrCmp $1 "Admin" leave +1 Administrator@266: MessageBox MB_OK|MB_ICONEXCLAMATION "$(TXT_ADMIN)" Administrator@266: Quit Administrator@266: Administrator@266: leave: Administrator@266: FunctionEnd Administrator@266: Administrator@266: Function un.PrintNonAdminWarning Administrator@266: ClearErrors Administrator@266: UserInfo::GetName Administrator@266: IfErrors leave Administrator@266: POP $0 Administrator@266: UserInfo::GetAccountType Administrator@266: POP $1 Administrator@266: StrCmp $1 "Admin" leave +1 Administrator@266: MessageBox MB_OK|MB_ICONEXCLAMATION "$(TXT_ADMIN_UN)" Administrator@266: Quit Administrator@266: Administrator@266: leave: Administrator@266: FunctionEnd