view packaging/trustbridge.nsi @ 793:6bb769d3cdc1

Installer: Welcomepage: Further shortned to the core message.
author Bernhard Reiter <bernhard@intevation.de>
date Tue, 15 Jul 2014 10:42:36 +0200
parents 02214ef01bfa
children fdc15f0cfdd8
line wrap: on
line source
; Copyright (C) 2014 by Bundesamt f�r Sicherheit in der Informationstechnik
; 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
; company: The publisher of this software. (Windows needs this)
; 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
; files_dir: the path to the files

;--------------------------------
; 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 ""
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\${productname_short}"
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME ""
!define MULTIUSER_INSTALLMODE_INSTDIR "${productname_short}"

!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 1.0.0.0
VIAddVersionKey "ProductName" "${productname_short}"
VIAddVersionKey "Comments" "${productname_short} ist Freie Software"
VIAddVersionKey "CompanyName" "${company}"
VIAddVersionKey "LegalTrademarks" ""
VIAddVersionKey "LegalCopyright" "${copyright}"
VIAddVersionKey "FileDescription" "${description}"
VIAddVersionKey "FileVersion" "${version_number}"

Var StartMenuFolder
;--------------------------------
; General

; Define Name, File and Installdir of Installer
Name "${productname}"
OutFile "${setupname}"
InstallDir "$PROGRAMFILES\${productname_short}"
BrandingText "${company} - ${productname}"

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

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

; MUI welcome page text
!define MUI_WELCOMEPAGE_TITLE  "${productname} ist eine Anwendung um Wurzelzertifikate auf ihrem System \
zu installieren und aktuell zu halten."
;!define MUI_WELCOMEPAGE_TEXT ""

!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE

!define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${productname_short}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"


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

!define MUI_FINISHPAGE_TITLE  "Die Installation war erfolgreich"
!define MUI_FINISHPAGE_TEXT  "${productname} wurde auf Ihrem \
Computer installliert. $\r$\n$\r$\n\
Klicken Sie auf 'Fertig stellen', um den Installations-Assistenten\
zu schlie�en."
;!define MUI_FINISHPAGE_RUN $INSTDIR\trustbridge.exe
;!define MUI_FINISHPAGE_RUN_TEXT "Anwendung starten"
;!define MUI_FINISHPAGE_RUN_FUNCTION RunAsUser
!define MUI_FINISHPAGE_LINK "Mehr unter http://www.bsi.bund.de" 
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.bsi.bund.de"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES


!insertmacro MUI_LANGUAGE "German"


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

Function ".onInit"
  Var /GLOBAL is_update
  Var /GLOBAL changed_dir
  ${GetParameters} $R0
  ClearErrors
  ${GetOptions} $R0 /UPDATE= $is_update

; Check if the install directory was modified on the command line
  StrCmp "$INSTDIR" "$PROGRAMFILES\${productname_short}" unmodified 0
  ; It is modified. Save that value.
  StrCpy $changed_dir "$INSTDIR"

; MULITUSER_INIT overwrites directory setting from command line
  !insertmacro MULTIUSER_INIT
  StrCpy $INSTDIR "$changed_dir"
  goto initDone
unmodified:
  !insertmacro MULTIUSER_INIT
initDone:
FunctionEnd

; If we run elevated we do not want to run
; the UI elevated as this could be a security
; problem.
Function RunAsUser
  ExecShell "" "$INSTDIR\trustbridge.exe"
FunctionEnd

;--------------------------------
; UnInstall Functions

Function "un.onInit"
  !insertmacro MULTIUSER_UNINIT
FunctionEnd

Section ""
; The actual installation
  SetOutPath "$INSTDIR"
  !include "filelist.nsh"

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

; Code below is not run on updates
  StrCmp $is_update '1' done

  WriteRegStr SHCTX "Software\${productname_short}" "" $INSTDIR

  WriteRegStr SHCTX "Software\${productname_short}" "" $INSTDIR

; Register logging
  WriteRegStr SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "CategoryMessageFile" "$INSTDIR\trustbridge.exe"
  WriteRegStr SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "EventMessageFile" "$INSTDIR\trustbridge.exe"
  WriteRegStr SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "ParameterMessageFile" "$INSTDIR\trustbridge.exe"
  WriteRegDword SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "TypesSupported" 5
  WriteRegDword SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "CategoryCount" 3

  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application

  ;Create shortcuts
  CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
  CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${productname}.lnk" "$INSTDIR\trustbridge.exe"

  !insertmacro MUI_STARTMENU_WRITE_END
done:

SectionEnd

Section "Uninstall"
  RMDir /r "$INSTDIR" ; TODO include uninstall files
; !include "filelist-un.nsh"
;  Delete "$INSTDIR\Uninstall.exe"
;  RMDir "$INSTDIR"

  !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder

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

  DeleteRegKey /ifempty SHCTX "Software\${productname_short}"

SectionEnd

http://wald.intevation.org/projects/trustbridge/