nsis.geth.nsi 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Builds a Windows installer with NSIS.
  2. # It expects the following command line arguments:
  3. # - OUTPUTFILE, filename of the installer (without extension)
  4. # - MAJORVERSION, major build version
  5. # - MINORVERSION, minor build version
  6. # - BUILDVERSION, build id version
  7. #
  8. # The created installer executes the following steps:
  9. # 1. install geth for all users
  10. # 2. install optional development tools such as abigen
  11. # 3. create an uninstaller
  12. # 4. configures the Windows firewall for geth
  13. # 5. create geth, attach and uninstall start menu entries
  14. # 6. configures the registry that allows Windows to manage the package through its platform tools
  15. # 7. adds the environment system wide variable ETHEREUM_SOCKET
  16. # 8. adds the install directory to %PATH%
  17. #
  18. # Requirements:
  19. # - NSIS, http://nsis.sourceforge.net/Main_Page
  20. # - NSIS Large Strings build, http://nsis.sourceforge.net/Special_Builds
  21. # - SFP, http://nsis.sourceforge.net/NSIS_Simple_Firewall_Plugin (put dll in NSIS\Plugins\x86-ansi)
  22. #
  23. # After intalling NSIS extra the NSIS Large Strings build zip and replace the makensis.exe and the
  24. # files found in Stub.
  25. #
  26. # based on: http://nsis.sourceforge.net/A_simple_installer_with_start_menu_shortcut_and_uninstaller
  27. #
  28. # TODO:
  29. # - sign installer
  30. CRCCheck on
  31. !define GROUPNAME "Ethereum"
  32. !define APPNAME "Geth"
  33. !define DESCRIPTION "Official Go implementation of the Ethereum protocol"
  34. !addplugindir .\
  35. # Require admin rights on NT6+ (When UAC is turned on)
  36. RequestExecutionLevel admin
  37. # Use LZMA compression
  38. SetCompressor /SOLID lzma
  39. !include LogicLib.nsh
  40. !include PathUpdate.nsh
  41. !include EnvVarUpdate.nsh
  42. !macro VerifyUserIsAdmin
  43. UserInfo::GetAccountType
  44. pop $0
  45. ${If} $0 != "admin" # Require admin rights on NT4+
  46. messageBox mb_iconstop "Administrator rights required!"
  47. setErrorLevel 740 # ERROR_ELEVATION_REQUIRED
  48. quit
  49. ${EndIf}
  50. !macroend
  51. function .onInit
  52. # make vars are global for all users since geth is installed global
  53. setShellVarContext all
  54. !insertmacro VerifyUserIsAdmin
  55. ${If} ${ARCH} == "amd64"
  56. StrCpy $InstDir "$PROGRAMFILES64\${APPNAME}"
  57. ${Else}
  58. StrCpy $InstDir "$PROGRAMFILES32\${APPNAME}"
  59. ${Endif}
  60. functionEnd
  61. !include install.nsh
  62. !include uninstall.nsh