nsis.install.nsh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 geth to PATH
  33. ${EnvVarUpdate} $0 "PATH" "A" "HKLM" $INSTDIR
  34. SectionEnd
  35. # Install optional develop tools.
  36. Section /o "Development tools" DEV_TOOLS_IDX
  37. SetOutPath $INSTDIR
  38. {{range .DevTools}}file {{.}}
  39. {{end}}
  40. SectionEnd
  41. # Return on top of stack the total size (as DWORD) of the selected/installed sections.
  42. Var GetInstalledSize.total
  43. Function GetInstalledSize
  44. StrCpy $GetInstalledSize.total 0
  45. ${if} ${SectionIsSelected} ${GETH_IDX}
  46. SectionGetSize ${GETH_IDX} $0
  47. IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
  48. ${endif}
  49. ${if} ${SectionIsSelected} ${DEV_TOOLS_IDX}
  50. SectionGetSize ${DEV_TOOLS_IDX} $0
  51. IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
  52. ${endif}
  53. IntFmt $GetInstalledSize.total "0x%08X" $GetInstalledSize.total
  54. Push $GetInstalledSize.total
  55. FunctionEnd
  56. # Write registry, Windows uses these values in various tools such as add/remove program.
  57. # PowerShell: Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, InstallLocation, InstallDate | Format-Table –AutoSize
  58. function .onInstSuccess
  59. # Save information in registry in HKEY_LOCAL_MACHINE branch, Windows add/remove functionality depends on this
  60. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayName" "${GROUPNAME} - ${APPNAME} - ${DESCRIPTION}"
  61. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
  62. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
  63. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallLocation" "$INSTDIR"
  64. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallDate" "${NOW}"
  65. # Wait for Alex
  66. #WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\logo.ico$\""
  67. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "Publisher" "${GROUPNAME}"
  68. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "HelpLink" "${HELPURL}"
  69. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLUpdateInfo" "${UPDATEURL}"
  70. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLInfoAbout" "${ABOUTURL}"
  71. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayVersion" "${MAJORVERSION}.${MINORVERSION}.${BUILDVERSION}"
  72. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMajor" ${MAJORVERSION}
  73. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMinor" ${MINORVERSION}
  74. # There is no option for modifying or repairing the install
  75. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoModify" 1
  76. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoRepair" 1
  77. Call GetInstalledSize
  78. Pop $0
  79. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "EstimatedSize" "$0"
  80. # Create uninstaller
  81. writeUninstaller "$INSTDIR\uninstall.exe"
  82. functionEnd
  83. Page components
  84. Page directory
  85. Page instfiles