;Copyright (C) 2008-2010 ;Authors: ;Emanuel Schütze ;Bjoern Schilberg ;-------------------------------- ;Include Modern UI !include "MUI.nsh" ;-------------------------------- ;Version Information (for installer file properties) !define PRODUCT_NAME "InteProxy Desktop" !define PRODUCT_NAME_SHORT "InteProxy" !define COMPANY "Intevation GmbH" !define COPYRIGHT "Copyright (C) 2008 - 2010 Intevation GmbH" !define DESCRIPTION "Security extension for unsecure OWS clients" VIProductVersion "${PRODUCTVERSION}" ;needs format: x.x.x.x VIAddVersionKey "ProductName" "${PRODUCT_NAME_SHORT}" VIAddVersionKey "CompanyName" "${COMPANY}" VIAddVersionKey "LegalTrademarks" "" VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" VIAddVersionKey "FileDescription" "${DESCRIPTION}" VIAddVersionKey "FileVersion" "${VERSION_NUMBER} (build ${VERSION_DATE})" VIAddVersionKey "Comments" \ "${PRODUCT_NAME_SHORT} is Free Software; you can redistribute it \ and/or modify it under the terms of the GNU General Public License. \ You should have received a copy of the GNU General Public License \ along with this software; if not, write to the Free Software \ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, \ MA 02110-1301, USA" ;-------------------------------- ;General ; Define Name, File and Installdir of Installer Name "${PRODUCT_NAME_SHORT}" OutFile "${PRODUCT_NAME_SHORT}-${VERSION_NUMBER}.exe" InstallDir "$DOCUMENTS\${PRODUCT_NAME_SHORT}" ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\${PRODUCT_NAME_SHORT}" "" ; Define src dir !define DIST_DIR "dist-${VERSION_NUMBER}" ; Add (custom) plugin dir !addPluginDir "plugins" ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "InteProxy-logo.bmp" ;no string "Nullsoft Install System vX.XX" in installer gui BrandingText " " ;Language Selection Dialog Settings to remember the installer language !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" !define MUI_LANGDLL_REGISTRY_KEY "Software\${PRODUCT_NAME_SHORT}" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" ;-------------------------------- ;Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "license.txt" !insertmacro MUI_PAGE_DIRECTORY Page custom CustomPageOptions !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ;-------------------------------- ; Supported Languages !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "German" ;------------------------------- ;Reserve Files !insertmacro MUI_RESERVEFILE_LANGDLL !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ReserveFile "installer-options.ini" ;-------------------------------- ;Install Sections Section "" SetOutPath "$INSTDIR" ;Store installation folder WriteRegStr HKCU "Software\${PRODUCT_NAME_SHORT}" "" $INSTDIR ; Include the license file File "license.txt" ; Include the input files !include "inputfiles.nsh" ; Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" ; Create Registry keys WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}" "DisplayName" "${PRODUCT_NAME_SHORT} ${VERSION_NUMBER}" WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}" "DisplayVersionNumber" "${VERSION_NUMBER}" WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}" "DisplayVersionDate" "${VERSION_DATE}" WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}" "NoModify" 1 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}" "NoRepair" 1 SetOutPath "$INSTDIR" # ** Start menu ** # Delete old Start menu entries. RMDir /R "$SMPROGRAMS\${PRODUCT_NAME_SHORT}" # Check if the start menu entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 2" "State" IntCmp $R0 0 no_start_menu # Create new Start menu entries CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME_SHORT}" CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME_SHORT}\InteProxy.lnk" "$INSTDIR\InteProxy.exe" "--config-file=inteproxy.cfg --rewrite-urls" CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME_SHORT}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME_SHORT}\$(UserManualLinkName)" "$INSTDIR\doc\$(UserManualFileName)" no_start_menu: # ** Desktop Icon ** # Delete old Desktop link Delete "$DESKTOP\InteProxy.lnk" # Check if the desktop entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 3" "State" IntCmp $R0 0 no_desktop # Create new Desktop link CreateShortCut "$DESKTOP\InteProxy.lnk" "$INSTDIR\InteProxy.exe" "--config-file=inteproxy.cfg --rewrite-urls" no_desktop: # ** Quick Launch ** # Delete old Quick Launch Bar link Delete "$QUICKLAUNCH\InteProxy.lnk" # Check if the quick launch bar entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 4" "State" IntCmp $R0 0 no_quick_launch StrCmp $QUICKLAUNCH $TEMP no_quick_launch # Create new Quick Launch Bar link CreateShortCut "$QUICKLAUNCH\InteProxy.lnk" "$INSTDIR\InteProxy.exe" "--config-file=inteproxy.cfg --rewrite-urls" no_quick_launch: SectionEnd ;-------------------------------- ;Install Functions Function ".onInit" !insertmacro MUI_LANGDLL_DISPLAY !insertmacro MUI_INSTALLOPTIONS_EXTRACT "installer-options.ini" call CheckExistingVersion FunctionEnd ; Check whether application has already been installed. Function CheckExistingVersion ClearErrors Push $0 ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}" "DisplayVersionNumber" IfErrors leave 0 MessageBox MB_YESNO|MB_ICONEXCLAMATION "${PRODUCT_NAME_SHORT} $0 \ $(T_AlreadyInstalled)" IDYES leave Abort leave: FunctionEnd ; Custom Page for add Desktop, Startmenu and Quick Launch links Function CustomPageOptions !insertmacro MUI_HEADER_TEXT "$(T_InstallOptions)" "$(T_InstallOptLinks)" # Note that the default selection is done in the ini file. !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \ "Field 1" "Text" "$(T_InstOptLabelA)" !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \ "Field 2" "Text" "$(T_InstOptFieldA)" !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \ "Field 3" "Text" "$(T_InstOptFieldB)" !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \ "Field 4" "Text" "$(T_InstOptFieldC)" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "installer-options.ini" FunctionEnd ;----------------- ; Language Strings ;----------------- # From Function CheckExistingVersion LangString T_AlreadyInstalled ${LANG_ENGLISH} \ "has already been installed.$\r$\nDo you want to\ overrite it with version ${VERSION_NUMBER}?" LangString T_AlreadyInstalled ${LANG_GERMAN} \ "ist bereits auf ihrem System installiert.$\r$\nWollen Sie die \ Installation fortsetzen und damit Ihre vorhandene Version \ mit der Version ${VERSION_NUMBER} überschreiben?" # From Function CustomPageOptions # English LangString T_InstallOptions ${LANG_ENGLISH} "Install Options" LangString T_InstallOptLinks ${LANG_ENGLISH} "Start links" LangString T_InstOptLabelA ${LANG_ENGLISH} "Please select where Gpg4win shall install links:" LangString T_InstOptFieldA ${LANG_ENGLISH} "Start Menu" LangString T_InstOptFieldB ${LANG_ENGLISH} "Desktop" LangString T_InstOptFieldC ${LANG_ENGLISH} "Quick Launch Bar" #German LangString T_InstallOptions ${LANG_GERMAN} "Installationsoptionen" LangString T_InstallOptLinks ${LANG_GERMAN} "Startlinks" LangString T_InstOptLabelA ${LANG_GERMAN} "Bitte wählen Sie, welche Verknüpfungen angelegt werden sollen:" LangString T_InstOptFieldA ${LANG_GERMAN} "Startmenü" LangString T_InstOptFieldB ${LANG_GERMAN} "Arbeitsfläche" LangString T_InstOptFieldC ${LANG_GERMAN} "Schnellstartleiste" # User Manual Strings LangString UserManualLinkName ${LANG_ENGLISH} "User Manual.lnk" LangString UserManualLinkName ${LANG_GERMAN} "Benutzerhandbuch.lnk" LangString UserManualFileName ${LANG_ENGLISH} "InteProxy-en-${VERSION_NUMBER}.pdf" LangString UserManualFileName ${LANG_GERMAN} "InteProxy-de-${VERSION_NUMBER}.pdf" ;-------------------------------- ;Uninstall Sections Section "un." ; Kill Inteproxy process (if running) ExecDos::exec '"$SYSDIR\cmd.exe" /C "taskkill /T /F /fi "imagename eq inteproxy*""' ; Delete installation dir RMDir /R "$INSTDIR" ; Delete start menu entries RMDir /R "$SMPROGRAMS\${PRODUCT_NAME_SHORT}" ; Delete Desktop Icon Delete "$DESKTOP\InteProxy.lnk" ; Delete Quick Launch Link Delete "$QUICKLAUNCH\InteProxy.lnk" ; Delete registry keys DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}" DeleteRegKey /ifempty HKCU "Software\${PRODUCT_NAME_SHORT}" SectionEnd ;-------------------------------- ;Uninstall Functions Function un.onInit !insertmacro MUI_UNGETLANGUAGE FunctionEnd