File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,31 @@ export DOCKER_REGISTRY ?= itisfoundation
8989
9090MAKEFILES_WITH_OPENAPI_SPECS := $(shell find . -mindepth 2 -type f -name 'Makefile' -not -path '* /.* ' -exec grep -l '^openapi-specs:' {} \; | xargs realpath)
9191
92+ # WSL 2 tricks
93+ define _check_wsl_mirroring
94+ $(shell \
95+ if [ "$(IS_WSL2 ) " = "WSL2" ]; then \
96+ win_user=$$(powershell.exe '$$env:UserName' | tr -d '\r' | tail -n 1 | xargs ) ; \
97+ config_path="/mnt/c/Users/$$win_user/.wslconfig"; \
98+ if [ -f "$$config_path" ] && grep -q "networkingMode.* =.* mirrored" "$$config_path" 2>/dev/null; then \
99+ echo "true"; \
100+ else \
101+ echo "false"; \
102+ fi; \
103+ else \
104+ echo "false"; \
105+ fi \
106+ )
107+ endef
108+
109+ WSL_MIRRORED := $(_check_wsl_mirroring )
110+
111+
112+ ifeq ($(WSL_MIRRORED ) ,true)
113+ get_my_ip := 127.0.0.1
114+ else
92115get_my_ip := $(shell (hostname --all-ip-addresses || hostname -i) 2>/dev/null | cut --delimiter=" " --fields=1)
116+ endif
93117
94118# NOTE: this is only for WSL2 as the WSL2 subsystem IP is changing on each reboot
95119ifeq ($(IS_WSL2 ) ,WSL2)
You can’t perform that action at this time.
0 commit comments