-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathdocker-entrypoint.sh
executable file
·76 lines (61 loc) · 2.25 KB
/
docker-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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
set -e
NUXEO_DATA=${NUXEO_DATA:-/var/lib/nuxeo/data}
NUXEO_LOG=${NUXEO_LOG:-/var/log/nuxeo}
NUXEO_FORCE_CONF=${NUXEO_FORCE_CONF:-false}
NUXEO_MPINSTALL_OPTIONS=${NUXEO_MPINSTALL_OPTIONS:---relax=false}
# Allow supporting arbitrary user id
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
sed /^nuxeo/d /etc/passwd > /tmp/passwd && cp /tmp/passwd /etc/passwd
echo "${NUXEO_USER:-nuxeo}:x:$(id -u):0:${NUXEO_USER:-nuxeo} user:${NUXEO_HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
if [ "$1" = 'nuxeoctl' ]; then
if [[ ( ! -f $NUXEO_HOME/configured ) || "true" == $NUXEO_FORCE_CONF ]]; then
# Start by the template
cat /etc/nuxeo/nuxeo.conf.template > $NUXEO_CONF
# Can't do that at Java level since it's needed in nuxeoctl scripting
cat << EOF >> $NUXEO_CONF
nuxeo.log.dir=$NUXEO_LOG
nuxeo.pid.dir=/var/run/nuxeo
nuxeo.data.dir=$NUXEO_DATA
EOF
if [ -n "$NUXEO_CUSTOM_PARAM" ]; then
printf "%b\n" "$NUXEO_CUSTOM_PARAM" >> $NUXEO_CONF
fi
# Deprecated since 9.1, put a nuxeo.conf file in /docker-entrypoint-initnuxeo.d instead
if [ -f /nuxeo.conf ]; then
cat /nuxeo.conf >> $NUXEO_CONF
fi
if [ -f /docker-entrypoint-initnuxeo.d/nuxeo.conf ]; then
cat /docker-entrypoint-initnuxeo.d/nuxeo.conf >> $NUXEO_CONF
fi
touch $NUXEO_HOME/configured
fi
for f in /docker-entrypoint-initnuxeo.d/*; do
case "$f" in
*.sh) echo "$0: running $f"; . "$f" ;;
*.zip) echo "$0: installing Nuxeo package $f"; nuxeoctl mp-install $f ${NUXEO_MPINSTALL_OPTIONS} --accept=true ;;
*.clid) echo "$0: copying clid to $NUXEO_DATA"; cp $f $NUXEO_DATA/ ;;
# Special case for nuxeo.conf handled above, don't log
*nuxeo.conf) ;;
*) echo "$0: ignoring $f" ;;
esac
done
# instance.clid
if [ -n "$NUXEO_CLID" ]; then
# Replace -- by a carriage return
NUXEO_CLID="${NUXEO_CLID/--/\\n}"
printf "%b\n" "$NUXEO_CLID" >> $NUXEO_DATA/instance.clid
fi
## Executed at each start
if [ -n "$NUXEO_CLID" ] && [ ${NUXEO_INSTALL_HOTFIX:='true'} == "true" ]; then
nuxeoctl mp-hotfix --accept=true
fi
# Install packages if exist
if [ -n "$NUXEO_PACKAGES" ]; then
nuxeoctl mp-install $NUXEO_PACKAGES $NUXEO_MPINSTALL_OPTIONS --accept=true
fi
fi
exec "$@"