view packaging/trustbridge.nsi @ 561:4433f9d57f6d

Add resources to main. You can not add resources to a library
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 22 May 2014 13:23:07 +0000
parents bfcfbae151ab
children a4e75d90d3f6
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"

;--------------------------------
;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  "Willkommen bei der Installation des ${productname}"
!define MUI_WELCOMEPAGE_TEXT "Dieser Assistent wird Sie durch die Installation von \
${productname} begleiten. $\r$\n$\r$\n\
${productname} ist eine Anwendung um Wurzelzertifikate auf ihrem System \
zu installieren und aktuell zu halten. $\r$\n$\r$\n\
Klicken Sie auf Weiter, um fortzufahren."

!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"
  !insertmacro MULTIUSER_INIT
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"

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

; Set up autostart
  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Run" "TrustBridge" "$INSTDIR\trustbridge.exe --tray"

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

  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application

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

  !insertmacro MUI_STARTMENU_WRITE_END

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/