-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·59 lines (50 loc) · 1.68 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
52
53
54
55
56
57
58
59
#!/bin/bash
DOCKER_STATUS_PATH=/var/local/docker-data/containers-status;
mkdir -p $DOCKER_STATUS_PATH $DOCKER_CONFIG_PATH
if [ -z ${DOCKER_WAIT_FOR+x} ]; then
echo "Starting $DOCKER_NAME...";
else
while : ; do
[[ -f "$DOCKER_STATUS_PATH/$DOCKER_WAIT_FOR" ]] && break
#echo "."
sleep 1
done
echo "Starting $DOCKER_NAME...";
fi
chmod -R a+rw $DOCKER_STATUS_PATH
#Si no existe el directorio de laraiz, creo toda la estructura (gracias mapeo a dirhost)
if [ ! -e $dir_rootCA/private ]; then
echo " Creando estructura basica ";
crear_estructura.sh;
fi
#Si no hay marca de inicializacion borro los contenidos anteriores
if [ ! -f $DOCKER_CONFIG_PATH/CA_INITIALIZED ] && [ -f $dir_rootCA/index.txt ]; then
echo " Eliminando certificados anteriores de $dir_interCA ";
#Elimino los certs de la CA intermedia, CA root queda por si es externa
rm -f $dir_interCA/csr/*.pem $dir_interCA/private/*.pem $dir_interCA/certs/*.pem
#Elimino los certificados generados
rm -f $dir_interCA/private/server/*.pem
rm -f $dir_interCA/private/client/*.pem
rm -f $dir_interCA/certs/server/*.pem
rm -f $dir_interCA/certs/client/*.pem
fi
for entrypoint in /entrypoint.d/*.sh
do
if [ -f $entrypoint -a -x $entrypoint ]
then
$entrypoint
fi
done
if [ ! -z $DOCKER_WEB_SCRIPT ]; then
if [ -f $DOCKER_WEB_SCRIPT -a -x $DOCKER_WEB_SCRIPT ]; then
$DOCKER_WEB_SCRIPT
fi
fi
#Dejo marca de inicializacion completada
if [ ! -f $DOCKER_CONFIG_PATH/CA_INITIALIZED ] && [ -f $dir_rootCA/index.txt -a -s $dir_rootCA/index.txt ]; then
echo "true" > $DOCKER_CONFIG_PATH/CA_INITIALIZED
fi
if [ ! -z $DOCKER_NAME ]; then
echo $HOSTNAME > $DOCKER_STATUS_PATH/$DOCKER_NAME
fi
exec "$@"