Skip to content

Commit

Permalink
cmd/release: notify explorer of PATH update after install on Win
Browse files Browse the repository at this point in the history
Windows installer will not broadcast WM_SETTINGCHANGE when a reboot is
pending. This message is required for explorer.exe to reload the PATH
from the registry so future cmd.exe processes will launch with go/bin in
the PATH.

- Updated to wix v3.11[1]
- Added sha256 validation of wix binary after download
- Use the Wix extension[0] to always broadcast WM_SETTINGCHANGE after install.
- Removed to RegistryKey/@action in installer.wxs suppress warning CNDL1138.
  The param is deperacated and not needed.

[0] http://wixtoolset.org/documentation/manual/v3/customactions/wixsettingchange.html
[1] https://github.com/wixtoolset/wix3/releases/tag/wix311rtm

Fixes golang/go#18680

Change-Id: I645b1e4a32bf0c1df2925d53474a38a7d7ddec94
Reviewed-on: https://go-review.googlesource.com/46458
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
johnsonj authored and bradfitz committed Jun 22, 2017
1 parent 49954a5 commit fb385a2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cmd/release/releaselet.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ package main
import (
"archive/zip"
"bytes"
"crypto/sha256"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
Expand Down Expand Up @@ -291,7 +293,8 @@ func windowsMSI() error {
)
}

const wixBinaries = "https://storage.googleapis.com/go-builder-data/wix35-binaries.zip"
const wixBinaries = "https://storage.googleapis.com/go-builder-data/wix311-binaries.zip"
const wixSha256 = "da034c489bd1dd6d8e1623675bf5e899f32d74d6d8312f8dd125a084543193de"

// installWix fetches and installs the wix toolkit to the specified path.
func installWix(path string) error {
Expand All @@ -301,6 +304,12 @@ func installWix(path string) error {
return err
}

// Verify sha256
sum := sha256.Sum256(body)
if fmt.Sprintf("%x", sum) != wixSha256 {
return errors.New("sha256 mismatch for wix toolkit")
}

// Unzip to path.
zr, err := zip.NewReader(bytes.NewReader(body), int64(len(body)))
if err != nil {
Expand Down Expand Up @@ -632,8 +641,7 @@ var windowsData = map[string]string{
<Component Id="Component_GoEnvironment" Guid="{3ec7a4d5-eb08-4de7-9312-2df392c45993}">
<RegistryKey
Root="HKCU"
Key="Software\GoProgrammingLanguage"
Action="create" >
Key="Software\GoProgrammingLanguage">
<RegistryValue
Name="installed"
Type="integer"
Expand Down Expand Up @@ -681,6 +689,9 @@ var windowsData = map[string]string{
<Custom Action="SetApplicationRootDirectory" Before="InstallFinalize" />
</InstallExecuteSequence>
<!-- Notify top level applications of the new PATH variable (golang.org/issue/18680) -->
<CustomActionRef Id="WixBroadcastEnvironmentChange" />
<!-- Include the user interface -->
<WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="images\Banner.jpg" />
Expand Down

0 comments on commit fb385a2

Please sign in to comment.