@@ -933,7 +933,9 @@ trivy:
933
933
echo " • Or run: make trivy-install" ; \
934
934
exit 1; \
935
935
}
936
- @systemctl --user enable --now podman.socket 2> /dev/null || true
936
+ @if command -v systemctl > /dev/null 2>&1 ; then \
937
+ systemctl --user enable --now podman.socket 2> /dev/null || true ; \
938
+ fi
937
939
@echo " 🔎 trivy vulnerability scan..."
938
940
@trivy --format table --severity HIGH,CRITICAL image $(IMG )
939
941
@@ -1157,16 +1159,11 @@ endef
1157
1159
# help: use-podman - Switch to Podman runtime
1158
1160
# help: show-runtime - Show current container runtime
1159
1161
1160
- # .PHONY: container-build container-run container-run-host container-run-ssl container-run-ssl-host \
1161
- # container-push container-info container-stop container-logs container-shell \
1162
- # container-health image-list image-clean image-retag container-check-image \
1163
- # container-build-multi use-docker use-podman show-runtime
1164
-
1165
1162
.PHONY : container-build container-run container-run-ssl container-run-ssl-host \
1166
- container-push container-info container-stop container-logs container-shell \
1167
- container-health image-list image-clean image-retag container-check-image \
1168
- container-build-multi use-docker use-podman show-runtime print-runtime \
1169
- print-image container-validate-env container-check-ports container-wait-healthy
1163
+ container-push container-info container-stop container-logs container-shell \
1164
+ container-health image-list image-clean image-retag container-check-image \
1165
+ container-build-multi use-docker use-podman show-runtime print-runtime \
1166
+ print-image container-validate-env container-check-ports container-wait-healthy
1170
1167
1171
1168
1172
1169
# Containerfile to use (can be overridden)
@@ -1430,9 +1427,8 @@ show-runtime:
1430
1427
# help: container-check-ports - Check if required ports are available
1431
1428
1432
1429
# Pre-flight validation
1433
- .PHONY : container-validate check-ports
1430
+ .PHONY : container-validate container- check-ports
1434
1431
1435
- # container-validate: container-validate-env check-ports
1436
1432
container-validate : container-validate-env container-check-ports
1437
1433
@echo " ✅ All validations passed"
1438
1434
@@ -1446,7 +1442,7 @@ container-check-ports:
1446
1442
@echo " 🔍 Checking port availability..."
1447
1443
@if ! command -v lsof > /dev/null 2>&1 ; then \
1448
1444
echo " ⚠️ lsof not installed - skipping port check" ; \
1449
- echo " 💡 Install with: brew install lsof (macOS) or apt-get install lsof (Linux)" ; \
1445
+ echo " 💡 Install with: brew install lsof (macOS) or apt-get install lsof (Linux)" ; \
1450
1446
exit 0; \
1451
1447
fi
1452
1448
@failed=0; \
@@ -2268,7 +2264,7 @@ argocd-app-sync:
2268
2264
# =============================================================================
2269
2265
# help: 🏠 LOCAL PYPI SERVER
2270
2266
# help: local-pypi-install - Install pypiserver for local testing
2271
- # help: local-pypi-start - Start local PyPI server on :8084 (no auth)
2267
+ # help: local-pypi-start - Start local PyPI server on :8085 (no auth)
2272
2268
# help: local-pypi-start-auth - Start local PyPI server with basic auth (admin/admin)
2273
2269
# help: local-pypi-stop - Stop local PyPI server
2274
2270
# help: local-pypi-upload - Upload existing package to local PyPI (no auth)
@@ -2290,12 +2286,12 @@ local-pypi-install:
2290
2286
@mkdir -p $(LOCAL_PYPI_DIR )
2291
2287
2292
2288
local-pypi-start : local-pypi-install local-pypi-stop
2293
- @echo " 🚀 Starting local PyPI server on http://localhost:8084 ..."
2289
+ @echo " 🚀 Starting local PyPI server on http://localhost:8085 ..."
2294
2290
@/bin/bash -c " source $( VENV_DIR) /bin/activate && \
2295
2291
export PYPISERVER_BOTTLE_MEMFILE_MAX_OVERRIDE_BYTES=10485760 && \
2296
- pypi-server run -p 8084 -a . -P . $(LOCAL_PYPI_DIR ) --hash-algo=sha256 & echo \$ ! > $(LOCAL_PYPI_PID ) "
2292
+ pypi-server run -p 8085 -a . -P . $(LOCAL_PYPI_DIR ) --hash-algo=sha256 & echo \$ ! > $(LOCAL_PYPI_PID ) "
2297
2293
@sleep 2
2298
- @echo " ✅ Local PyPI server started at http://localhost:8084 "
2294
+ @echo " ✅ Local PyPI server started at http://localhost:8085 "
2299
2295
@echo " 📂 Package directory: $( LOCAL_PYPI_DIR) "
2300
2296
@echo " 🔓 No authentication required (open mode)"
2301
2297
@@ -2340,14 +2336,14 @@ local-pypi-upload:
2340
2336
echo " ❌ No dist/ directory or files found. Run 'make dist' first." ; \
2341
2337
exit 1; \
2342
2338
fi
2343
- @if ! curl -s http://localhost:8084 > /dev/null 2>&1 ; then \
2344
- echo " ❌ Local PyPI server not running on port 8084 . Run 'make local-pypi-start' first." ; \
2339
+ @if ! curl -s $( LOCAL_PYPI_URL ) > /dev/null 2>&1 ; then \
2340
+ echo " ❌ Local PyPI server not running on port 8085 . Run 'make local-pypi-start' first." ; \
2345
2341
exit 1; \
2346
2342
fi
2347
2343
@/bin/bash -c " source $( VENV_DIR) /bin/activate && \
2348
- twine upload --verbose --repository-url http://localhost:8084 --skip-existing dist/* "
2344
+ twine upload --verbose --repository-url $( LOCAL_PYPI_URL ) --skip-existing dist/* "
2349
2345
@echo " ✅ Package uploaded to local PyPI"
2350
- @echo " 🌐 Browse packages: http://localhost:8084 "
2346
+ @echo " 🌐 Browse packages: $( LOCAL_PYPI_URL ) "
2351
2347
2352
2348
local-pypi-upload-auth :
2353
2349
@echo " 📤 Uploading existing package to local PyPI with auth..."
@@ -2387,9 +2383,7 @@ local-pypi-status:
2387
2383
@echo " 🔍 Local PyPI server status:"
2388
2384
@if [ -f $( LOCAL_PYPI_PID) ] && kill -0 $(cat $(LOCAL_PYPI_PID ) ) 2> /dev/null; then \
2389
2385
echo " ✅ Server running (PID: $( cat $( LOCAL_PYPI_PID) ) )" ; \
2390
- if curl -s http://localhost:8084 > /dev/null 2>&1 ; then \
2391
- echo " 🌐 Server on port 8084: http://localhost:8084" ; \
2392
- elif curl -s $(LOCAL_PYPI_URL ) > /dev/null 2>&1 ; then \
2386
+ if curl -s $( LOCAL_PYPI_URL) > /dev/null 2>&1 ; then \
2393
2387
echo " 🌐 Server on port 8085: $( LOCAL_PYPI_URL) " ; \
2394
2388
fi ; \
2395
2389
echo " 📂 Directory: $( LOCAL_PYPI_DIR) " ; \
@@ -2679,6 +2673,8 @@ SHELL_SCRIPTS := $(shell find . -type f -name '*.sh' \
2679
2673
-not -path './build/* ' \
2680
2674
-not -path './.tox/* ')
2681
2675
2676
+ # Define shfmt binary location
2677
+ SHFMT := $(shell command -v shfmt 2>/dev/null || echo "$(HOME ) /go/bin/shfmt")
2682
2678
2683
2679
.PHONY : shell-linters-install shell-lint shfmt-fix shellcheck bashate
2684
2680
@@ -2697,15 +2693,21 @@ shell-linters-install: ## 🔧 Install shellcheck, shfmt, bashate
2697
2693
esac ; \
2698
2694
fi ; \
2699
2695
# -------- shfmt (Go) -------- \
2700
- if ! command -v shfmt > /dev/null 2>&1 ; then \
2696
+ if ! command -v shfmt > /dev/null 2>&1 && [ ! -f " $( HOME ) /go/bin/shfmt " ] ; then \
2701
2697
echo " 🛠 Installing shfmt..." ; \
2702
2698
if command -v go > /dev/null 2>&1 ; then \
2703
2699
GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@latest; \
2704
- mkdir -p $(VENV_DIR ) /bin; \
2705
- ln -sf $$ HOME/go/bin/shfmt $(VENV_DIR ) /bin/shfmt 2> /dev/null || true ; \
2700
+ echo " ✅ shfmt installed to $( HOME) /go/bin/shfmt" ; \
2706
2701
else \
2707
- echo " ⚠️ Go not found - install Go or brew/apt shfmt package manually" ; \
2702
+ case " $$ (uname -s)" in \
2703
+ Darwin) brew install shfmt ;; \
2704
+ Linux) { command -v apt-get && sudo apt-get update -qq && sudo apt-get install -y shfmt ; } || \
2705
+ { echo " ⚠️ Go not found - install Go or shfmt package manually" ; } ;; \
2706
+ * ) echo " ⚠️ Please install shfmt manually" ;; \
2707
+ esac ; \
2708
2708
fi ; \
2709
+ else \
2710
+ echo " ✅ shfmt already installed at: $$ (command -v shfmt || echo $( HOME) /go/bin/shfmt)" ; \
2709
2711
fi ; \
2710
2712
# -------- bashate (pip) ----- \
2711
2713
if ! $( VENV_DIR) /bin/bashate -h > /dev/null 2>&1 ; then \
@@ -2719,10 +2721,14 @@ shell-linters-install: ## 🔧 Install shellcheck, shfmt, bashate
2719
2721
2720
2722
shell-lint : shell-linters-install # # 🔍 Run shfmt, ShellCheck & bashate
2721
2723
@echo " 🔍 Running shfmt (diff-only)..."
2722
- @command -v shfmt > /dev/null 2>&1 || { \
2724
+ @if command -v shfmt > /dev/null 2>&1 ; then \
2725
+ shfmt -d -i 4 -ci $(SHELL_SCRIPTS ) || true ; \
2726
+ elif [ -f " $( SHFMT) " ]; then \
2727
+ $(SHFMT ) -d -i 4 -ci $(SHELL_SCRIPTS ) || true ; \
2728
+ else \
2723
2729
echo " ⚠️ shfmt not installed - skipping" ; \
2724
2730
echo " 💡 Install with: go install mvdan.cc/sh/v3/cmd/shfmt@latest" ; \
2725
- } && shfmt -d -i 4 -ci $( SHELL_SCRIPTS ) || true
2731
+ fi
2726
2732
@echo " 🔍 Running ShellCheck..."
2727
2733
@command -v shellcheck > /dev/null 2>&1 || { \
2728
2734
echo " ⚠️ shellcheck not installed - skipping" ; \
@@ -2735,7 +2741,16 @@ shell-lint: shell-linters-install ## 🔍 Run shfmt, ShellCheck & bashate
2735
2741
2736
2742
shfmt-fix : shell-linters-install # # 🎨 Auto-format *.sh in place
2737
2743
@echo " 🎨 Formatting shell scripts with shfmt -w..."
2738
- @shfmt -w -i 4 -ci $(SHELL_SCRIPTS )
2744
+ @if command -v shfmt > /dev/null 2>&1 ; then \
2745
+ shfmt -w -i 4 -ci $(SHELL_SCRIPTS ) ; \
2746
+ elif [ -f " $( SHFMT) " ]; then \
2747
+ $(SHFMT ) -w -i 4 -ci $(SHELL_SCRIPTS ) ; \
2748
+ else \
2749
+ echo " ❌ shfmt not found in PATH or $( HOME) /go/bin/" ; \
2750
+ echo " 💡 Install with: go install mvdan.cc/sh/v3/cmd/shfmt@latest" ; \
2751
+ echo " Or: brew install shfmt (macOS)" ; \
2752
+ exit 1; \
2753
+ fi
2739
2754
@echo " ✅ shfmt formatting done."
2740
2755
2741
2756
0 commit comments