Skip to content

Commit

Permalink
[Release] 4.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Akkadius committed Jun 17, 2024
1 parent a6c2dfe commit 7c716c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [4.8.7] 6/16/2024

**Updating** Potential fixes for certain windows users during automatic updating.

## [4.8.6] 6/16/2024

**Spire Admin** Fix issue under unauthenticated local installations where websocket connections would get caught in an authorization loop, spamming the console. Unauthenticated Spire installations will now work properly.
Expand Down
13 changes: 9 additions & 4 deletions internal/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package updater
import (
"bufio"
"context"
"crypto/md5"
"encoding/json"
"fmt"
"github.com/Akkadius/spire/internal/download"
Expand Down Expand Up @@ -177,19 +178,23 @@ func (s *Updater) CheckForUpdates(interactive bool) bool {
Msg("Checking asset")

if assetName == targetFileNameZipped {
hash := fmt.Sprintf("%x", md5.Sum([]byte(downloadUrl)))
tmpdir := filepath.Join(os.TempDir(), "spire-update", hash)
_ = os.MkdirAll(tmpdir, os.ModePerm)

s.logger.Info().Any("assetName", assetName).Msg("Found matching release")

// download
file := path.Base(downloadUrl)
downloadPath := filepath.Join(os.TempDir(), file)
downloadPath := filepath.Join(tmpdir, file)
err := download.WithProgress(downloadPath, downloadUrl)
if err != nil {
s.logger.Fatal().Err(err).Msg("Failed to download asset")
}

// unzip
tempFileZipped := filepath.Join(os.TempDir(), targetFileNameZipped)
err = s.unzipper.Extract(tempFileZipped, os.TempDir())
tempFileZipped := filepath.Join(tmpdir, targetFileNameZipped)
err = s.unzipper.Extract(tempFileZipped, tmpdir)
if err != nil {
s.logger.Fatal().Err(err).Msg("Failed to extract zip")
}
Expand All @@ -204,7 +209,7 @@ func (s *Updater) CheckForUpdates(interactive bool) bool {
}

// relink
lookTempFile := filepath.Join(os.TempDir(), targetFileName)
lookTempFile := filepath.Join(tmpdir, targetFileName)
tempFile, err := exec.LookPath(lookTempFile)
if err != nil {
s.logger.Fatal().Err(err).Msg("Failed to find executable")
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spire",
"version": "4.8.6",
"version": "4.8.7",
"repository": {
"type": "git",
"url": "https://github.com/Akkadius/spire.git"
Expand Down

0 comments on commit 7c716c5

Please sign in to comment.