nsis.install.nsh 5.3 KB

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