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: andre@1010: !addplugindir "${plugin_dir}" andre@1188: !addincludedir "${plugin_dir}" andre@1010: aheinecke@340: !include "MultiUser.nsh" aheinecke@340: !include "MUI2.nsh" aheinecke@588: !include "FileFunc.nsh" andre@828: !include "WinVer.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 andre@859: Var douninstcertificates andre@835: Var uninstCertificates 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 emanuel@862: !define MUI_WELCOMEPAGE_TITLE "Willkommen zur Installation von TrustBridge ${version_number}" bernhard@798: ;!define MUI_WELCOMEPAGE_TITLE_3LINES bernhard@798: !define MUI_WELCOMEPAGE_TEXT "${productname} ist eine Anwendung \ emanuel@862: um Wurzelzertifikate auf ihrem System zu installieren und aktuell zu halten. \ emanuel@862: $\r$\n$\r$\n$\r$\n$\r$\n \ emanuel@862: Achtung: Dies ist eine Testversion!" emanuel@381: emanuel@381: !define MUI_FINISHPAGE_NOAUTOCLOSE emanuel@381: !define MUI_UNFINISHPAGE_NOAUTOCLOSE aheinecke@340: andre@915: !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." andre@1010: !define MUI_FINISHPAGE_RUN $INSTDIR\trustbridge.exe andre@1010: !define MUI_FINISHPAGE_RUN_TEXT "Anwendung starten" andre@1010: !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: andre@831: !ifdef WRITE_UNINSTALLER andre@859: !define MUI_PAGE_CUSTOMFUNCTION_SHOW un.ModifyUnWelcome andre@859: !define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.LeaveUnWelcome andre@835: andre@859: !insertmacro MUI_UNPAGE_WELCOME andre@831: !insertmacro MUI_UNPAGE_CONFIRM andre@831: !insertmacro MUI_UNPAGE_INSTFILES andre@835: andre@859: Function un.ModifyUnWelcome andre@835: ${NSD_CreateCheckbox} 120u -18u 50% 12u "Verwaltete Zertifikate entfernen." andre@835: Pop $uninstCertificates andre@835: SetCtlColors $uninstCertificates "" ${MUI_BGCOLOR} andre@859: ${NSD_Check} $uninstCertificates ; Check it by default andre@835: FunctionEnd andre@835: andre@859: Function un.LeaveUnWelcome andre@835: ${NSD_GetState} $uninstCertificates $0 andre@859: StrCpy $douninstcertificates "FALSE" andre@835: ${If} $0 <> 0 andre@859: StrCpy $douninstcertificates "TRUE" andre@835: ${EndIf} andre@835: FunctionEnd andre@831: !endif emanuel@381: emanuel@381: !insertmacro MUI_LANGUAGE "German" emanuel@381: emanuel@381: aheinecke@340: ;-------------------------------- emanuel@381: ; Install Functions emanuel@381: aheinecke@340: Function ".onInit" andre@831: !ifdef WRITE_UNINSTALLER andre@831: SetOutPath "c:\tmp-uninstaller" andre@831: WriteUninstaller "c:\tmp-uninstaller\Uninstall.exe" andre@831: Quit andre@831: !endif andre@831: andre@828: ${IfNot} ${AtLeastWinVista} andre@917: MessageBox MB_ICONSTOP "Windows XP und ältere Windows Versionen werden von dieser Anwendung nicht unterstützt." andre@828: Quit andre@828: ${Endif} andre@828: andre@917: UserInfo::GetAccountType andre@917: pop $0 andre@917: ${If} $0 != "admin" andre@917: MessageBox MB_ICONINFORMATION|MB_YESNO "\ andre@917: Sie sind im Begriff ${productname} ohne Administratorrechte zu installieren. $\r$\n\ andre@917: $\r$\n\ andre@917: Ohne Administratorrechte werden Sie von Windows zur Bestätigung jeder Zertifikatsänderung einzeln aufgefordert. $\r$\n$\r$\n\ emanuel@925: Wenn Sie die Möglichkeit besitzen Administratorrechte auf diesem System zu erlangen, starten Sie diesen Installer \ emanuel@925: erneut mit der Funktion 'Als Administrator ausführen'. $\r$\n$\r$\n\ andre@917: Möchten Sie die Installation ohne Administratorrechte fortsetzen?" /SD IDYES IDYES goOn IDNO stopNow andre@917: stopNow: andre@917: Quit andre@917: goOn: andre@917: ${EndIf} andre@917: 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 andre@1118: DesktopShellRun::Exec "$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 "" andre@895: StrCmp $is_update '1' wait_a_bit continue andre@895: wait_a_bit: andre@895: ; The trustbridge.exe might need some time to close andre@895: ; lets give it a chance to avoid failing to overwrite it andre@895: Sleep 1000 andre@895: continue: aheinecke@340: ; The actual installation aheinecke@340: SetOutPath "$INSTDIR" andre@1188: !include "filelist_in.nsh" andre@1188: SetOutPath "$INSTDIR" aheinecke@340: aheinecke@588: ;Create uninstaller andre@831: !ifndef WRITE_UNINSTALLER andre@831: File "${files_dir}${path_sep}Uninstall.exe" andre@831: !endif 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@870: ; Set up autostart andre@901: WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "TrustBridge" "$INSTDIR\trustbridge.exe --tray" 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: andre@915: ; Below this is HKCU only! andre@915: SetShellVarContext current 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: andre@1010: StrCmp $is_update '1' run_silent dont_run andre@1010: run_silent: andre@1124: DesktopShellRun::Exec "$INSTDIR\trustbridge.exe" "--tray" andre@1010: dont_run: aheinecke@340: aheinecke@340: SectionEnd aheinecke@340: andre@831: !ifdef WRITE_UNINSTALLER aheinecke@340: Section "Uninstall" andre@859: StrCmp "$douninstcertificates" "TRUE" 0 skip_certs andre@859: ExpandEnvStrings $0 %LOCALAPPDATA% andre@1176: nsExec::ExecToLog '"$INSTDIR\trustbridge-certificate-installer.exe" "list=$0\BSI\TrustBridge\list-installed.txt" "choices=uninstall"' andre@859: skip_certs: andre@1188: !include "filelist_un.nsh" andre@1188: Delete "$INSTDIR\Uninstall.exe" andre@1188: RMDir "$INSTDIR" aheinecke@340: aheinecke@340: !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder aheinecke@340: andre@915: DeleteRegValue SHCTX "Software\${productname_short}" "Start Menu Folder" aheinecke@340: aheinecke@340: DeleteRegKey /ifempty SHCTX "Software\${productname_short}" aheinecke@340: andre@870: ; Unregister autostart andre@870: DeleteRegValue SHCTX "Software\Microsoft\Windows\CurrentVersion\Run" "TrustBridge" andre@870: 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}" andre@915: andre@915: ; Below this is HKCU only! andre@915: SetShellVarContext current andre@915: andre@915: Delete "$SMPROGRAMS\$StartMenuFolder\${productname}.lnk" andre@915: RMDir "$SMPROGRAMS\$StartMenuFolder" andre@915: aheinecke@340: SectionEnd andre@831: !endif