python3
Line | |
---|
1 | #!/bin/bash
|
---|
2 |
|
---|
3 | set -e -u
|
---|
4 |
|
---|
5 | scriptdir=$(cd $(dirname $0) && pwd)
|
---|
6 |
|
---|
7 | VMDOMAIN=win10
|
---|
8 |
|
---|
9 | MSYSDIR="${scriptdir}/msys"
|
---|
10 |
|
---|
11 | DOCKER_IP=192.168.122.21
|
---|
12 | DOCKER_PORT=2375
|
---|
13 |
|
---|
14 | DOCKER_HOST=tcp://${DOCKER_IP}:${DOCKER_PORT}
|
---|
15 | export DOCKER_HOST
|
---|
16 |
|
---|
17 | set +e
|
---|
18 | if virsh start "${VMDOMAIN}"; then
|
---|
19 | echo "Sleeping five minutes to wait for Windows to pull itself together..."
|
---|
20 | sleep 300
|
---|
21 | else
|
---|
22 | echo "Could not start the Windows VM, maybe it is already up."
|
---|
23 | fi
|
---|
24 |
|
---|
25 | echo "Waiting for the Docker port to be available..."
|
---|
26 | count=0
|
---|
27 | while ! socat /dev/null TCP4:${DOCKER_IP}:${DOCKER_PORT},connect-timeout=2; do
|
---|
28 | if test ${count} -gt 15; then
|
---|
29 | echo "Docker port is not available!"
|
---|
30 | exit 1
|
---|
31 | fi
|
---|
32 | count=$(expr ${count} + 1)
|
---|
33 | sleep 2
|
---|
34 | done
|
---|
35 |
|
---|
36 | echo "Waiting for Docker to be available..."
|
---|
37 | count=0
|
---|
38 | while ! docker info; do
|
---|
39 | if test ${count} -gt 5; then
|
---|
40 | echo "Docker is not available!"
|
---|
41 | exit 1
|
---|
42 | fi
|
---|
43 | count=$(expr ${count} + 1)
|
---|
44 | sleep 2
|
---|
45 | done
|
---|
46 |
|
---|
47 | set -e
|
---|
48 |
|
---|
49 | echo "Docker available, executing MSYS image build"
|
---|
50 | docker build -t msys -f "${MSYSDIR}/Dockerfile" "${MSYSDIR}"
|
---|
51 |
|
---|
52 | echo "Building the MSYS distribution"
|
---|
53 | docker run -it --rm msys c:\\msys64\\build\\build.bat
|
---|
54 |
|
---|
55 | echo "Shutting down the Windows VM"
|
---|
56 | virsh shutdown --mode acpi "${VMDOMAIN}"
|
---|
Note:
See
TracBrowser
for help on using the repository browser.