github.com/aquanetwork/aquachain@v1.7.8/build/nsis.install.nsh (about) 1 Name "aquachain ${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://gitlab.com/aquachain/aquachain/issues" 7 !define UPDATEURL "https://gitlab.com/aquachain/aquachain/releases" 8 !define ABOUTURL "https://gitlab.com/aquachain/aquachain#aquachain-go" 9 !define /date NOW "%Y%m%d" 10 11 PageEx license 12 LicenseData {{.License}} 13 PageExEnd 14 15 # Install aquachain binary 16 Section "AquaChain" AQUAD_IDX 17 SetOutPath $INSTDIR 18 file {{.AquaChain}} 19 20 # Create start menu launcher 21 createDirectory "$SMPROGRAMS\${APPNAME}" 22 createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\aquachain.exe" "--fast" "--cache=512" 23 createShortCut "$SMPROGRAMS\${APPNAME}\Attach.lnk" "$INSTDIR\aquachain.exe" "attach" "" "" 24 createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "" "" 25 26 # Firewall - remove rules (if exists) 27 SimpleFC::AdvRemoveRule "AquaChain incoming peers (TCP:21303)" 28 SimpleFC::AdvRemoveRule "AquaChain outgoing peers (TCP:21303)" 29 SimpleFC::AdvRemoveRule "AquaChain UDP discovery (UDP:21303)" 30 31 # Firewall - add rules 32 SimpleFC::AdvAddRule "AquaChain incoming peers (TCP:21303)" "" 6 1 1 2147483647 1 "$INSTDIR\aquachain.exe" "" "" "AquaChain" 21303 "" "" "" 33 SimpleFC::AdvAddRule "AquaChain outgoing peers (TCP:21303)" "" 6 2 1 2147483647 1 "$INSTDIR\aquachain.exe" "" "" "AquaChain" "" 21303 "" "" 34 SimpleFC::AdvAddRule "AquaChain UDP discovery (UDP:21303)" "" 17 2 1 2147483647 1 "$INSTDIR\aquachain.exe" "" "" "AquaChain" "" 21303 "" "" 35 36 # Set default IPC endpoint (https://github.com/aquanetwork/EIPs/issues/147) 37 ${EnvVarUpdate} $0 "AquaChain_SOCKET" "R" "HKLM" "\\.\pipe\aquachain.ipc" 38 ${EnvVarUpdate} $0 "AquaChain_SOCKET" "A" "HKLM" "\\.\pipe\aquachain.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} ${AQUAD_IDX} 58 SectionGetSize ${AQUAD_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