diff --git a/src/run.sh b/src/run.sh index 634c033..8f9a709 100755 --- a/src/run.sh +++ b/src/run.sh @@ -45,7 +45,6 @@ ask_yesno() { whiptail --title "Step ${step_current} / ${step_max}" --yesno "${question}" 40 8; return "$?"; # Not actually needed, but best to be explicit } - ask_text() { local title="$1"; local question="$2"; @@ -129,15 +128,12 @@ step_current="1"; stage_begin "Configuring software choices"; -# TODO: hostname +source ./steps-config/10-hostname.sh; if ask_yesno "Use apt-cacher-ng server?"; then source ./steps-config/10-apt-cache.sh; fi -if ask_yesno "Install Docker?"; then - source ./steps-config/10-docker.sh; -fi if ask_yesno "Add Laminar CI SSH public key to root authorized_keys?"; then source ./steps-config/80-laminar-ssh.sh; @@ -148,6 +144,7 @@ collectd_username="$(ask_text "collectd", "Enter collectd username")"; #shellcheck disable=2034 collectd_password="$(ask_password "collectd" "Enter collectd password")"; + ### # Autonomous config tasks ### @@ -155,6 +152,10 @@ collectd_password="$(ask_password "collectd" "Enter collectd password")"; source ./steps-config/50-avahi-daemon.sh source ./steps-config/100-logrotate.sh source ./steps-config/100-apt-sbrl.sh +# Install docker by default +if [[ "${CLUSTER_EXCLUDE}" =~ docker ]]; then + source ./steps-config/10-docker.sh; +fi stage_end "$?"; diff --git a/src/steps-config/10-hostname.sh b/src/steps-config/10-hostname.sh new file mode 100755 index 0000000..ebd1e5f --- /dev/null +++ b/src/steps-config/10-hostname.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +old_hostname="${HOSTNAME}"; +new_hostname="$(ask_text "Set system hostname" "Enter this system's new hostname:" "")"; + +task_begin "Updating hostname to ${new_hostname}"; + +hostnamectl set-hostname "${new_hostname}"; + +cp /etc/hosts /etc/hosts.bak; + +sed "0,/${old_hostname}/{s/${old_hostname}/${new_hostname/}}" /etc/hosts.bak >/etc/hosts; + +task_end "${?}";