-
Notifications
You must be signed in to change notification settings - Fork 6
/
entrypoint.sh
executable file
·51 lines (40 loc) · 1.62 KB
/
entrypoint.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env sh
set -e
if [ -z "${DEVPISERVER_HOST}" ]; then
DEVPISERVER_HOST="0.0.0.0"
fi
if [ -z "${DEVPISERVER_PORT}" ]; then
DEVPISERVER_PORT="3141"
fi
if [ ! -f "${DEVPISERVER_SERVERDIR}/.nodeinfo" ]; then
echo "start initialization"
devpi-server --init
(
echo "waiting for devpi-server start"
sleep 5
devpi use "http://${DEVPISERVER_HOST}:${DEVPISERVER_PORT}/root/pypi"
devpi login root --password=""
if [ ! -z "${DEVPISERVER_ROOT_PASSWORD}" ]; then
echo "setup password for root"
devpi user -m root password="${DEVPISERVER_ROOT_PASSWORD}"
fi
if [ ! -z "${DEVPISERVER_USER}" ] && ! ( devpi user -l | grep -q -x "${DEVPISERVER_USER}" ); then
echo "create user ${DEVPISERVER_USER}"
devpi user -c "${DEVPISERVER_USER}" password="${DEVPISERVER_PASSWORD}"
devpi logout # logout from root
devpi login "${DEVPISERVER_USER}" --password="${DEVPISERVER_PASSWORD}"
else
export DEVPISERVER_USER=root
export DEVPISERVER_PASSWORD="${DEVPISERVER_ROOT_PASSWORD}"
fi
if [ ! -z "${DEVPISERVER_INDEX}" ] && ! ( devpi index -l | grep -q -x "${DEVPISERVER_USER}/${DEVPISERVER_INDEX}" ); then
echo "create index ${DEVPISERVER_USER}/${DEVPISERVER_INDEX}"
devpi index -c "${DEVPISERVER_INDEX}"
fi
devpi logout
) &
else
echo "skip initialization"
fi
echo "+ devpi-server --host=\"${DEVPISERVER_HOST}\" --port=\"${DEVPISERVER_PORT}\" $@"
exec devpi-server --host="${DEVPISERVER_HOST}" --port="${DEVPISERVER_PORT}" $@