• bas-vk's avatar
    build: safe update of PATH on Windows (#3419) · 4f9ccdd7
    bas-vk authored
    NSIS has a default MAX_STR_LEN of 1024. If $ENV{PATH} is longer
    the returned string is truncated to an empty string. Its then not
    possible to distinguis between the variable not set or too long.
    As a result the variable is set with the location where geth and/or
    dev tools are installed. This may override any previous set values.
    4f9ccdd7
nsis.uninstall.nsh 1.02 KB
Section "Uninstall"
  # uninstall for all users
  setShellVarContext all

  # Delete (optionally) installed files
  {{range $}}Delete $INSTDIR\{{.}}
  {{end}}
  Delete $INSTDIR\uninstall.exe

  # Delete install directory
  rmDir $INSTDIR

  # Delete start menu launcher
  Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
  Delete "$SMPROGRAMS\${APPNAME}\Attach.lnk"
  Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
  rmDir "$SMPROGRAMS\${APPNAME}"

  # 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)"

  # Remove IPC endpoint (https://github.com/ethereum/EIPs/issues/147)
  ${un.EnvVarUpdate} $0 "ETHEREUM_SOCKET" "R" "HKLM" "\\.\pipe\geth.ipc"

  # Remove install directory from PATH
  Push "$INSTDIR"
  Call un.RemoveFromPath

  # Cleanup registry (deletes all sub keys)
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}"
SectionEnd