Index: docker/build-msys.sh
===================================================================
--- docker/build-msys.sh	(revision 976)
+++ docker/build-msys.sh	(revision 976)
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+set -e -u
+
+scriptdir=$(cd $(dirname $0) && pwd)
+
+VMDOMAIN=win10
+
+MSYSDIR="${scriptdir}/msys"
+
+DOCKER_IP=192.168.122.21
+DOCKER_PORT=2375
+
+DOCKER_HOST=tcp://${DOCKER_IP}:${DOCKER_PORT}
+export DOCKER_HOST
+
+set +e
+if virsh start "${VMDOMAIN}"; then
+    echo "Sleeping five minutes to wait for Windows to pull itself together..."
+    sleep 300
+else
+    echo "Could not start the Windows VM, maybe it is already up."
+fi
+
+echo "Waiting for the Docker port to be available..."
+count=0
+while ! socat /dev/null TCP4:${DOCKER_IP}:${DOCKER_PORT},connect-timeout=2; do
+    if test ${count} -gt 15; then
+        echo "Docker port is not available!"
+        exit 1
+    fi
+    count=$(expr ${count} + 1)
+    sleep 2
+done
+
+echo "Waiting for Docker to be available..."
+count=0
+while ! docker info; do
+    if test ${count} -gt 5; then
+        echo "Docker is not available!"
+        exit 1
+    fi
+    count=$(expr ${count} + 1)
+    sleep 2
+done
+
+set -e
+
+echo "Docker available, executing MSYS image build"
+docker build -t msys -f "${MSYSDIR}/Dockerfile" "${MSYSDIR}"
+
+echo "Building the MSYS distribution"
+docker run -it --rm msys c:\\msys64\\build\\build.bat
+
+echo "Shutting down the Windows VM"
+virsh shutdown --mode acpi "${VMDOMAIN}"
Index: docker/msys/Dockerfile
===================================================================
--- docker/msys/Dockerfile	(revision 920)
+++ docker/msys/Dockerfile	(revision 976)
@@ -14,12 +14,16 @@
     Remove-Item 7z.msi
 
-RUN $env:MSYSTEM='MINGW32' ; `
-    Start-Process C:\msys64\usr\bin\pacman.exe -ArgumentList '-Syu --noconfirm' -Wait -PassThru -Verbose -WorkingDirectory 'C:\msys64' ; `
-    Start-Process C:\msys64\usr\bin\pacman.exe -ArgumentList '-Su --noconfirm' -Wait -PassThru -Verbose -WorkingDirectory 'C:\msys64' ; `
-    Start-Process C:\msys64\usr\bin\bash.exe -ArgumentList '--login -c /usr/bin/true.exe' -Wait -PassThru -Verbose -WorkingDirectory 'C:\msys64'; `
-    mkdir C:\msys64\build
+RUN $env:MSYSTEM='MINGW32'  ; `
+    C:\msys64\usr\bin\bash.exe --login -c /usr/bin/true.exe ; `
+    C:\msys64\usr\bin\pacman.exe -Syu --noconfirm ; `
+    C:\msys64\usr\bin\pacman.exe -Su --noconfirm ; `
+    C:\msys64\usr\bin\pacman.exe -Scc --noconfirm
 
-COPY setup.sh pywin32.patch pywin32git.patch cef_binary_3.3359.1774.gd49d25f_windows32.patch cefpython-66.0.patch py2exe.patch C:\msys64\build\
+COPY setup.sh  C:\msys64\build\
 
 RUN $env:MSYSTEM='MINGW32'; `
-    C:\msys64\usr\bin\bash.exe --login  C:\msys64\build\setup.sh ;
+    C:\msys64\usr\bin\bash.exe --login -c /build/setup.sh
+
+COPY build.bat build.sh pywin32.patch pywin32git.patch cef_binary_3.3359.1774.gd49d25f_windows32.patch cefpython-66.0.patch py2exe.patch id_rsa C:\msys64\build\
+
+CMD ["powershell.exe"]
Index: docker/msys/build.bat
===================================================================
--- docker/msys/build.bat	(revision 976)
+++ docker/msys/build.bat	(revision 976)
@@ -0,0 +1,2 @@
+set MSYSTEM=MINGW32
+C:\msys64\usr\bin\bash.exe --login  C:\msys64\build\build.sh
Index: docker/msys/build.sh
===================================================================
--- docker/msys/build.sh	(revision 976)
+++ docker/msys/build.sh	(revision 976)
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+set -e -u
+
+echo "Building PyWin32"
+
+cd /build
+
+wget -O - https://github.com/mhammond/pywin32/archive/b224.tar.gz | gzip -dc | tar xf -
+cd pywin32-b224
+patch -p1 < ../pywin32git.patch
+patch -p1 < ../pywin32.patch
+python3 setup.py build
+python3 setup.py install
+
+echo "Building CEFPython"
+
+cd /build
+
+wget -O - http://opensource.spotify.com/cefbuilds/cef_binary_3.3359.1774.gd49d25f_windows32.tar.bz2 | bzip2 -dc | tar xf -
+cd cef_binary_3.3359.1774.gd49d25f_windows32
+
+patch -p1 < ../cef_binary_3.3359.1774.gd49d25f_windows32.patch
+mv tests tests.orig
+
+mkdir build
+cd build
+/usr/bin/env PATH=/mingw32/bin:/usr/local/bin::/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0 cmake  -G "MinGW Makefiles" ..
+cd libcef_dll_wrapper
+mingw32-make
+
+cd /build
+
+wget -O - https://github.com/cztomczak/cefpython/archive/v66.0.tar.gz | gzip -dc | tar xf -
+cd cefpython-66.0
+
+patch -p1 < ../cefpython-66.0.patch
+
+mkdir -p build
+cd build
+
+wget https://github.com/cztomczak/cefpython/releases/download/v66-upstream/cef66_3.3359.1774.gd49d25f_win32.zip
+unzip cef66_3.3359.1774.gd49d25f_win32.zip
+rm cef66_3.3359.1774.gd49d25f_win32.zip
+
+cp /build/cef_binary_3.3359.1774.gd49d25f_windows32/build/libcef_dll_wrapper/libcef_dll_wrapper.a cef66_3.3359.1774.gd49d25f_win32/lib
+
+pip3 install -r ../tools/requirements.txt
+
+python3 ../tools/build.py --no-run-tests --no-run-examples 66.0  || true
+python3 ../tools/build.py --no-run-tests --no-run-examples 66.0
+
+echo "Building Py2EXE"
+
+cd /build
+
+wget -O - https://github.com/albertosottile/py2exe/archive/v0.9.3.0.tar.gz | gzip -dc | tar xf -
+cd py2exe-0.9.3.0
+patch -p1 < ../py2exe.patch
+python3 setup.py build
+python3 setup.py install
+
+echo "Archiving msys64 directory"
+cd /c
+tar czf - msys64 | ssh -i /c/msys64/build/id_rsa -o StrictHostKeyChecking=no ivaradi@mises.varadiistvan.hu mlx/www/update/msys64.sh
Index: docker/msys/setup.sh
===================================================================
--- docker/msys/setup.sh	(revision 920)
+++ docker/msys/setup.sh	(revision 976)
@@ -3,67 +3,8 @@
 set -e -u
 
-pacman -S --noconfirm mc patch unzip mingw-w64-i686-python3 mingw-w64-i686-python3-setuptools mingw-w64-i686-gcc  mingw-w64-i686-gtk3 mingw-w64-i686-python3-lxml mingw-w64-i686-cmake mingw-w64-i686-make mingw-w64-i686-python3-pip mingw-w64-i686-python3-pillow mingw-w64-i686-python3-gobject mingw-w64-i686-python3-cffi
+echo "Installing extra packages..."
+
+pacman -S --noconfirm mc patch unzip openssh ca-certificates mingw-w64-i686-python3 mingw-w64-i686-python3-setuptools mingw-w64-i686-gcc  mingw-w64-i686-gtk3 mingw-w64-i686-python3-lxml mingw-w64-i686-cmake mingw-w64-i686-make mingw-w64-i686-python3-pip mingw-w64-i686-python3-pillow mingw-w64-i686-python3-gobject mingw-w64-i686-python3-cffi
 pacman -Scc --noconfirm
 
 pip3 install jsonrpclib-pelix
-
-echo "Building PyWin32"
-
-cd /build
-
-wget -O - https://github.com/mhammond/pywin32/archive/b224.tar.gz | gzip -dc | tar xf -
-cd pywin32-b224
-patch -p1 < ../pywin32git.patch
-patch -p1 < ../pywin32.patch
-python3 setup.py build
-python3 setup.py install
-
-echo "Building CEFPython"
-
-cd /build
-
-wget -O - http://opensource.spotify.com/cefbuilds/cef_binary_3.3359.1774.gd49d25f_windows32.tar.bz2 | bzip2 -dc | tar xf -
-cd cef_binary_3.3359.1774.gd49d25f_windows32
-
-patch -p1 < ../cef_binary_3.3359.1774.gd49d25f_windows32.patch
-mv tests tests.orig
-
-mkdir build
-cd build
-/usr/bin/env PATH=/mingw32/bin:/usr/local/bin::/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0 cmake  -G "MinGW Makefiles" ..
-cd libcef_dll_wrapper
-mingw32-make
-
-cd /build
-
-wget -O - https://github.com/cztomczak/cefpython/archive/v66.0.tar.gz | gzip -dc | tar xf -
-cd cefpython-66.0
-
-patch -p1 < ../cefpython-66.0.patch
-
-mkdir -p build
-cd build
-
-wget https://github.com/cztomczak/cefpython/releases/download/v66-upstream/cef66_3.3359.1774.gd49d25f_win32.zip
-unzip cef66_3.3359.1774.gd49d25f_win32.zip
-rm cef66_3.3359.1774.gd49d25f_win32.zip
-
-cp /build/cef_binary_3.3359.1774.gd49d25f_windows32/build/libcef_dll_wrapper/libcef_dll_wrapper.a cef66_3.3359.1774.gd49d25f_win32/lib
-
-pip3 install -r ../tools/requirements.txt
-
-python3 ../tools/build.py --no-run-tests --no-run-examples 66.0  || true
-python3 ../tools/build.py --no-run-tests --no-run-examples 66.0
-
-echo "Building Py2EXE"
-
-cd /build
-
-wget -O - https://github.com/albertosottile/py2exe/archive/v0.9.3.0.tar.gz | gzip -dc | tar xf -
-cd py2exe-0.9.3.0
-patch -p1 < ../py2exe.patch
-python3 setup.py build
-python3 setup.py install
-
-cd /
-rm -rf /build
Index: docker/msys64.sh
===================================================================
--- docker/msys64.sh	(revision 976)
+++ docker/msys64.sh	(revision 976)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Script to receive the msys64.tar.gz file on the server
+
+set -e -u
+
+scriptdir=$(cd $(dirname $0) && pwd)
+
+msys64path="${scriptdir}/msys64.tar.gz"
+
+echo "Receiving msys64.tar.gz.new ..."
+cat > "${msys64path}.new"
+
+echo "Replacing old version"
+mv "${msys64path}.new" "${msys64path}"
