detached 68831a0

refactor(build): replace Go build system with shell linting toolchain

commit
68831a0217490e1549646a93b136ddb1c9c1f354
author
bnema · · 2025-10-29 17:38 UTC
parent
2c16e50
signature
GPG Unverified2B82207D370127A0 The key is unknown
1 file · +52 -106
M Makefile +52 -106 mode 100644 → 100755
@@ -1,110 +1,56 @@
1-# ArchUp Go Installer Makefile
2-# Builds the Go-based installer with proper version injection
1+.PHONY: check check-syntax check-shellcheck clean help
32
4-# Get version from git tag or use dev
5-VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
6-# Append branch name if not on main
7-CURRENT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
8-ifeq ($(CURRENT_BRANCH),dev)
9- VERSION := $(VERSION)-dev
10-endif
11-LDFLAGS := -ldflags "-X main.version=$(VERSION)"
12-LDFLAGS_STRIP := -ldflags "-X main.version=$(VERSION) -s -w"
13-
14-# Build settings
15-BINARY_NAME := archup-installer
16-BUILD_DIR := build
17-CMD_DIR := cmd/archup-installer
18-INSTALL_DIR := /usr/local/bin
19-
20-# Go build flags
21-GOFLAGS := -trimpath
22-CGO_ENABLED := 0
23-
24-.PHONY: all build clean install uninstall run test fmt vet lint mod-tidy help
25-
26-all: build
27-
28-## build: Build the installer binary with version injection
29-build:
30- @echo "Building $(BINARY_NAME) $(VERSION)..."
31- @mkdir -p $(BUILD_DIR)
32- CGO_ENABLED=$(CGO_ENABLED) go build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR)
33- @echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)"
34-
35-## build-release: Build optimized release binary (stripped, smaller size)
36-build-release:
37- @echo "Building release $(BINARY_NAME) $(VERSION)..."
38- @mkdir -p $(BUILD_DIR)
39- CGO_ENABLED=0 go build $(GOFLAGS) $(LDFLAGS_STRIP) -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR)
40- @echo "Release build complete: $(BUILD_DIR)/$(BINARY_NAME)"
41- @ls -lh $(BUILD_DIR)/$(BINARY_NAME)
42-
43-## build-static: Build fully static binary (no dependencies)
44-build-static:
45- @echo "Building static $(BINARY_NAME) $(VERSION)..."
46- @mkdir -p $(BUILD_DIR)
47- CGO_ENABLED=0 go build $(GOFLAGS) $(LDFLAGS) -a -installsuffix cgo -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR)
48- @echo "Static build complete: $(BUILD_DIR)/$(BINARY_NAME)"
49-
50-## install: Install the binary to system
51-install: build
52- @echo "Installing $(BINARY_NAME) to $(INSTALL_DIR)..."
53- @sudo install -m 755 $(BUILD_DIR)/$(BINARY_NAME) $(INSTALL_DIR)/$(BINARY_NAME)
54- @echo "Installed successfully"
55-
56-## uninstall: Remove the binary from system
57-uninstall:
58- @echo "Uninstalling $(BINARY_NAME)..."
59- @sudo rm -f $(INSTALL_DIR)/$(BINARY_NAME)
60- @echo "Uninstalled successfully"
61-
62-## run: Build and run the installer
63-run: build
64- @echo "Running $(BINARY_NAME)..."
65- @$(BUILD_DIR)/$(BINARY_NAME)
66-
67-## test: Run tests
68-test:
69- @echo "Running tests..."
70- @go test -v -race -coverprofile=coverage.out ./...
71- @go tool cover -func=coverage.out
72-
73-## fmt: Format all Go code
74-fmt:
75- @echo "Formatting code..."
76- @go fmt ./...
77- @gofmt -s -w .
78-
79-## vet: Run go vet
80-vet:
81- @echo "Running go vet..."
82- @go vet ./...
83-
84-## lint: Run golangci-lint (install with: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
85-lint:
86- @echo "Running golangci-lint..."
87- @which golangci-lint > /dev/null || (echo "golangci-lint not installed. Install with: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest" && exit 1)
88- @golangci-lint run ./...
3+# Default target
4+help:
5+ @echo "archup - Makefile targets:"
6+ @echo ""
7+ @echo " make check - Run all checks (syntax + shellcheck)"
8+ @echo " make check-syntax - Check shell script syntax with bash -n"
9+ @echo " make check-shellcheck - Run shellcheck linting"
10+ @echo " make clean - Remove generated files"
11+ @echo ""
8912
90-## mod-tidy: Tidy go.mod
91-mod-tidy:
92- @echo "Tidying go.mod..."
93- @go mod tidy
13+# Run all checks
14+check: check-syntax check-shellcheck
15+ @echo ""
16+ @echo "✓ All checks passed!"
17+
18+# Check syntax with bash -n
19+check-syntax:
20+ @echo "========================================="
21+ @echo "Checking shell script syntax..."
22+ @echo "========================================="
23+ @for script in install.sh install/bootstrap.sh install/helpers/*.sh install/preflight/*.sh install/partitioning/*.sh install/base/*.sh install/config/*.sh install/boot/*.sh install/repos/*.sh install/post-install/*.sh install/post-boot/*.sh; do \
24+ if [ -f "$$script" ]; then \
25+ echo "Checking: $$script"; \
26+ bash -n "$$script" || exit 1; \
27+ fi \
28+ done
29+ @echo "✓ Syntax check passed"
30+
31+# Run shellcheck
32+check-shellcheck:
33+ @echo ""
34+ @echo "========================================="
35+ @echo "Running shellcheck..."
36+ @echo "========================================="
37+ @if ! command -v shellcheck >/dev/null 2>&1; then \
38+ echo "⚠ shellcheck not found, skipping..."; \
39+ echo "Install with: sudo pacman -S shellcheck"; \
40+ exit 0; \
41+ fi
42+ @for script in install.sh install/bootstrap.sh install/helpers/*.sh install/preflight/*.sh install/partitioning/*.sh install/base/*.sh install/config/*.sh install/boot/*.sh install/repos/*.sh install/post-install/*.sh install/post-boot/*.sh; do \
43+ if [ -f "$$script" ]; then \
44+ echo ""; \
45+ echo "Checking: $$script"; \
46+ shellcheck --exclude=SC1090,SC1091,SC2086,SC2004,SC2059,SC2129,SC2155 "$$script" || exit 1; \
47+ fi \
48+ done
49+ @echo ""
50+ @echo "✓ shellcheck passed"
9451
95-## clean: Remove build artifacts
52+# Clean generated files
9653 clean:
97- @echo "Cleaning build artifacts..."
98- @rm -rf $(BUILD_DIR)
99- @rm -f coverage.out
100- @echo "Clean complete"
101-
102-## version: Show version information
103-version:
104- @echo "Version: $(VERSION)"
105-
106-## help: Show this help message
107-help:
108- @echo "ArchUp Go Installer - Makefile Commands"
109- @echo ""
110- @sed -n 's/^##//p' $(MAKEFILE_LIST) | column -t -s ':' | sed -e 's/^/ /'
54+ @echo "Cleaning generated files..."
55+ @rm -f /var/log/archup-install.log
56+ @echo "✓ Clean complete"
@@ -1,110 +1,56 @@
1-# ArchUp Go Installer Makefile1+.PHONY: check check-syntax check-shellcheck clean help
2-# Builds the Go-based installer with proper version injection
3 2
4-# Get version from git tag or use dev3+# Default target
5-VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")4+help:
6-# Append branch name if not on main5+ @echo "archup - Makefile targets:"
7-CURRENT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)6+ @echo ""
8-ifeq ($(CURRENT_BRANCH),dev)7+ @echo " make check - Run all checks (syntax + shellcheck)"
9- VERSION := $(VERSION)-dev8+ @echo " make check-syntax - Check shell script syntax with bash -n"
10-endif9+ @echo " make check-shellcheck - Run shellcheck linting"
11-LDFLAGS := -ldflags "-X main.version=$(VERSION)"10+ @echo " make clean - Remove generated files"
12-LDFLAGS_STRIP := -ldflags "-X main.version=$(VERSION) -s -w"11+ @echo ""
13-
14-# Build settings
15-BINARY_NAME := archup-installer
16-BUILD_DIR := build
17-CMD_DIR := cmd/archup-installer
18-INSTALL_DIR := /usr/local/bin
19-
20-# Go build flags
21-GOFLAGS := -trimpath
22-CGO_ENABLED := 0
23-
24-.PHONY: all build clean install uninstall run test fmt vet lint mod-tidy help
25-
26-all: build
27-
28-## build: Build the installer binary with version injection
29-build:
30- @echo "Building $(BINARY_NAME) $(VERSION)..."
31- @mkdir -p $(BUILD_DIR)
32- CGO_ENABLED=$(CGO_ENABLED) go build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR)
33- @echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)"
34-
35-## build-release: Build optimized release binary (stripped, smaller size)
36-build-release:
37- @echo "Building release $(BINARY_NAME) $(VERSION)..."
38- @mkdir -p $(BUILD_DIR)
39- CGO_ENABLED=0 go build $(GOFLAGS) $(LDFLAGS_STRIP) -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR)
40- @echo "Release build complete: $(BUILD_DIR)/$(BINARY_NAME)"
41- @ls -lh $(BUILD_DIR)/$(BINARY_NAME)
42-
43-## build-static: Build fully static binary (no dependencies)
44-build-static:
45- @echo "Building static $(BINARY_NAME) $(VERSION)..."
46- @mkdir -p $(BUILD_DIR)
47- CGO_ENABLED=0 go build $(GOFLAGS) $(LDFLAGS) -a -installsuffix cgo -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR)
48- @echo "Static build complete: $(BUILD_DIR)/$(BINARY_NAME)"
49-
50-## install: Install the binary to system
51-install: build
52- @echo "Installing $(BINARY_NAME) to $(INSTALL_DIR)..."
53- @sudo install -m 755 $(BUILD_DIR)/$(BINARY_NAME) $(INSTALL_DIR)/$(BINARY_NAME)
54- @echo "Installed successfully"
55-
56-## uninstall: Remove the binary from system
57-uninstall:
58- @echo "Uninstalling $(BINARY_NAME)..."
59- @sudo rm -f $(INSTALL_DIR)/$(BINARY_NAME)
60- @echo "Uninstalled successfully"
61-
62-## run: Build and run the installer
63-run: build
64- @echo "Running $(BINARY_NAME)..."
65- @$(BUILD_DIR)/$(BINARY_NAME)
66-
67-## test: Run tests
68-test:
69- @echo "Running tests..."
70- @go test -v -race -coverprofile=coverage.out ./...
71- @go tool cover -func=coverage.out
72-
73-## fmt: Format all Go code
74-fmt:
75- @echo "Formatting code..."
76- @go fmt ./...
77- @gofmt -s -w .
78-
79-## vet: Run go vet
80-vet:
81- @echo "Running go vet..."
82- @go vet ./...
83-
84-## lint: Run golangci-lint (install with: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
85-lint:
86- @echo "Running golangci-lint..."
87- @which golangci-lint > /dev/null || (echo "golangci-lint not installed. Install with: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest" && exit 1)
88- @golangci-lint run ./...
89 12
90-## mod-tidy: Tidy go.mod13+# Run all checks
91-mod-tidy:14+check: check-syntax check-shellcheck
92- @echo "Tidying go.mod..."15+ @echo ""
93- @go mod tidy16+ @echo "✓ All checks passed!"
17+
18+# Check syntax with bash -n
19+check-syntax:
20+ @echo "========================================="
21+ @echo "Checking shell script syntax..."
22+ @echo "========================================="
23+ @for script in install.sh install/bootstrap.sh install/helpers/*.sh install/preflight/*.sh install/partitioning/*.sh install/base/*.sh install/config/*.sh install/boot/*.sh install/repos/*.sh install/post-install/*.sh install/post-boot/*.sh; do \
24+ if [ -f "$$script" ]; then \
25+ echo "Checking: $$script"; \
26+ bash -n "$$script" || exit 1; \
27+ fi \
28+ done
29+ @echo "✓ Syntax check passed"
30+
31+# Run shellcheck
32+check-shellcheck:
33+ @echo ""
34+ @echo "========================================="
35+ @echo "Running shellcheck..."
36+ @echo "========================================="
37+ @if ! command -v shellcheck >/dev/null 2>&1; then \
38+ echo "⚠ shellcheck not found, skipping..."; \
39+ echo "Install with: sudo pacman -S shellcheck"; \
40+ exit 0; \
41+ fi
42+ @for script in install.sh install/bootstrap.sh install/helpers/*.sh install/preflight/*.sh install/partitioning/*.sh install/base/*.sh install/config/*.sh install/boot/*.sh install/repos/*.sh install/post-install/*.sh install/post-boot/*.sh; do \
43+ if [ -f "$$script" ]; then \
44+ echo ""; \
45+ echo "Checking: $$script"; \
46+ shellcheck --exclude=SC1090,SC1091,SC2086,SC2004,SC2059,SC2129,SC2155 "$$script" || exit 1; \
47+ fi \
48+ done
49+ @echo ""
50+ @echo "✓ shellcheck passed"
94 51
95-## clean: Remove build artifacts52+# Clean generated files
96 clean:53 clean:
97- @echo "Cleaning build artifacts..."54+ @echo "Cleaning generated files..."
98- @rm -rf $(BUILD_DIR)55+ @rm -f /var/log/archup-install.log
99- @rm -f coverage.out56+ @echo "✓ Clean complete"
100- @echo "Clean complete"
101-
102-## version: Show version information
103-version:
104- @echo "Version: $(VERSION)"
105-
106-## help: Show this help message
107-help:
108- @echo "ArchUp Go Installer - Makefile Commands"
109- @echo ""
110- @sed -n 's/^##//p' $(MAKEFILE_LIST) | column -t -s ':' | sed -e 's/^/ /'

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 0

    ↑↓ moveenter openesc close