aheinecke@588: ; Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik aheinecke@406: ; Software engineering by Intevation GmbH aheinecke@406: ; aheinecke@406: ; This file is Free Software under the GNU GPL (v>=2) aheinecke@406: ; and comes with ABSOLUTELY NO WARRANTY! aheinecke@406: ; See LICENSE.txt for details. aheinecke@406: aheinecke@340: ; This script creates the installer for renameme it needs the aheinecke@340: ; following definitions to be set when calling makensis: aheinecke@340: ; aheinecke@340: ; productname: Name of the Software as it will show up under installed aheinecke@340: ; Software aheinecke@340: ; company: The publisher of this software. (Windows needs this) aheinecke@340: ; version_number: The version of the software aheinecke@340: ; setupname: The name for the result created by this aheinecke@340: ; productname_short: Used for the default folder name and such aheinecke@340: ; files_dir: the path to the files aheinecke@340: aheinecke@340: ;-------------------------------- aheinecke@340: ; Includes aheinecke@340: !define MULTIUSER_EXECUTIONLEVEL Highest aheinecke@340: !define MULTIUSER_MUI aheinecke@340: !define MULTIUSER_INSTALLMODE_COMMANDLINE aheinecke@340: !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "Software\${productname_short}" aheinecke@340: !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "" aheinecke@340: !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\${productname_short}" aheinecke@340: !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "" aheinecke@340: !define MULTIUSER_INSTALLMODE_INSTDIR "${productname_short}" aheinecke@340: aheinecke@340: !include "MultiUser.nsh" aheinecke@340: !include "MUI2.nsh" aheinecke@588: !include "FileFunc.nsh" aheinecke@340: aheinecke@340: ;-------------------------------- aheinecke@340: ;Version Information (for installer file properties) aheinecke@340: aheinecke@500: ;VIProductVersion "${version_number}" ;needs integer format: x.x.x.x aheinecke@500: VIProductVersion 1.0.0.0 aheinecke@340: VIAddVersionKey "ProductName" "${productname_short}" aheinecke@340: VIAddVersionKey "Comments" "${productname_short} ist Freie Software" aheinecke@340: VIAddVersionKey "CompanyName" "${company}" aheinecke@340: VIAddVersionKey "LegalTrademarks" "" aheinecke@340: VIAddVersionKey "LegalCopyright" "${copyright}" aheinecke@340: VIAddVersionKey "FileDescription" "${description}" aheinecke@340: VIAddVersionKey "FileVersion" "${version_number}" aheinecke@340: aheinecke@340: Var StartMenuFolder aheinecke@340: ;-------------------------------- aheinecke@340: ; General aheinecke@340: aheinecke@340: ; Define Name, File and Installdir of Installer aheinecke@340: Name "${productname}" aheinecke@340: OutFile "${setupname}" aheinecke@340: InstallDir "$PROGRAMFILES\${productname_short}" emanuel@381: BrandingText "${company} - ${productname}" aheinecke@340: aheinecke@340: ;-------------------------------- emanuel@381: ; Interface Settings aheinecke@340: emanuel@381: ; MUI Images / Icons emanuel@381: !define MUI_HEADERIMAGE emanuel@381: !define MUI_HEADERIMAGE_BITMAP "resources\header-install.bmp" emanuel@381: !define MUI_HEADERIMAGE_UNBITMAP "resources\header-uninstall.bmp" emanuel@381: !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\wizard-install.bmp" emanuel@381: !define MUI_UNWELCOMEFINISHPAGE_BITMAP "resources\wizard-uninstall.bmp" emanuel@381: !define MUI_ICON "resources\install.ico" emanuel@381: !define MUI_UNICON "resources\uninstall.ico" emanuel@381: emanuel@381: ; MUI welcome page text bernhard@793: !define MUI_WELCOMEPAGE_TITLE "${productname} ist eine Anwendung um Wurzelzertifikate auf ihrem System \ bernhard@792: zu installieren und aktuell zu halten." bernhard@797: !define MUI_WELCOMEPAGE_TITLE_3LINES bernhard@797: !define MUI_WELCOMEPAGE_TEXT "" emanuel@381: emanuel@381: !define MUI_FINISHPAGE_NOAUTOCLOSE emanuel@381: !define MUI_UNFINISHPAGE_NOAUTOCLOSE aheinecke@340: aheinecke@340: !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" aheinecke@340: !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${productname_short}" aheinecke@340: !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" aheinecke@340: aheinecke@340: emanuel@381: ;-------------------------------- emanuel@381: ; Pages aheinecke@340: emanuel@381: !define MUI_FINISHPAGE_TITLE "Die Installation war erfolgreich" aheinecke@506: !define MUI_FINISHPAGE_TEXT "${productname} wurde auf Ihrem \ emanuel@381: Computer installliert. $\r$\n$\r$\n\ emanuel@381: Klicken Sie auf 'Fertig stellen', um den Installations-Assistenten\ aheinecke@588: zu schließen." aheinecke@588: ;!define MUI_FINISHPAGE_RUN $INSTDIR\trustbridge.exe aheinecke@588: ;!define MUI_FINISHPAGE_RUN_TEXT "Anwendung starten" aheinecke@588: ;!define MUI_FINISHPAGE_RUN_FUNCTION RunAsUser andre@794: !define MUI_FINISHPAGE_LINK "Mehr unter ${info_url}" andre@794: !define MUI_FINISHPAGE_LINK_LOCATION "${info_url}" aheinecke@340: aheinecke@340: !insertmacro MUI_PAGE_WELCOME emanuel@381: !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder aheinecke@340: !insertmacro MUI_PAGE_DIRECTORY aheinecke@340: !insertmacro MUI_PAGE_INSTFILES aheinecke@340: !insertmacro MUI_PAGE_FINISH aheinecke@340: emanuel@381: !insertmacro MUI_UNPAGE_CONFIRM emanuel@381: !insertmacro MUI_UNPAGE_INSTFILES emanuel@381: emanuel@381: emanuel@381: !insertmacro MUI_LANGUAGE "German" emanuel@381: emanuel@381: aheinecke@340: ;-------------------------------- emanuel@381: ; Install Functions emanuel@381: aheinecke@340: Function ".onInit" aheinecke@588: Var /GLOBAL is_update aheinecke@588: Var /GLOBAL changed_dir aheinecke@588: ${GetParameters} $R0 aheinecke@588: ClearErrors aheinecke@588: ${GetOptions} $R0 /UPDATE= $is_update aheinecke@588: aheinecke@588: ; Check if the install directory was modified on the command line aheinecke@588: StrCmp "$INSTDIR" "$PROGRAMFILES\${productname_short}" unmodified 0 aheinecke@588: ; It is modified. Save that value. aheinecke@588: StrCpy $changed_dir "$INSTDIR" aheinecke@588: aheinecke@588: ; MULITUSER_INIT overwrites directory setting from command line aheinecke@340: !insertmacro MULTIUSER_INIT aheinecke@588: StrCpy $INSTDIR "$changed_dir" aheinecke@588: goto initDone aheinecke@588: unmodified: aheinecke@588: !insertmacro MULTIUSER_INIT aheinecke@588: initDone: aheinecke@340: FunctionEnd aheinecke@340: aheinecke@506: ; If we run elevated we do not want to run aheinecke@506: ; the UI elevated as this could be a security aheinecke@506: ; problem. aheinecke@506: Function RunAsUser aheinecke@506: ExecShell "" "$INSTDIR\trustbridge.exe" aheinecke@506: FunctionEnd aheinecke@506: aheinecke@340: ;-------------------------------- emanuel@381: ; UnInstall Functions emanuel@381: aheinecke@340: Function "un.onInit" aheinecke@340: !insertmacro MULTIUSER_UNINIT aheinecke@340: FunctionEnd aheinecke@340: aheinecke@340: Section "" aheinecke@340: ; The actual installation aheinecke@340: SetOutPath "$INSTDIR" aheinecke@340: !include "filelist.nsh" aheinecke@340: aheinecke@588: ;Create uninstaller aheinecke@588: WriteUninstaller "$INSTDIR\Uninstall.exe" aheinecke@588: aheinecke@588: ; Code below is not run on updates aheinecke@588: StrCmp $is_update '1' done aheinecke@588: aheinecke@340: WriteRegStr SHCTX "Software\${productname_short}" "" $INSTDIR aheinecke@340: andre@632: WriteRegStr SHCTX "Software\${productname_short}" "" $INSTDIR andre@632: andre@632: ; Register logging andre@632: WriteRegStr SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "CategoryMessageFile" "$INSTDIR\trustbridge.exe" andre@632: WriteRegStr SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "EventMessageFile" "$INSTDIR\trustbridge.exe" andre@632: WriteRegStr SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "ParameterMessageFile" "$INSTDIR\trustbridge.exe" andre@632: WriteRegDword SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "TypesSupported" 5 andre@632: WriteRegDword SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" "CategoryCount" 3 aheinecke@494: andre@794: ; Register Uninstaller andre@794: andre@794: WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \ andre@794: "DisplayName" "${productname}" andre@794: WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \ andre@794: "DisplayIcon" "$\"$INSTDIR\trustbridge.exe$\"" andre@794: WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \ andre@794: "DisplayVersion" "${version_number}" andre@794: WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \ andre@794: "Publisher" "${company}" andre@794: WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \ andre@794: "URLInfoAbout" "${info_url}" andre@794: WriteRegDword SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \ andre@794: "EstimatedSize" "${size}" andre@794: andre@794: andre@794: WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \ andre@794: "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" andre@794: WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" \ andre@794: "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" andre@794: aheinecke@340: !insertmacro MUI_STARTMENU_WRITE_BEGIN Application aheinecke@340: aheinecke@340: ;Create shortcuts aheinecke@340: CreateDirectory "$SMPROGRAMS\$StartMenuFolder" aheinecke@494: CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${productname}.lnk" "$INSTDIR\trustbridge.exe" aheinecke@340: aheinecke@340: !insertmacro MUI_STARTMENU_WRITE_END aheinecke@588: done: aheinecke@340: aheinecke@340: SectionEnd aheinecke@340: aheinecke@340: Section "Uninstall" aheinecke@340: RMDir /r "$INSTDIR" ; TODO include uninstall files aheinecke@340: ; !include "filelist-un.nsh" aheinecke@340: ; Delete "$INSTDIR\Uninstall.exe" aheinecke@340: ; RMDir "$INSTDIR" aheinecke@340: aheinecke@340: !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder aheinecke@340: aheinecke@340: Delete "$SMPROGRAMS\$StartMenuFolder\${productname}.lnk" aheinecke@340: RMDir "$SMPROGRAMS\$StartMenuFolder" aheinecke@340: aheinecke@340: DeleteRegKey /ifempty SHCTX "Software\${productname_short}" aheinecke@340: andre@794: ; Unregister logging andre@794: DeleteRegKey SHCTX "System\CurrentControlSet\services\eventlog\Application\${productname_short}" andre@794: andre@794: ; Remove uninstaller andre@794: DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" aheinecke@340: SectionEnd