From 5e02d2e517a5aa6318c0c5ce045bb79a9d3b67ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89lo=C3=AFs?= <elois@ifee.fr>
Date: Mon, 16 Jul 2018 12:07:15 +0000
Subject: [PATCH] add entry.sh

---
 bootstrap.sh | 31 -------------------------------
 entry.sh     | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 31 deletions(-)
 delete mode 100644 bootstrap.sh
 create mode 100644 entry.sh

diff --git a/bootstrap.sh b/bootstrap.sh
deleted file mode 100644
index 9625508..0000000
--- a/bootstrap.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-# Test environment
-if [[ ! -d /builds ]]; then
-	echo "In order to use this image, you must mount the working directory to /builds"
-	exit 1
-fi
-REFERENCE=$(ls -d /builds/* | head -1)
-if [[ -z "${REFERENCE}" ]]; then
-	echo "Aborting because of empty working directory"
-	exit 1
-fi
-
-# Prepare environment
-_durs_prepare() {
-	touch /durs/reference || exit 1
-	chown --reference "${REFERENCE}" /durs/reference || exit 1
-	chown -R durs:durs /builds/* || exit 1
-}
-
-# Terminate
-_durs_terminate() {
-	chown -R --reference /durs/reference /builds/* || exit 1
-	rm -f /durs/reference
-	exit ${1}
-}
-
-# Prepare and execute building
-_durs_prepare
-su - durs
-_durs_terminate $?
diff --git a/entry.sh b/entry.sh
new file mode 100644
index 0000000..0914919
--- /dev/null
+++ b/entry.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+set -e
+
+export HOME=/tmp/home
+mkdir -p $HOME
+
+# Initialize the wine prefix (virtual windows installation)
+export WINEPREFIX=/tmp/wine
+mkdir -p $WINEPREFIX
+# FIXME: Make the wine prefix initialization faster
+wineboot &> /dev/null
+
+# Put libstdc++ and some other mingw dlls in WINEPATH
+# This must work for x86_64 and i686
+P1=$(dirname $(find /usr -name libwinpthread-1.dll))
+export WINEPATH="$(ls -d /usr/lib/gcc/*-w64-mingw32/*win32);$P1"
+
+exec "$@"
-- 
GitLab