-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·83 lines (68 loc) · 1.99 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
77
78
79
80
81
82
83
#!/usr/bin/env bash
#set -x
async_run() {
trap 'kill -TERM $PID' INT TERM
$@ &
PID=$!
while kill -0 $PID > /dev/null 2>&1; do
wait $PID;
done
# give time for output to reach terminal
sleep 5
return $EXIT_STATUS
}
configure_cordra() {
# the user may not want to configure the repository if they only
# want to test the software, or if they are already happy with
# the current configuration
while true; do
read -p "Do you wish to configure the EUDAT-DTR's repository? " yn
case $yn in
[Yy]* )
eval "./configure-unconfigured-cordra"
break
;;
[Nn]* )
break;;
* ) echo "Please answer yes or no.";;
esac
done
}
configure_b2access() {
# the user may not want to configure b2access support at this moment
while true; do
read -p "Do you wish to configure the support for B2ACCESS authentication? " yn
case $yn in
[Yy]* )
#eval "./configure-unconfigured-cordra"
break
;;
[Nn]* )
break;;
* ) echo "Please answer yes or no.";;
esac
done
}
# if the 'configure' argument was passed to docker,
# configure this DTR instance
if [ "$1" = "configure" ]; then
# make sure that 'configure' was called with docker in interactive mode
if [ ! -t 0 ]; then
echo "ERROR: configuration must be run in an interactive shell!"
echo " (try: docker run -v CFG_FILES_PATH:CONTAINER_PATH -it DOCKER_TAG configure)"_
exit 1
fi
configure_cordra
configure_b2access
exit 0
elif [ "$1" = "./startup" ]; then
if [ ! -e $DTRDATA/privatekey ]; then
echo "This image of EUDAT-DTR has not been configured"
echo " (try: docker run -v CFG_FILES_PATH:CONTAINER_PATH -it DOCKER_TAG configure)"_
exit 1
fi
async_run $@
else
exec $@
fi
echo "done!"