forked from hyperledger-labs/minifabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minifabwin
executable file
·35 lines (31 loc) · 1.08 KB
/
minifabwin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@echo off
setlocal
setlocal enabledelayedexpansion
SET _alladdress=
for /f "usebackq tokens=2 delims=:" %%a in (`ipconfig ^| findstr /r "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"`) do (
set _temp=%%a
rem remove leading space
set _ipaddress=!_temp:~1!
set _bad=0
if [!_ipaddress:~-2!]==[.0] set _bad=1
if [!_ipaddress:~-2!]==[.1] set _bad=1
if [!_bad!]==[0] (
if [!_alladdress!]==[] (
set _alladdress=!_ipaddress!
) else (
set _alladdress=!_alladdress!,!_ipaddress!
)
)
)
set currentdir=%CD%
set currentdir=%currentdir:\=/%
set currentdir=%currentdir::=%
set currentdir=//%currentdir%
IF EXIST "%CD%/spec.yaml" (
docker run --rm --name minifab -v /var/run/docker.sock:/var/run/docker.sock -v %CD%/vars:/home/vars ^
-v %CD%/spec.yaml:/home/spec.yaml -e "hostroot=%currentdir%" -e "ADDRS=!_alladdress!" hfrd/minifab:latest /home/main.sh %*
) ELSE (
docker run --rm --name minifab -v /var/run/docker.sock:/var/run/docker.sock -v %CD%/vars:/home/vars ^
-e "hostroot=%currentdir%" -e "ADDRS=!_alladdress!" hfrd/minifab:latest /home/main.sh %*
)
endlocal