github.com/core-coin/go-core/v2@v2.1.9/build/nsis.install.nsh (about) 1 Name "gocore ${MAJORVERSION}.${MINORVERSION}.${BUILDVERSION}" # VERSION variables set through command line arguments 2 InstallDir "$InstDir" 3 OutFile "${OUTPUTFILE}" # set through command line arguments 4 5 # Links for "Add/Remove Programs" 6 !define HELPURL "https://github.com/core-coin/go-core/issues" 7 !define UPDATEURL "https://github.com/core-coin/go-core/releases" 8 !define ABOUTURL "https://github.com/core-coin/go-core#core-go" 9 !define /date NOW "%Y%m%d" 10 11 PageEx license 12 LicenseData {{.License}} 13 PageExEnd 14 15 # Install gocore binary 16 Section "Gocore" Gocore_IDX 17 SetOutPath $INSTDIR 18 file {{.Gocore}} 19 20 # Create start menu launcher 21 createDirectory "$SMPROGRAMS\${APPNAME}" 22 createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\gocore.exe" 23 createShortCut "$SMPROGRAMS\${APPNAME}\Attach.lnk" "$INSTDIR\gocore.exe" "attach" 24 createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" 25 26 # Firewall - remove rules (if exists) 27 SimpleFC::AdvRemoveRule "Gocore incoming peers (TCP:30300)" 28 SimpleFC::AdvRemoveRule "Gocore outgoing peers (TCP:30300)" 29 SimpleFC::AdvRemoveRule "Gocore UDP discovery (UDP:30300)" 30 31 # Firewall - add rules 32 SimpleFC::AdvAddRule "Gocore incoming peers (TCP:30300)" "" 6 1 1 2147483647 1 "$INSTDIR\gocore.exe" "" "" "Core" 30300 "" "" "" 33 SimpleFC::AdvAddRule "Gocore outgoing peers (TCP:30300)" "" 6 2 1 2147483647 1 "$INSTDIR\gocore.exe" "" "" "Core" "" 30300 "" "" 34 SimpleFC::AdvAddRule "Gocore UDP discovery (UDP:30300)" "" 17 2 1 2147483647 1 "$INSTDIR\gocore.exe" "" "" "Core" "" 30300 "" "" 35 36 # Set default IPC endpoint (https://github.com/core/CIPs/issues/147) 37 ${EnvVarUpdate} $0 "CORE_SOCKET" "R" "HKLM" "\\.\pipe\gocore.ipc" 38 ${EnvVarUpdate} $0 "CORE_SOCKET" "A" "HKLM" "\\.\pipe\gocore.ipc" 39 40 # Add instdir to PATH 41 Push "$INSTDIR" 42 Call AddToPath 43 SectionEnd 44 45 # Install optional develop tools. 46 Section /o "Development tools" DEV_TOOLS_IDX 47 SetOutPath $INSTDIR 48 {{range .DevTools}}file {{.}} 49 {{end}} 50 SectionEnd 51 52 # Return on top of stack the total size (as DWORD) of the selected/installed sections. 53 Var GetInstalledSize.total 54 Function GetInstalledSize 55 StrCpy $GetInstalledSize.total 0 56 57 ${if} ${SectionIsSelected} ${GOCORE_IDX} 58 SectionGetSize ${GOCORE_IDX} $0 59 IntOp $GetInstalledSize.total $GetInstalledSize.total + $0 60 ${endif} 61 62 ${if} ${SectionIsSelected} ${DEV_TOOLS_IDX} 63 SectionGetSize ${DEV_TOOLS_IDX} $0 64 IntOp $GetInstalledSize.total $GetInstalledSize.total + $0 65 ${endif} 66 67 IntFmt $GetInstalledSize.total "0x%08X" $GetInstalledSize.total 68 Push $GetInstalledSize.total 69 FunctionEnd 70 71 # Write registry, Windows uses these values in various tools such as add/remove program. 72 # PowerShell: Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, InstallLocation, InstallDate | Format-Table –AutoSize 73 function .onInstSuccess 74 # Save information in registry in HKEY_LOCAL_MACHINE branch, Windows add/remove functionality depends on this 75 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayName" "${GROUPNAME} - ${APPNAME} - ${DESCRIPTION}" 76 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" 77 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" 78 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallLocation" "$INSTDIR" 79 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallDate" "${NOW}" 80 # Wait for Alex 81 #WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\logo.ico$\"" 82 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "Publisher" "${GROUPNAME}" 83 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "HelpLink" "${HELPURL}" 84 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLUpdateInfo" "${UPDATEURL}" 85 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLInfoAbout" "${ABOUTURL}" 86 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayVersion" "${MAJORVERSION}.${MINORVERSION}.${BUILDVERSION}" 87 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMajor" ${MAJORVERSION} 88 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMinor" ${MINORVERSION} 89 # There is no option for modifying or repairing the install 90 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoModify" 1 91 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoRepair" 1 92 93 Call GetInstalledSize 94 Pop $0 95 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "EstimatedSize" "$0" 96 97 # Create uninstaller 98 writeUninstaller "$INSTDIR\uninstall.exe" 99 functionEnd 100 101 Page components 102 Page directory 103 Page instfiles