added installer shell script and additional steps

This commit is contained in:
tumillanino
2025-10-28 22:53:15 +11:00
parent 6f1a6f6efa
commit 27ca5a9426
11 changed files with 644 additions and 0 deletions

46
Makefile Normal file
View File

@@ -0,0 +1,46 @@
.PHONY: build clean install release
BINARY_NAME=miasma-installer
BUILD_DIR=build
VERSION?=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS=-ldflags "-X main.Version=$(VERSION)"
build:
@echo "Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_DIR)
go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) .
@echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)"
clean:
@echo "Cleaning..."
@rm -rf $(BUILD_DIR)
@go clean
install: build
@echo "Installing to /usr/local/bin..."
@sudo cp $(BUILD_DIR)/$(BINARY_NAME) /usr/local/bin/
@sudo chmod +x /usr/local/bin/$(BINARY_NAME)
@echo "Installed successfully"
release:
@echo "Building release binary..."
@mkdir -p $(BUILD_DIR)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -a -installsuffix cgo -o $(BUILD_DIR)/$(BINARY_NAME) .
@strip $(BUILD_DIR)/$(BINARY_NAME)
@echo "Release build complete: $(BUILD_DIR)/$(BINARY_NAME)"
@ls -lh $(BUILD_DIR)/$(BINARY_NAME)
run: build
@$(BUILD_DIR)/$(BINARY_NAME)
test:
go test ./...
fmt:
go fmt ./...
vet:
go vet ./...
tidy:
go mod tidy