forked from openshift/ironic-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunhttpd.sh
executable file
·40 lines (29 loc) · 1.21 KB
/
runhttpd.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
#!/usr/bin/bash
. /bin/ironic-common.sh
HTTP_PORT=${HTTP_PORT:-"80"}
# Whether to enable fast_track provisioning or not
IRONIC_FAST_TRACK=${IRONIC_FAST_TRACK:-true}
wait_for_interface_or_ip
mkdir -p /shared/html
chmod 0777 /shared/html
if [[ $IRONIC_FAST_TRACK == true ]]; then
INSPECTOR_EXTRA_ARGS="ipa-api-url=http://${IRONIC_URL_HOST}:6385"
else
INSPECTOR_EXTRA_ARGS=""
fi
# Copy files to shared mount
cp /tmp/inspector.ipxe /shared/html/inspector.ipxe
cp /tmp/dualboot.ipxe /shared/html/dualboot.ipxe
# Use configured values
sed -i -e s/IRONIC_IP/${IRONIC_URL_HOST}/g \
-e s/HTTP_PORT/${HTTP_PORT}/g \
-e "s|EXTRA_ARGS|${INSPECTOR_EXTRA_ARGS}|g" \
/shared/html/inspector.ipxe
sed -i 's/^Listen .*$/Listen [::]:'"$HTTP_PORT"'/' /etc/httpd/conf/httpd.conf
sed -i -e 's|\(^[[:space:]]*\)\(DocumentRoot\)\(.*\)|\1\2 "/shared/html"|' \
-e 's|<Directory "/var/www/html">|<Directory "/shared/html">|' \
-e 's|<Directory "/var/www">|<Directory "/shared">|' /etc/httpd/conf/httpd.conf
# Log to std out/err
sed -i -e 's%^ \+CustomLog.*% CustomLog /dev/stderr combined%g' /etc/httpd/conf/httpd.conf
sed -i -e 's%^ErrorLog.*%ErrorLog /dev/stderr%g' /etc/httpd/conf/httpd.conf
exec /usr/sbin/httpd -DFOREGROUND