@@ -25,21 +25,23 @@ if [ "$1" = "unitd" ] || [ "$1" = "unitd-debug" ]; then
25
25
if /usr/bin/find " /var/lib/unit/" -mindepth 1 -print -quit 2> /dev/null | /bin/grep -q . ; then
26
26
echo " $0 : /var/lib/unit/ is not empty, skipping initial configuration..."
27
27
else
28
- if /usr/bin/find " /docker-entrypoint.d/" -mindepth 1 -print -quit 2> /dev/null | /bin/grep -q . ; then
29
- echo " $0 : /docker-entrypoint.d/ is not empty, launching Unit daemon to perform initial configuration..."
30
- /usr/sbin/$1 --control unix:/var/run/control.unit.sock
28
+ echo " $0 : Launching Unit daemon to perform initial configuration..."
29
+ /usr/sbin/$1 --control unix:/var/run/control.unit.sock
31
30
32
- for i in $( /usr/bin/seq $WAITLOOPS ) ; do
33
- if [ ! -S /var/run/control.unit.sock ]; then
34
- echo " $0 : Waiting for control socket to be created..."
35
- /bin/sleep $SLEEPSEC
36
- else
37
- break
38
- fi
39
- done
40
- # even when the control socket exists, it does not mean unit has finished initialisation
41
- # this curl call will get a reply once unit is fully launched
42
- /usr/bin/curl -f -s -X GET --unix-socket /var/run/control.unit.sock http://localhost/
31
+ for i in $( /usr/bin/seq $WAITLOOPS ) ; do
32
+ if [ ! -S /var/run/control.unit.sock ]; then
33
+ echo " $0 : Waiting for control socket to be created..."
34
+ /bin/sleep $SLEEPSEC
35
+ else
36
+ break
37
+ fi
38
+ done
39
+ # even when the control socket exists, it does not mean unit has finished initialisation
40
+ # this curl call will get a reply once unit is fully launched
41
+ /usr/bin/curl -s -X GET --unix-socket /var/run/control.unit.sock http://localhost/
42
+
43
+ if /usr/bin/find " /docker-entrypoint.d/" -mindepth 1 -print -quit 2> /dev/null | /bin/grep -q . ; then
44
+ echo " $0 : /docker-entrypoint.d/ is not empty, applying initial configuration..."
43
45
44
46
echo " $0 : Looking for certificate bundles in /docker-entrypoint.d/..."
45
47
for f in $( /usr/bin/find /docker-entrypoint.d/ -type f -name " *.pem" ) ; do
@@ -69,29 +71,30 @@ if [ "$1" = "unitd" ] || [ "$1" = "unitd-debug" ]; then
69
71
for f in $( /usr/bin/find /docker-entrypoint.d/ -type f -not -name " *.sh" -not -name " *.json" -not -name " *.pem" -not -name " *.js" ) ; do
70
72
echo " $0 : Ignoring $f " ;
71
73
done
74
+ else
75
+ echo " $0 : /docker-entrypoint.d/ is empty, creating 'welcome' configuration..."
76
+ curl_put /usr/share/unit/welcome/welcome.json " config"
77
+ fi
72
78
73
- echo " $0 : Stopping Unit daemon after initial configuration..."
74
- kill -TERM $( /bin/cat /var/run/unit.pid)
79
+ echo " $0 : Stopping Unit daemon after initial configuration..."
80
+ kill -TERM $( /bin/cat /var/run/unit.pid)
75
81
76
- for i in $( /usr/bin/seq $WAITLOOPS ) ; do
77
- if [ -S /var/run/control.unit.sock ]; then
78
- echo " $0 : Waiting for control socket to be removed..."
79
- /bin/sleep $SLEEPSEC
80
- else
81
- break
82
- fi
83
- done
82
+ for i in $( /usr/bin/seq $WAITLOOPS ) ; do
84
83
if [ -S /var/run/control.unit.sock ]; then
85
- kill -KILL $( /bin/cat /var/run/unit.pid)
86
- rm -f /var/run/control.unit.sock
84
+ echo " $0 : Waiting for control socket to be removed..."
85
+ /bin/sleep $SLEEPSEC
86
+ else
87
+ break
87
88
fi
88
-
89
- echo
90
- echo " $0 : Unit initial configuration complete; ready for start up..."
91
- echo
92
- else
93
- echo " $0 : /docker-entrypoint.d/ is empty, skipping initial configuration..."
89
+ done
90
+ if [ -S /var/run/control.unit.sock ]; then
91
+ kill -KILL $( /bin/cat /var/run/unit.pid)
92
+ rm -f /var/run/control.unit.sock
94
93
fi
94
+
95
+ echo
96
+ echo " $0 : Unit initial configuration complete; ready for start up..."
97
+ echo
95
98
fi
96
99
fi
97
100
0 commit comments