-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup-dedicated-system
More file actions
executable file
·35 lines (24 loc) · 1017 Bytes
/
setup-dedicated-system
File metadata and controls
executable file
·35 lines (24 loc) · 1017 Bytes
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
#!/bin/sh
. lib/shable
include "base"
_host="${1}"
_ssh_port="22"
inventory_read "${DEFAULT_INVENTORY}" "${_host}"
not_empty "${_host}" "Specify $(diste "host") to invoke $(diste "base-system-setup") on"
not_empty "${ip}" "Expected defined value of $(diste "ip") in inventory: $(diste "${DEFAULT_INVENTORY}")"
not_empty "${default_jails_domain}" "Expected defined value of $(diste "default_jails_domain") in inventory: $(diste "${DEFAULT_INVENTORY}")"
add_ssh_conf_entry "${_host}" "${ip}"
add_ssh_known_host "${ip}"
# handle interrupts - to avoid mess under ~/.ssh/config
trap "remove_last_ssh_conf_entry" INT TERM
# call setup-new-server reign, run as superuser, skip validation of unavailable binaries in pre-base-system:
RUN_AS=root \
SKIP_ENV_VALIDATION=YES \
bin/reign \
"${DEFAULT_INVENTORY}" \
setup-new-dedicated-server \
"${_host}" \
"${_ssh_port}"
# after setup, generate new host config
remove_last_ssh_conf_entry
add_ssh_conf_entry "${_host}" "${ip}" "${DEFAULT_SSH_PORT}"