aboutsummaryrefslogtreecommitdiffstats
path: root/build/nsis.install.nsh
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-11-09 05:55:39 +0800
committerFelix Lange <fjl@twurst.com>2016-11-09 05:55:39 +0800
commit9bc97a5785d3d350a084b46fc77a8439b8dc533b (patch)
tree1802db150e1fed6272e08dd17b85a8a188ee55c8 /build/nsis.install.nsh
parent6707f70b4a947a06fdcf564619e6c8220a6654ad (diff)
downloadgo-tangerine-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar
go-tangerine-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.gz
go-tangerine-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.bz2
go-tangerine-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.lz
go-tangerine-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.xz
go-tangerine-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.zst
go-tangerine-9bc97a5785d3d350a084b46fc77a8439b8dc533b.zip
build: NSIS based Windows installer (#3240)
This commit adds support for creating Windows installers to ci.go
Diffstat (limited to 'build/nsis.install.nsh')
-rw-r--r--build/nsis.install.nsh102
1 files changed, 102 insertions, 0 deletions
diff --git a/build/nsis.install.nsh b/build/nsis.install.nsh
new file mode 100644
index 000000000..f9ad8e95e
--- /dev/null
+++ b/build/nsis.install.nsh
@@ -0,0 +1,102 @@
+Name "geth ${MAJORVERSION}.${MINORVERSION}.${BUILDVERSION}" # VERSION variables set through command line arguments
+InstallDir "$InstDir"
+OutFile "${OUTPUTFILE}" # set through command line arguments
+
+# Links for "Add/Remove Programs"
+!define HELPURL "https://github.com/ethereum/go-ethereum/issues"
+!define UPDATEURL "https://github.com/ethereum/go-ethereum/releases"
+!define ABOUTURL "https://github.com/ethereum/go-ethereum#ethereum-go"
+!define /date NOW "%Y%m%d"
+
+PageEx license
+ LicenseData {{.License}}
+PageExEnd
+
+# Install geth binary
+Section "Geth" GETH_IDX
+ SetOutPath $INSTDIR
+ file {{.Geth}}
+
+ # Create start menu launcher
+ createDirectory "$SMPROGRAMS\${APPNAME}"
+ createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\geth.exe" "--fast" "--cache=512"
+ createShortCut "$SMPROGRAMS\${APPNAME}\Attach.lnk" "$INSTDIR\geth.exe" "attach" "" ""
+ createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "" ""
+
+ # Firewall - remove rules (if exists)
+ SimpleFC::AdvRemoveRule "Geth incoming peers (TCP:30303)"
+ SimpleFC::AdvRemoveRule "Geth outgoing peers (TCP:30303)"
+ SimpleFC::AdvRemoveRule "Geth UDP discovery (UDP:30303)"
+
+ # Firewall - add rules
+ SimpleFC::AdvAddRule "Geth incoming peers (TCP:30303)" "" 6 1 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" 30303 "" "" ""
+ SimpleFC::AdvAddRule "Geth outgoing peers (TCP:30303)" "" 6 2 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" "" 30303 "" ""
+ SimpleFC::AdvAddRule "Geth UDP discovery (UDP:30303)" "" 17 2 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" "" 30303 "" ""
+
+ # Set default IPC endpoint (https://github.com/ethereum/EIPs/issues/147)
+ ${EnvVarUpdate} $0 "ETHEREUM_SOCKET" "R" "HKLM" "\\.\pipe\geth.ipc"
+ ${EnvVarUpdate} $0 "ETHEREUM_SOCKET" "A" "HKLM" "\\.\pipe\geth.ipc"
+
+ # Add geth to PATH
+ ${EnvVarUpdate} $0 "PATH" "A" "HKLM" $INSTDIR
+SectionEnd
+
+# Install optional develop tools.
+Section /o "Development tools" DEV_TOOLS_IDX
+ SetOutPath $INSTDIR
+ {{range .DevTools}}file {{.}}
+ {{end}}
+SectionEnd
+
+# Return on top of stack the total size (as DWORD) of the selected/installed sections.
+Var GetInstalledSize.total
+Function GetInstalledSize
+ StrCpy $GetInstalledSize.total 0
+
+ ${if} ${SectionIsSelected} ${GETH_IDX}
+ SectionGetSize ${GETH_IDX} $0
+ IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
+ ${endif}
+
+ ${if} ${SectionIsSelected} ${DEV_TOOLS_IDX}
+ SectionGetSize ${DEV_TOOLS_IDX} $0
+ IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
+ ${endif}
+
+ IntFmt $GetInstalledSize.total "0x%08X" $GetInstalledSize.total
+ Push $GetInstalledSize.total
+FunctionEnd
+
+# Write registry, Windows uses these values in various tools such as add/remove program.
+# PowerShell: Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, InstallLocation, InstallDate | Format-Table –AutoSize
+function .onInstSuccess
+ # Save information in registry in HKEY_LOCAL_MACHINE branch, Windows add/remove functionality depends on this
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayName" "${GROUPNAME} - ${APPNAME} - ${DESCRIPTION}"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallLocation" "$INSTDIR"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallDate" "${NOW}"
+ # Wait for Alex
+ #WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\logo.ico$\""
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "Publisher" "${GROUPNAME}"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "HelpLink" "${HELPURL}"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLUpdateInfo" "${UPDATEURL}"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLInfoAbout" "${ABOUTURL}"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayVersion" "${MAJORVERSION}.${MINORVERSION}.${BUILDVERSION}"
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMajor" ${MAJORVERSION}
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMinor" ${MINORVERSION}
+ # There is no option for modifying or repairing the install
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoModify" 1
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoRepair" 1
+
+ Call GetInstalledSize
+ Pop $0
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "EstimatedSize" "$0"
+
+ # Create uninstaller
+ writeUninstaller "$INSTDIR\uninstall.exe"
+functionEnd
+
+Page components
+Page directory
+Page instfiles