Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
malwaredllc
GitHub Repository: malwaredllc/byob
Path: blob/master/web-gui/docker-pyinstaller/entrypoint-windows.sh
1292 views
1
#!/bin/bash
2
3
# Fail on errors.
4
set -e
5
6
# Make sure .bashrc is sourced
7
. /root/.bashrc
8
9
# Allow the workdir to be set using an env var.
10
# Useful for CI pipiles which use docker for their build steps
11
# and don't allow that much flexibility to mount volumes
12
WORKDIR=${SRCDIR:-/src}
13
14
#
15
# In case the user specified a custom URL for PYPI, then use
16
# that one, instead of the default one.
17
#
18
if [[ "$PYPI_URL" != "https://pypi.python.org/" ]] || \
19
[[ "$PYPI_INDEX_URL" != "https://pypi.python.org/simple" ]]; then
20
# the funky looking regexp just extracts the hostname, excluding port
21
# to be used as a trusted-host.
22
mkdir -p /wine/drive_c/users/root/pip
23
echo "[global]" > /wine/drive_c/users/root/pip/pip.ini
24
echo "index = $PYPI_URL" >> /wine/drive_c/users/root/pip/pip.ini
25
echo "index-url = $PYPI_INDEX_URL" >> /wine/drive_c/users/root/pip/pip.ini
26
echo "trusted-host = $(echo $PYPI_URL | perl -pe 's|^.*?://(.*?)(:.*?)?/.*$|$1|')" >> /wine/drive_c/users/root/pip/pip.ini
27
28
echo "Using custom pip.ini: "
29
cat /wine/drive_c/users/root/pip/pip.ini
30
fi
31
32
cd $WORKDIR
33
34
if [ -f requirements.txt ]; then
35
pip install -r requirements.txt
36
fi # [ -f requirements.txt ]
37
38
echo "$@"
39
40
if [[ "$@" == "" ]]; then
41
pyinstaller --clean -y --dist ./dist/windows --workpath /tmp *.spec
42
chown -R --reference=. ./dist/windows
43
else
44
sh -c "$@"
45
fi # [[ "$@" == "" ]]
46
47
48