github.com/elastos/Elastos.ELA.SideChain.ETH@v0.2.2/build/nsis.install.nsh (about)

     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  
     5  # Links for "Add/Remove Programs"
     6  !define HELPURL "https://github.com/elastos/Elastos.ELA.SideChain.ESC/issues"
     7  !define UPDATEURL "https://github.com/elastos/Elastos.ELA.SideChain.ESC/releases"
     8  !define ABOUTURL "https://github.com/elastos/Elastos.ELA.SideChain.ESC#ethereum-go"
     9  !define /date NOW "%Y%m%d"
    10  
    11  PageEx license
    12    LicenseData {{.License}}
    13  PageExEnd
    14  
    15  # Install geth binary
    16  Section "Geth" GETH_IDX
    17    SetOutPath $INSTDIR
    18    file {{.Geth}}
    19  
    20    # Create start menu launcher
    21    createDirectory "$SMPROGRAMS\${APPNAME}"
    22    createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\geth.exe" "--fast" "--cache=512"
    23    createShortCut "$SMPROGRAMS\${APPNAME}\Attach.lnk" "$INSTDIR\geth.exe" "attach" "" ""
    24    createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "" ""
    25  
    26    # Firewall - remove rules (if exists)
    27    SimpleFC::AdvRemoveRule "Geth incoming peers (TCP:20638)"
    28    SimpleFC::AdvRemoveRule "Geth outgoing peers (TCP:20638)"
    29    SimpleFC::AdvRemoveRule "Geth UDP discovery (UDP:20638)"
    30  
    31    # Firewall - add rules
    32    SimpleFC::AdvAddRule "Geth incoming peers (TCP:20638)" ""  6 1 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" 20638 "" "" ""
    33    SimpleFC::AdvAddRule "Geth outgoing peers (TCP:20638)" ""  6 2 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" "" 20638 "" ""
    34    SimpleFC::AdvAddRule "Geth UDP discovery (UDP:20638)" "" 17 2 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" "" 20638 "" ""
    35  
    36    # Set default IPC endpoint (https://github.com/elastos/EIPs/issues/147)
    37    ${EnvVarUpdate} $0 "ETHEREUM_SOCKET" "R" "HKLM" "\\.\pipe\geth.ipc"
    38    ${EnvVarUpdate} $0 "ETHEREUM_SOCKET" "A" "HKLM" "\\.\pipe\geth.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} ${GETH_IDX}
    58      SectionGetSize ${GETH_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