view packaging/eduexportconvert.nsi @ 63:4d65e654abf7

Converter: Handle empty percent strings again
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 26 Aug 2016 12:24:32 +0200
parents 797435c1bbeb
children badfc05a8bbf
line wrap: on
line source
; Copyright (C) 2016 by ETH Z�rich
; Software engineering by Intevation GmbH
;
; This file is Free Software under the GNU GPL (v>=2)
; and comes with ABSOLUTELY NO WARRANTY!
; See LICENSE.txt for details.

; This script creates the installer for renameme it needs the
; following definitions to be set when calling makensis:
;
; productname: Name of the Software as it will show up under installed
;               Software
; version_number: The version of the software
; setupname: The name for the result created by this
; productname_short: Used for the default folder name and such
; size: the expectes size of the installation.

;--------------------------------
; Includes

!define MULTIUSER_EXECUTIONLEVEL Highest
!define MULTIUSER_MUI
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "Software\${productname_short}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "InstallMode"
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\${productname_short}"
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "InstallDir"
!define MULTIUSER_INSTALLMODE_INSTDIR "${productname}"

!addincludedir "${plugin_dir}"

!include "MultiUser.nsh"
!include "MUI2.nsh"
!include "FileFunc.nsh"

;--------------------------------
;Version Information (for installer file properties)

;VIProductVersion "${version_number}" ;needs integer format: x.x.x.x
VIProductVersion ${numeric_version}
VIAddVersionKey "ProductName" "${productname_short}"
VIAddVersionKey "Comments" "${productname_short} ist Freie Software"
VIAddVersionKey "CompanyName" "Intevation GmbH"
VIAddVersionKey "LegalTrademarks" ""
VIAddVersionKey "LegalCopyright" "Copyright (C) 2016 by ETH Z�rich"
VIAddVersionKey "FileDescription" "Converter for EduApp export files"
VIAddVersionKey "FileVersion" "${version_number}"

;--------------------------------
; General

; Define Name, File and Installdir of Installer
Name "${productname}"
OutFile "${setupname}"
InstallDir "$PROGRAMFILES\${productname}"
BrandingText "ETH Z�rich - ${productname}"

;--------------------------------
; Interface Settings

; MUI Images / Icons
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "resources\header-install.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "resources\wizard-install.bmp"
!define MUI_ICON "resources\install.ico"

!define MUI_HEADERIMAGE_UNBITMAP "resources\header-uninstall.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "resources\wizard-uninstall.bmp"
!define MUI_UNICON "resources\uninstall.ico"

!insertmacro MUI_RESERVEFILE_LANGDLL
!define MUI_LANGDLL_REGISTRY_ROOT "SHCTX"
!define MUI_LANGDLL_REGISTRY_KEY "Software\${productname_short}" 
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"

;--------------------------------
; Pages

!define MUI_FINISHPAGE_TITLE  "$(T_finish_title)"
!define MUI_FINISHPAGE_TEXT "$(T_finish_text)"

; MUI welcome page text
;!define MUI_WELCOMEPAGE_TITLE  "$(T_title)"
;!define MUI_WELCOMEPAGE_TITLE_3LINES
;!define MUI_WELCOMEPAGE_TEXT "$(T_description) $\r$\n$\r$\n$\r$\n$\r$\n"

;!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_INSTFILES


;--------------------------------
;Supported Languages

!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "English"

;--------------------------------
; Install Functions

Function ".onInit"
  !insertmacro MUI_LANGDLL_DISPLAY
  !insertmacro MULTIUSER_INIT
FunctionEnd

;--------------------------------
; UnInstall Functions
Function "un.onInit"
!insertmacro MULTIUSER_UNINIT
FunctionEnd

Section ""
; The actual installation
  SetOutPath "$INSTDIR"
  !include "filelist_in.nsh"
; Store install directory
  DetailPrint "$(T_registry)"
  WriteRegStr SHCTX "Software\${productname_short}" "" $INSTDIR

  ; Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"

; Register Uninstaller

  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \
                   "DisplayName" "${productname}"
  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \
                   "DisplayIcon" "$\"$INSTDIR\${productname_short}.exe$\""
  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \
                   "DisplayVersion" "${version_number}"
  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \
                   "Publisher" "Intevation GmbH"
  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \
                   "URLInfoAbout" "${info_url}"
  WriteRegDword SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \
                   "EstimatedSize" "${size}"


  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \
                   "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \
                 "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"

  ; Set up File Extension .edu
  # .edu
  WriteRegStr SHCTX "Software\Classes\${productname_short}.AssocFile.EDU" "" "$(T_File_Type_edu_Name)"
  WriteRegStr SHCTX "Software\Classes\${productname_short}.AssocFile.EDU" "FriendlyTypeName" "$(T_File_Type_edu_Name)"
  WriteRegStr SHCTX "Software\Classes\${productname_short}.AssocFile.EDU" "PercievedType" "Document"
  WriteRegStr SHCTX "Software\Classes\${productname_short}.AssocFile.EDU" "InfoTip" "$(T_File_Type_info_tip)"
  WriteRegStr SHCTX "Software\Classes\${productname_short}.AssocFile.EDU\shell\open\command" "" "$\"$INSTDIR\${productname_short}.exe$\" $\"%1$\""
  WriteRegStr SHCTX "Software\Classes\${productname_short}.AssocFile.EDU" "FriendlyAppName" "${productname}"
  WriteRegStr SHCTX "Software\Classes\${productname_short}.AssocFile.EDU\DefaultIcon" "" "$INSTDIR\${productname_short}.exe"

  WriteRegBin SHCTX "Software\Classes\.edu\OpenWithProgIDs" "${productname_short}.AssocFile.EDU" 0

  WriteRegStr SHCTX "Software\RegisteredApplications" "${productname_short}" "SOFTWARE\${productname_short}\Capabilities"
  WriteRegStr SHCTX "Software\${productname_short}" "" "${productname}"
  WriteRegStr SHCTX "Software\${productname_short}" "FriendlyAppName" "${productname}"

  WriteRegStr SHCTX "Software\${productname_short}\Capabilities" "ApplicationName" "${productname}"
  WriteRegStr SHCTX "Software\${productname_short}\Capabilities" "ApplicationIcon" "$\"$INSTDIR\${productname_short}.exe$\",0"
  WriteRegStr SHCTX "Software\${productname_short}\Capabilities" "ApplicationDescription" "$(T_description)"
  WriteRegStr SHCTX "Software\${productname_short}\Capabilities" "FriendlyAppName" "${productname}"
  WriteRegStr SHCTX "Software\${productname_short}\Capabilities\DefaultIcon" "" "$\"$INSTDIR\${productname_short}.exe$\",0"
  WriteRegStr SHCTX "Software\${productname_short}\Capabilities\MimeAssociations" "application/edu-app" "${productname_short}.AssocFile.EDU"
  WriteRegExpandStr SHCTX "Software\${productname_short}\Capabilities\shell\open\command" "" "$\"$INSTDIR\${productname_short}.exe$\" $\"%1$\""
  WriteRegStr SHCTX "Software\${productname_short}\Capabilities\shell\open" "FriendlyAppName" "${productname}"
  WriteRegStr SHCTX "Software\${productname_short}\Capabilities\FileAssociations" ".edu" "${productname_short}.AssocFile.EDU"


  WriteRegStr SHCTX "SOFTWARE\Classes\Applications\${productname_short}.exe\SupportedTypes" ".edu" ""
  WriteRegStr SHCTX "SOFTWARE\Classes\Applications\${productname_short}.exe\shell\open" "FriendlyAppName" "${productname}"

  CreateShortCut "$SMPROGRAMS\${productname}.lnk" "$INSTDIR\${productname_short}.exe"

  System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
SectionEnd

Section "Uninstall"
  ExpandEnvStrings $0 %APPDATA%
  Delete "$0\${productname_short}\${productname_short}.ini"
  RmDir "$0\${productname_short}"
  !include "filelist_un.nsh"
  ExpandEnvStrings $0 %APPDATA%
  Delete "$INSTDIR\Uninstall.exe"
  RMDir "$INSTDIR"
  DetailPrint "$(T_unregistry)"

  DeleteRegKey SHCTX "Software\Classes\${productname_short}.AssocFile.EDU"
  DeleteRegValue SHCTX "Software\Classes\.edu\OpenWithProgIDs" "${productname_short}.AssocFile.EDU"
  DeleteRegValue SHCTX "Software\RegisteredApplications" "${productname_short}"
  DeleteRegKey SHCTX "Software\${productname_short}"

  DeleteRegKey SHCTX "SOFTWARE\Classes\Applications\${productname_short}.exe"

; Remove uninstaller
  DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}"

  Delete "$SMPROGRAMS\${productname}.lnk"

SectionEnd

LangString T_description ${LANG_ENGLISH} "${productname} is a Software to convert EduApp-Exports into different formats."
LangString T_description ${LANG_GERMAN}  "${productname} ist eine Anwendung um EduApp-Exporte in andere Formate zu konvertieren."
LangString T_title ${LANG_ENGLISH} "Welcome to the installation of ${productname} ${version_number}$\r$\n$\r$\n$\r$\n$\r$\n"
LangString T_title ${LANG_GERMAN} "Willkommen zur Installation von ${productname} ${version_number}$\r$\n$\r$\n$\r$\n$\r$\n"
LangString T_finish_title ${LANG_ENGLISH} "Installation successful"
LangString T_finish_title ${LANG_GERMAN} "Installation erfolgreich"
LangString T_finish_text ${LANG_ENGLISH} "${productname} was successfully installed on your computer.$\r$\n$\r$\nFiles ending with .edu are now opened with ${productname}.$\r$\n$\r$\nClick 'Finish' to close the Install-Wizard."
LangString T_finish_text ${LANG_GERMAN}  "${productname} wurde erfolgreich auf ihrem System installiert. $\r$\n$\r$\nDateien mit der endung .edu werden k�nftig mit ${productname} ge�ffnet.$\r$\n$\r$\nKlicken Sie auf 'Fertig stellen', um den Installations-Assistenten zu schlie�en."
LangString T_File_Type_info_tip ${LANG_ENGLISH} "An EduApp questionaire export."
LangString T_File_Type_info_tip ${LANG_GERMAN} "Export eines EduApp Fragebogens."
LangString T_File_Type_edu_Name ${LANG_GERMAN} "EduApp Export"
LangString T_File_Type_edu_Name ${LANG_ENGLISH} "EduApp Export"
LangString T_registry ${LANG_GERMAN} "Anwendung wird registiert"
LangString T_registry ${LANG_ENGLISH} "Registering Application"
LangString T_unregistry ${LANG_GERMAN} "Entferne Registry Eintr�ge"
LangString T_unregistry ${LANG_ENGLISH} "Unregistering Application"
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)