github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/build/NSIS/setup.nsi (about) 1 ;-------------------------------- 2 ;Include Modern UI 3 4 !include "MUI2.nsh" 5 6 ;-------------------------------- 7 ;General 8 9 ;Name and file 10 Name "CodeNotary vcn {VCN_VERSION}" 11 OutFile "codenotary_vcn_{VCN_VERSION}_setup.exe" 12 Icon "vcn.ico" 13 LicenseData "gpl3license.txt" 14 15 ;Default installation folder 16 InstallDir "$PROGRAMFILES64\CodeNotary" 17 18 ;Get installation folder from registry if available 19 InstallDirRegKey HKCU "Software\CodeNotary" "" 20 21 ;Request application privileges for Windows Vista 22 RequestExecutionLevel admin 23 24 SetCompressor /SOLID LZMA 25 ;-------------------------------- 26 ;Interface Settings 27 28 !define MUI_ABORTWARNING 29 !define MUI_ICON vcn.ico 30 31 32 ;-------------------------------- 33 ;Pages 34 !insertmacro MUI_PAGE_WELCOME 35 !insertmacro MUI_PAGE_LICENSE "gpl3license.txt" 36 !insertmacro MUI_PAGE_COMPONENTS 37 !insertmacro MUI_PAGE_DIRECTORY 38 !insertmacro MUI_PAGE_INSTFILES 39 !insertmacro MUI_PAGE_FINISH 40 41 !insertmacro MUI_UNPAGE_WELCOME 42 !insertmacro MUI_UNPAGE_CONFIRM 43 !insertmacro MUI_UNPAGE_INSTFILES 44 !insertmacro MUI_UNPAGE_FINISH 45 46 ;-------------------------------- 47 ;Languages 48 49 !insertmacro MUI_LANGUAGE "English" 50 51 52 ;-------------------------------- 53 ;Installer Sections 54 55 Section "CodeNotary vcn cli tool" installation 56 57 ;Add files 58 SetOutPath "$INSTDIR" 59 60 File "vcn.exe" 61 File "vcn.ico" 62 File "gpl3license.txt" 63 64 ;create desktop shortcut 65 SetOutPath "$INSTDIR" 66 CreateShortCut "$DESKTOP\vcn.lnk" "cmd.exe" "" "$INSTDIR\vcn.ico" 67 68 ;create start-menu items 69 CreateDirectory "$INSTDIR" 70 CreateShortCut "$INSTDIR\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 71 CreateShortCut "$INSTDIR\vcn.lnk" "$INSTDIR\vcn.exe" "" "$INSTDIR\vcn.exe" 0 72 73 ;create context menu 74 WriteRegStr HKCR "*\shell" "" "CodeNotary authenticate" 75 WriteRegStr HKCR "*\shell\CodeNotary authenticate" "Icon" "$INSTDIR\vcn.ico,0" 76 WriteRegStr HKCR "*\shell\CodeNotary authenticate\command" "" '"$INSTDIR\vcn.exe" authenticate "%1"' 77 78 WriteRegStr HKCR "*\shell" "" "CodeNotary notarize" 79 WriteRegStr HKCR "*\shell\CodeNotary notarize" "Icon" "$INSTDIR\vcn.ico,0" 80 WriteRegStr HKCR "*\shell\CodeNotary notarize\command" "" '"$INSTDIR\vcn.exe" notarize "%1"' 81 82 83 ;write uninstall information to the registry 84 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CodeNotary" "DisplayName" "vcn (remove only)" 85 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CodeNotary" "UninstallString" "$INSTDIR\Uninstall.exe" 86 87 WriteUninstaller "$INSTDIR\Uninstall.exe" 88 89 SectionEnd 90 91 ;Language strings 92 LangString DESC_Installation ${LANG_ENGLISH} "vChain CodeNotary vcn command line" 93 94 ;Assign language strings to sections 95 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN 96 !insertmacro MUI_DESCRIPTION_TEXT ${Installation} $(DESC_Installation) 97 !insertmacro MUI_FUNCTION_DESCRIPTION_END 98 99 ;-------------------------------- 100 ;Uninstaller Section 101 Section "Uninstall" 102 103 ;Delete Files 104 RMDir /r "$INSTDIR\*.*" 105 106 ;Remove the installation directory 107 RMDir "$INSTDIR" 108 109 ;Delete Start Menu Shortcuts 110 Delete "$DESKTOP\vcn.lnk" 111 112 ;Delete Uninstaller And Unistall Registry Entries 113 DeleteRegKey HKCR "*\shell\CodeNotary authenticate" 114 DeleteRegKey HKCR "*\shell\CodeNotary notarize" 115 DeleteRegKey /ifempty HKCU "SOFTWARE\CodeNotary" 116 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CodeNotary" 117 118 SectionEnd 119 120 ;Function that calls a messagebox when installation finished correctly 121 Function .onInstSuccess 122 MessageBox MB_OK "You have successfully installed CodeNotary vcn. Open the vcn icon in your startmenu and type vcn.exe to start" 123 FunctionEnd 124 125 126 Function un.onUninstSuccess 127 MessageBox MB_OK "You have successfully uninstalled CodeNotary vcn." 128 FunctionEnd 129