Skip to content

Commit 821c326

Browse files
anjannathgbraad
authored andcommitted
Issue #396 Add windows target to embed bundle in the binary
Don't show an warning message if the bundle was passed to crc start command. If no bundle was passed to start command, ask user to run setup command to unpack the bundle to disk
1 parent 35a5bae commit 821c326

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fmtcheck: ## Checks for style violation using gofmt
127127
@gofmt -l $(SOURCE_DIRS) | grep ".*\.go"; if [ "$$?" = "0" ]; then exit 1; fi
128128

129129
.PHONY: release
130-
release: clean fmtcheck cross
130+
release: clean fmtcheck embed_bundle
131131
mkdir $(RELEASE_DIR)
132132

133133
@mkdir -p $(BUILD_DIR)/crc-$(CRC_VERSION)-darwin-amd64
@@ -148,3 +148,4 @@ embed_bundle: cross binappend
148148
@$(call check_defined, BUNDLE_DIR, "Embedding bundle requires BUNDLE_DIR set to a directory containing CRC bundles for all hypervisors")
149149
binappend-cli write $(BUILD_DIR)/linux-amd64/crc $(BUNDLE_DIR)/crc_libvirt_$(BUNDLE_VERSION).$(BUNDLE_EXTENSION)
150150
binappend-cli write $(BUILD_DIR)/darwin-amd64/crc $(BUNDLE_DIR)/crc_hyperkit_$(BUNDLE_VERSION).$(BUNDLE_EXTENSION)
151+
binappend-cli write $(BUILD_DIR)/windows-amd64/crc.exe $(BUNDLE_DIR)/crc_hyperv_$(BUNDLE_VERSION).$(BUNDLE_EXTENSION)

pkg/crc/preflight/preflight_checks_common.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import (
88
"github.com/YourFin/binappend"
99
"github.com/kardianos/osext"
1010

11+
cmdConfig "github.com/code-ready/crc/cmd/crc/cmd/config"
12+
"github.com/code-ready/crc/pkg/crc/config"
1113
"github.com/code-ready/crc/pkg/crc/constants"
1214
)
1315

1416
func checkBundleCached() (bool, error) {
15-
if _, err := os.Stat(constants.DefaultBundlePath); os.IsNotExist(err) {
17+
if _, err := os.Stat(config.GetString(cmdConfig.Bundle.Name)); os.IsNotExist(err) {
1618
return false, err
1719
}
1820
return true, nil

pkg/crc/validation/validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func ValidateMemory(value int) error {
4343
// ValidateBundle checks if provided bundle path exist
4444
func ValidateBundle(bundle string) error {
4545
if err := ValidatePath(bundle); err != nil {
46-
return err
46+
return errors.Newf("Run 'crc setup' to unpack the bundle to disk.")
4747
}
4848
// Check if the version of the bundle provided by user is same as what is released with crc.
4949
releaseBundleVersion := version.GetBundleVersion()

0 commit comments

Comments
 (0)