Skip to content

Commit

Permalink
run/hetzner: rollback sparsecat using outside linux
Browse files Browse the repository at this point in the history
Makefile: compute tag: ignore dirty state

Signed-off-by: Adphi <[email protected]>
  • Loading branch information
Adphi committed Sep 11, 2022
1 parent c97388f commit bf88399
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MODULE = go.linka.cloud/d2vm

REPOSITORY = linkacloud

TAG = $(shell git describe --tags --exact-match 2> /dev/null)
TAG = $(shell git diff --quiet && git describe --tags --exact-match 2> /dev/null)
VERSION_SUFFIX = $(shell git diff --quiet || echo "-dev")
VERSION = $(shell git describe --tags --exact-match 2> /dev/null || echo "`git describe --tags $$(git rev-list --tags --max-count=1) 2> /dev/null || echo v0.0.0`-`git rev-parse --short HEAD`")$(VERSION_SUFFIX)
show-version:
Expand Down
7 changes: 6 additions & 1 deletion cmd/d2vm/run/hetzner.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,12 @@ func runHetzner(ctx context.Context, imgPath string, stdin io.Reader, stderr io.
}
}
}()
cmd := fmt.Sprintf("%s -r -disable-sparse-target -of %s", sparsecatPath, vmBlockPath)
var cmd string
if runtime.GOOS == "linux" {
cmd = fmt.Sprintf("%s -r -disable-sparse-target -of %s", sparsecatPath, vmBlockPath)
} else {
cmd = fmt.Sprintf("dd of=%s", vmBlockPath)
}
logrus.Debugf("$ %s", cmd)
if b, err := wses.CombinedOutput(cmd); err != nil {
return fmt.Errorf("%v: %s", err, string(b))
Expand Down

0 comments on commit bf88399

Please sign in to comment.