diff packaging/trustbridge.nsi @ 588:a4e75d90d3f6

Use latin1 in NSIS (fixes encoding errors) Fix command line installation dir.
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 27 May 2014 17:27:33 +0000
parents bfcfbae151ab
children 9a18f096129d
line wrap: on
line diff
--- a/packaging/trustbridge.nsi	Tue May 27 16:31:29 2014 +0000
+++ b/packaging/trustbridge.nsi	Tue May 27 17:27:33 2014 +0000
@@ -1,4 +1,4 @@
-; Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
+; 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)
@@ -29,6 +29,7 @@
 
 !include "MultiUser.nsh"
 !include "MUI2.nsh"
+!include "FileFunc.nsh"
 
 ;--------------------------------
 ;Version Information (for installer file properties)
@@ -66,7 +67,7 @@
 !define MUI_UNICON "resources\uninstall.ico"
 
 ; MUI welcome page text
-!define MUI_WELCOMEPAGE_TITLE  "Willkommen bei der Installation des ${productname}"
+!define MUI_WELCOMEPAGE_TITLE  "Willkommen bei der Installation von ${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 \
@@ -88,10 +89,10 @@
 !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
+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"
 
@@ -112,7 +113,24 @@
 ; 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
@@ -134,14 +152,17 @@
   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
 
 ; 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
@@ -149,6 +170,7 @@
   CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${productname}.lnk" "$INSTDIR\trustbridge.exe"
 
   !insertmacro MUI_STARTMENU_WRITE_END
+done:
 
 SectionEnd
 

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