github.com/SmartMeshFoundation/Spectrum@v0.0.0-20220621030607-452a266fee1e/build/nsis.geth.nsi (about)

     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  
    32  !define GROUPNAME "Ethereum"
    33  !define APPNAME "Geth"
    34  !define DESCRIPTION "Official Go implementation of the Ethereum protocol"
    35  !addplugindir .\
    36  
    37  # Require admin rights on NT6+ (When UAC is turned on)
    38  RequestExecutionLevel admin
    39  
    40  # Use LZMA compression
    41  SetCompressor /SOLID lzma
    42  
    43  !include LogicLib.nsh
    44  !include PathUpdate.nsh
    45  !include EnvVarUpdate.nsh
    46  
    47  !macro VerifyUserIsAdmin
    48  UserInfo::GetAccountType
    49  pop $0
    50  ${If} $0 != "admin" # Require admin rights on NT4+
    51    messageBox mb_iconstop "Administrator rights required!"
    52    setErrorLevel 740 # ERROR_ELEVATION_REQUIRED
    53    quit
    54  ${EndIf}
    55  !macroend
    56  
    57  function .onInit
    58    # make vars are global for all users since geth is installed global
    59    setShellVarContext all
    60    !insertmacro VerifyUserIsAdmin
    61  
    62    ${If} ${ARCH} == "amd64"
    63      StrCpy $InstDir "$PROGRAMFILES64\${APPNAME}"
    64    ${Else}
    65      StrCpy $InstDir "$PROGRAMFILES32\${APPNAME}"
    66    ${Endif}
    67  functionEnd
    68  
    69  !include install.nsh
    70  !include uninstall.nsh