-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathconfigure
executable file
·624 lines (547 loc) · 18 KB
/
configure
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
# Generates config.mk to avoid having to specify make configuration on every use.
if [[ "${1:-}" == "--auto" ]]; then
echo >&2 "Auto Mode Enabled"
AUTO_DEFAULTS='true'
elif ! [ -t 0 ]; then
echo >&2 "Auto Mode Enabled (no TTY detected)"
AUTO_DEFAULTS='true'
fi
# Pass the empty string to read if AUTO_DEFAULTS=true
function read_safe() {
ARGS="$@"
if [[ "${AUTO_DEFAULTS:-}" == 'true' ]]; then
read ${ARGS} < <(echo) && echo
else
read ${ARGS}
fi
}
# If this session isn't interactive, then we don't want to allocate a TTY, which would fail.
# If it is interactive, we do want to attach so that the user can send e.g. ^C through.
INTERACTIVE='-i'
if [ -t 0 ]; then
INTERACTIVE+=' -t'
fi
project_dir="$(cd "$(dirname "${BASH_SOURCE}")" && pwd -P)"
cd "${project_dir}"
# Default download URL
DCOS_GENERATE_CONFIG_URL="https://downloads.dcos.io/dcos/stable/dcos_generate_config.sh"
# Make the DC/OS installer work with BSD/Mac sed.
# Fixed in DC/OS 1.9.0 by https://github.com/dcos/dcos/pull/1571
function patch_installer() {
DCOS_INSTALLER_PATH="${1}"
echo "Patching installer for BSD sed support..."
# sed's -i isn't in POSIX. So use two commands to support multiple variants of sed.
# First command makes the whole file read as a single line so that the second command only executes once per file.
sed -e 'H;1h;$!d;x' -e "s/sed '0,/sed '1,/" "${DCOS_INSTALLER_PATH}" > "${DCOS_INSTALLER_PATH}.bak"
mv "${DCOS_INSTALLER_PATH}.bak" "${DCOS_INSTALLER_PATH}"
}
# Patch DC/OS installer if untar fails.
# This could also indicate corruption (checksum mismatch).
function auto_patch_installer() {
DCOS_INSTALLER_PATH="${1}"
echo "Inspecting installer..."
DCOS_VERSION_META="$(bash "${DCOS_INSTALLER_PATH}" --version 2>&1 || true)"
if echo "${DCOS_VERSION_META}" | grep -q 'tar: Unrecognized archive format'; then
echo "Detecting sed compatibility..."
if strings "$(which sed)" | grep -q BSD; then
echo "Incompatible sed variant: BSD"
patch_installer "${DCOS_INSTALLER_PATH}"
else
if strings "$(which sed)" | grep -q GNU; then
echo "Compatible sed variant: GNU"
else
echo "Unrecognized sed variant!"
fi
echo >&2 "bash "${DCOS_INSTALLER_PATH}" --version"
echo >&2 "${DCOS_VERSION_META}"
echo >&2 "Failed to inspect installer!"
exit 2
fi
fi
}
function download_installer() {
DCOS_INSTALLER_PATH="${1}"
echo "Downloading installer..."
curl --fail --location --show-error -o "${DCOS_INSTALLER_PATH}" "${DCOS_GENERATE_CONFIG_URL}"
}
function unpack_installer() {
DCOS_INSTALLER_PATH="${1}"
echo "Unpacking installer..."
DCOS_VERSION_META="$(bash "${DCOS_INSTALLER_PATH}" --version 2>&1 || true)"
if ! [[ "$(echo "${DCOS_VERSION_META}" | tail -1)" == "}" ]]; then
echo >&2 "bash "${DCOS_INSTALLER_PATH}" --version"
echo >&2 "${DCOS_VERSION_META}"
echo >&2 "Failed to unpack installer!"
exit 2
fi
}
function contains() {
local ARRAY_VAR="${1}"
local VALUE="${2}"
local array=($(eval "echo \${${ARRAY_VAR}[@]}"))
for i in "${array[@]}"; do
if [[ "${i}" == "${VALUE}" ]]; then
return 0
fi
done
return 1
}
function prompt_select() {
local PROMPT="${1}"
local VALUE_VAR="${2}"
local OPTIONS_VAR="${3}"
local default="$(eval "echo \${${VALUE_VAR}}")"
local options=($(eval "echo \${${OPTIONS_VAR}[@]}"))
local indexes=($(seq 1 1 ${#options[@]} | paste -sd ' ' -))
echo "${PROMPT}: "
for i in "${!options[@]}"; do
echo -n "${indexes[$i]}) ${options[$i]}"
if [[ "${options[$i]}" == "${default}" ]]; then
echo -n " (default)"
fi
echo
done
while true; do
echo -n "#? "
read_safe reply
if [[ -z "${reply}" ]]; then
echo "Selected (default): ${default}"
eval "${VALUE_VAR}='${default}'"
break
elif contains "options" "${reply}"; then
echo "Selected: ${reply}"
eval "${VALUE_VAR}='${reply}'"
break
elif contains "indexes" "${reply}"; then
index=$((${reply}-1))
opt="${options[${index}]}"
echo "Selected: ${opt}"
eval "${VALUE_VAR}='${opt}'"
break
else
echo "Invalid option. Please try again."
continue
fi
done
}
function prompt_select_custom() {
local PROMPT="${1}"
local VALUE_VAR="${2}"
local OPTIONS_VAR="${3}"
local default="$(eval "echo \${${VALUE_VAR}}")"
local options=($(eval "echo \${${OPTIONS_VAR}[@]}"))
local indexes=($(seq 1 1 ${#options[@]} | paste -sd ' ' -))
local custom_index="$((${#options[@]}+1))"
echo "${PROMPT}: "
for i in "${!options[@]}"; do
echo -n "${indexes[$i]}) ${options[$i]}"
if [[ "${options[$i]}" == "${default}" ]]; then
echo -n " (default)"
fi
echo
done
echo "${custom_index}) [custom]"
while true; do
echo -n "#? "
read_safe reply
if [[ -z "${reply}" ]]; then
echo "Selected (default): ${default}"
eval "${VALUE_VAR}='${default}'"
break
elif [[ "${reply}" == "${custom_index}" ]] || [[ "${reply}" == "custom" ]]; then
echo "Selected: custom"
while true; do
echo -n "Enter custom value: "
read_safe reply
if [[ -n "${reply}" ]]; then
break
fi
echo "Reply must not be empty. Please try again."
done
echo "Selected (custom): ${reply}"
eval "${VALUE_VAR}='${reply}'"
break
elif contains "options" "${reply}"; then
echo "Selected: ${reply}"
eval "${VALUE_VAR}='${reply}'"
break
elif contains "indexes" "${reply}"; then
index=$((${reply}-1))
opt="${options[${index}]}"
echo "Selected: ${opt}"
eval "${VALUE_VAR}='${opt}'"
break
else
echo "Invalid option. Please try again."
continue
fi
done
}
function prompt_custom() {
local PROMPT="${1}"
local VALUE_VAR="${2}"
local default="$(eval "echo \${${VALUE_VAR}}")"
while true; do
echo -n "${PROMPT} [${default}]: "
read_safe reply
if [[ -z "${reply}" ]] || [[ "${reply}" == "${default}" ]]; then
echo "Entered (default): ${default}"
eval "${VALUE_VAR}='${default}'"
break
else
echo "Entered (custom): ${reply}"
CONFIRM='yes'
prompt_yes_no 'Confirm' 'CONFIRM'
if [[ "${CONFIRM}" != 'yes' ]]; then
continue
fi
eval "${VALUE_VAR}='${reply}'"
break
fi
done
}
function prompt_password() {
local PROMPT="${1}"
local VALUE_VAR="${2}"
local default="$(eval "echo \${${VALUE_VAR}}")"
while true; do
echo -n "${PROMPT} [${default}]: "
read_safe -s reply
echo
if [[ -z "${reply}" ]] || [[ "${reply}" == "${default}" ]]; then
echo -n "Confirm password [${default}]: "
read_safe -s reply2
echo
if [[ -z "${reply2}" ]] || [[ "${reply2}" == "${default}" ]]; then
eval "${VALUE_VAR}='${default}'"
break
fi
echo "Passwords do not match. Please try again."
continue
else
echo -n "Confirm password: "
read_safe -s reply2
echo
if [[ "${reply2}" == "${reply}" ]]; then
eval "${VALUE_VAR}='${reply2}'"
break
fi
echo "Passwords do not match. Please try again."
continue
fi
done
}
function prompt_yes_no() {
local PROMPT="${1}"
local VALUE_VAR="${2}"
local options=''
local default="$(eval "echo \${${VALUE_VAR}}")"
if [[ -z "${default}" ]] || [[ "${default}" =~ ^(Y|y|Yes|yes| )$ ]]; then
default='yes'
options="Y/n"
else
default='no'
options="y/N"
fi
while true; do
echo -n "${PROMPT} [${options}]? "
read_safe reply_yn
if [[ -z "${reply_yn}" ]]; then
eval "${VALUE_VAR}='${default}'"
echo "Entered: ${default}"
break
elif [[ "${reply_yn}" =~ ^(Y|y|Yes|yes| )$ ]]; then
eval "${VALUE_VAR}='yes'"
echo "Entered: yes"
break
elif [[ "${reply_yn}" =~ ^(N|n|No|no)$ ]]; then
eval "${VALUE_VAR}='no'"
echo "Entered: no"
break
else
echo "Invalid option. Please try again."
fi
done
}
function docker_storage_driver() {
# TODO: switch to using --format instead of grep (requires Docker 1.13+)
# Pipe to echo to remove surrounding quotes.
#docker info --format "{{json .Driver}}" | xargs echo
docker info | grep "^Storage Driver" | sed 's/.*: //'
}
function docker_server_version() {
docker info | grep "^Server Version" | sed 's/.*: //'
}
function docker_kernel_version() {
docker info | grep "^Kernel Version" | sed 's/.*: //'
}
function docker_operating_system() {
docker info | grep "^Operating System" | sed 's/.*: //'
}
function docker_available_memory() {
docker run --rm ${INTERACTIVE} alpine cat /proc/meminfo | grep MemAvailable | awk '{print $2}'
}
# See https://stackoverflow.com/a/7860705 for details on escaping Makefile variables.
function escape_for_makefile() {
echo "${1}" | sed -e 's/\$/\$\$/g' -e 's/#/\\#/g'
}
# Detect the docker host's init system.
# Docker host may be remote (boot2docker).
# /proc/$PID/comm is only available in Linux 2.6.33 and later.
function host_init_sys() {
# trim invisible characters
docker run --rm ${INTERACTIVE} -v /proc:/host/proc:ro alpine cat /host/proc/1/comm | tr -d '[:cntrl:]'
}
# Detect current Docker for Mac memory configuration (in MiB)
function docker_for_mac_memory() {
(
cd ~/Library/Containers/com.docker.docker/Data/database
git show HEAD:com.docker.driver.amd64-linux/memoryMiB
)
}
# Detect name servers from inside a docker container.
# This works for both local and remote (Docker for Mac) docker daemons,
# and also for any proxies Docker is configured to use.
function docker_nameservers() {
docker run --rm alpine cat /etc/resolv.conf | grep '^nameserver.*' | tr -s ' ' | cut -d' ' -f2 | paste -sd ' ' -
}
#########################
#### Execution Start ####
#########################
while true; do
echo
DCOS_INSTALLER_PATH="${PWD}/dcos_generate_config.sh"
prompt_custom "Enter the DC/OS installer absolute path" "DCOS_INSTALLER_PATH"
if [[ -f "${DCOS_INSTALLER_PATH}" ]]; then
break
fi
echo "Installer not found."
DCOS_INSTALLER_PATH="${PWD}/dcos_generate_config.sh"
echo
CONFIRM_DOWNLOAD='yes'
prompt_yes_no 'Download the latest stable DC/OS installer' 'CONFIRM_DOWNLOAD'
if [[ "${CONFIRM_DOWNLOAD}" != 'yes' ]]; then
continue
fi
download_installer "${DCOS_INSTALLER_PATH}"
break
done
auto_patch_installer "${DCOS_INSTALLER_PATH}"
unpack_installer "${DCOS_INSTALLER_PATH}"
echo "Detecting DC/OS version..."
DCOS_VERSION_META="$(bash "${DCOS_INSTALLER_PATH}" --version)"
DCOS_VERSION="$(echo "${DCOS_VERSION_META}" | grep 'version' | cut -d ':' -f 2 | cut -d '"' -f 2)"
DCOS_VARIANT="$(echo "${DCOS_VERSION_META}" | grep 'variant' | cut -d ':' -f 2 | cut -d '"' -f 2)"
echo "Version: ${DCOS_VERSION}"
echo "Variant: ${DCOS_VARIANT:-oss}"
# Strip suffix, if present, and add patch version segment, if missing.
DCOS_VERSION_SEMVER="$(echo "${DCOS_VERSION}" | sed -e 's/-.*$//' -e 's/^\([^.]*\.[^.]*\)$/\1.0/')"
echo
echo "Detecting Docker server version..."
DOCKER_SERVER_VERSION="$(docker_server_version)"
echo "Server Version: ${DOCKER_SERVER_VERSION}"
# Strip suffix (it breaks semver comparisons).
DOCKER_SERVER_VERSION="${DOCKER_SERVER_VERSION%%-*}"
echo
echo "Detecting Docker kernel version..."
DOCKER_KERNEL_VERSION="$(docker_kernel_version)"
echo "Kernel Version: ${DOCKER_KERNEL_VERSION}"
echo
echo "Detecting Docker operating system..."
DOCKER_OPERATING_SYSTEM="$(docker_operating_system)"
echo "Operating System: ${DOCKER_OPERATING_SYSTEM}"
echo
echo "Detecting Docker for Mac..."
DOCKER_FOR_MAC='false'
if [[ "$(uname)" == 'Darwin' ]]; then
if [[ "${DOCKER_OPERATING_SYSTEM}" == 'Docker for Mac' ]]; then
DOCKER_FOR_MAC='true'
elif [[ "${DOCKER_KERNEL_VERSION}" == *"-moby" ]]; then
DOCKER_FOR_MAC='true'
fi
fi
echo "Docker for Mac: ${DOCKER_FOR_MAC}"
if [[ "${DOCKER_FOR_MAC}" == 'true' ]]; then
# Docker 1.13.1 required (1.11.2 has a Docker-for-Mac-specific bug)
if vendor/semver_bash/testver.sh "${DOCKER_SERVER_VERSION}" -lt "1.13.1"; then
echo >&2 "Unsupported Docker server version! Requires 1.13.1 or greater."
exit 2
fi
else
# Docker 1.11.2 required
if vendor/semver_bash/testver.sh "${DOCKER_SERVER_VERSION}" -lt "1.11.2"; then
echo >&2 "Unsupported Docker server version! Requires 1.11.2 or greater."
exit 2
fi
fi
echo
echo "Detecting Docker available memory..."
DOCKER_AVAILABLE_MEMORY="$(docker_available_memory)"
echo "Available Memory: ${DOCKER_AVAILABLE_MEMORY} kB"
# 2147483 kB ~ 2 GiB (Docker for Mac Default)
# 4294967 kB ~ 4 GiB (Required for Smoke Test)
# 6442450 kB ~ 6 GiB (Recommended)
if [[ "${DOCKER_AVAILABLE_MEMORY}" -lt '4294967' ]]; then
echo >&2 "Insufficient Available Memory! Requires 4 GiB or more (6 GiB recommended)."
if [[ "${DOCKER_FOR_MAC}" == 'true' ]]; then
echo >&2 "See Docker for Mac > Preferences > Advanced > Memory"
fi
FORCE_CONTINUE='no'
prompt_yes_no 'Continue anyway' 'FORCE_CONTINUE'
if [[ "${FORCE_CONTINUE}" != 'yes' ]]; then
exit 2
fi
fi
echo
echo "Detecting Docker storage driver..."
DOCKER_STORAGEDRIVER="$(docker_storage_driver)"
echo "Storage Driver: ${DOCKER_STORAGEDRIVER}"
echo
DOCKER_STORAGEDRIVER_OPTIONS=(overlay overlay2 aufs devicemapper)
if ! contains "DOCKER_STORAGEDRIVER_OPTIONS" "${DOCKER_STORAGEDRIVER}"; then
DOCKER_STORAGEDRIVER='overlay'
fi
prompt_select_custom "Select inner Docker storage driver" "DOCKER_STORAGEDRIVER" "DOCKER_STORAGEDRIVER_OPTIONS"
echo
DOCKER_VERSION='1.11.2'
if [[ "${DOCKER_STORAGEDRIVER}" == 'overlay2' ]]; then
DOCKER_VERSION='1.13.1'
fi
DOCKER_VERSION_OPTIONS=(1.11.2 1.13.1)
prompt_select "Select inner Docker version" "DOCKER_VERSION" "DOCKER_VERSION_OPTIONS"
echo
echo "Detecting Docker host init system..."
DOCKER_HOST_INIT_SYS="$(host_init_sys)"
echo "Init System: ${DOCKER_HOST_INIT_SYS}"
echo
if [[ "${DOCKER_HOST_INIT_SYS}" == 'systemd' ]]; then
MESOS_SYSTEMD_ENABLE_SUPPORT='true'
else
MESOS_SYSTEMD_ENABLE_SUPPORT='false'
fi
MESOS_SYSTEMD_ENABLE_SUPPORT_OPTIONS=(true false)
prompt_select "Enable Mesos systemd support (requires systemd on host)" "MESOS_SYSTEMD_ENABLE_SUPPORT" "MESOS_SYSTEMD_ENABLE_SUPPORT_OPTIONS"
echo
echo "Detecting DNS resolvers..."
RESOLVERS="$(docker_nameservers)"
echo "DNS Resolvers: ${RESOLVERS}"
echo
echo "Detecting Home..."
echo "Home: ${HOME:-}"
# The home directory may be mounted for development convenience.
# Do not mount /root, otherwise ssh auth will fail (among other things).
CUSTOM_VOLUMES=''
if [[ -n "${HOME:-}" ]] && [[ "${HOME}" != "/root" ]]; then
echo
CONFIRM='yes'
prompt_yes_no "Mount ${HOME} directory" 'CONFIRM'
if [[ "${CONFIRM}" == 'yes' ]]; then
CUSTOM_VOLUMES="-v ${HOME}:${HOME}:ro"
fi
fi
echo
while true; do
NUM_MASTER_NODES='1'
prompt_custom "Select number of master nodes (odd number, 1-9)" "NUM_MASTER_NODES"
if ! [[ "${NUM_MASTER_NODES}" =~ ^[0-9]+$ ]]; then
echo >&2 "Invalid option. Input must be a number. Please try again."
continue
fi
if [[ "$((${NUM_MASTER_NODES}%2))" == '0' ]]; then
echo >&2 "Invalid option. Number of master nodes must be odd. Please try again."
continue
fi
if [[ "${NUM_MASTER_NODES}" -lt '1' ]] || [[ "${NUM_MASTER_NODES}" -gt '9' ]]; then
echo >&2 "Invalid option. Number of master nodes must be between 1 and 9. Please try again."
continue
fi
break
done
echo
while true; do
NUM_AGENT_NODES='1'
prompt_custom "Enter number of agent nodes" "NUM_AGENT_NODES"
if ! [[ "${NUM_AGENT_NODES}" =~ ^[0-9][0-9]*$ ]]; then
echo >&2 "Invalid option. Input must be a number. Please try again."
continue
fi
break
done
echo
while true; do
NUM_PUBLIC_AGENT_NODES='1'
prompt_custom "Enter number of public agent nodes" "NUM_PUBLIC_AGENT_NODES"
if ! [[ "${NUM_PUBLIC_AGENT_NODES}" =~ ^[0-9]+$ ]]; then
echo >&2 "Invalid option. Input must be a number. Please try again."
continue
fi
break
done
# Enterprise-only setup
if [[ "${DCOS_VARIANT}" == "ee" ]]; then
echo
SUPERUSER_USERNAME='admin'
prompt_custom "Enter superuser username" "SUPERUSER_USERNAME"
echo
SUPERUSER_PASSWORD='admin'
prompt_password "Enter superuser password" "SUPERUSER_PASSWORD"
# short circuit hashing for default password
if [[ "${SUPERUSER_PASSWORD}" == "admin" ]]; then
SUPERUSER_PASSWORD_HASH='$6$rounds=656000$5hVo9bKXfWRg1OCd$3X2U4hI6RYvKFqm6hXtEeqnH2xE3XUJYiiQ/ykKlDXUie/0B6cuCZEfLe.dN/7jF5mx/vSkoLE5d1Zno20Z7Q0'
else
HASH_RESPONSE="$(bash dcos_generate_config.sh --hash-password "${SUPERUSER_PASSWORD}")"
SUPERUSER_PASSWORD_HASH="$(echo "${HASH_RESPONSE}" | tail -1)"
if [[ "${SUPERUSER_PASSWORD_HASH}" != '$6$'* ]]; then
echo >&2 "Failed to hash password!"
echo >&2 "${HASH_RESPONSE}"
exit 2
fi
fi
if vendor/semver_bash/testver.sh "${DCOS_VERSION_SEMVER}" -ge "1.11.0"; then
while true; do
echo
LICENSE_KEY_PATH="${PWD}/license.txt"
prompt_custom "Enter license key absolute file path" "LICENSE_KEY_PATH"
if [[ -f "${LICENSE_KEY_PATH}" ]]; then
break
fi
if [[ "${AUTO_DEFAULTS:-}" == 'true' ]]; then
echo >&2 "License key not found."
exit 2
else
echo "License key not found."
fi
done
fi
fi
echo
CONFIG_PATH='make-config.mk'
echo "Generating dcos-docker config..."
cat > "${CONFIG_PATH}" << EOM
DCOS_GENERATE_CONFIG_PATH := ${DCOS_INSTALLER_PATH}
DOCKER_VERSION := ${DOCKER_VERSION}
DOCKER_STORAGEDRIVER := ${DOCKER_STORAGEDRIVER}
MESOS_SYSTEMD_ENABLE_SUPPORT := ${MESOS_SYSTEMD_ENABLE_SUPPORT}
RESOLVERS := ${RESOLVERS}
CUSTOM_VOLUMES := ${CUSTOM_VOLUMES}
MASTERS := ${NUM_MASTER_NODES}
AGENTS := ${NUM_AGENT_NODES}
PUBLIC_AGENTS := ${NUM_PUBLIC_AGENT_NODES}
EOM
if [[ "${DCOS_VARIANT}" == "ee" ]]; then
cat >> "${CONFIG_PATH}" << EOM
SUPERUSER_USERNAME := ${SUPERUSER_USERNAME}
SUPERUSER_PASSWORD_HASH := $(escape_for_makefile "${SUPERUSER_PASSWORD_HASH}")
EOM
if [[ -n "${LICENSE_KEY_PATH:-}" ]]; then
cat >> "${CONFIG_PATH}" << EOM
LICENSE_KEY := $(escape_for_makefile "$(cat "${LICENSE_KEY_PATH}" | sed -e 's/[[:space:]]*$//')")
EOM
fi
fi
cat "${CONFIG_PATH}"
echo
echo "Configuration Complete!"
echo 'Run `make` to deploy DC/OS.'