2
0
mirror of https://github.com/linka-cloud/d2vm.git synced 2024-11-26 09:36:25 +00:00

run/hetzner: rollback sparsecat using outside linux

Makefile: compute tag: ignore dirty state

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2022-09-11 04:01:05 +02:00
parent c97388fdae
commit bf88399b58
Signed by: adphi
GPG Key ID: 46BE4062DB2397FF
2 changed files with 7 additions and 2 deletions

View File

@ -16,7 +16,7 @@ MODULE = go.linka.cloud/d2vm
REPOSITORY = linkacloud 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_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) 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: show-version:

View File

@ -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) logrus.Debugf("$ %s", cmd)
if b, err := wses.CombinedOutput(cmd); err != nil { if b, err := wses.CombinedOutput(cmd); err != nil {
return fmt.Errorf("%v: %s", err, string(b)) return fmt.Errorf("%v: %s", err, string(b))