Add hostname configuration
Some checks are pending
continuous-integration/laminar-eldarion Build failed with exit code 123 after 6 seconds

This commit is contained in:
Starbeamrainbowlabs 2022-03-21 02:30:49 +00:00
parent 741d6c2c03
commit f159700ca8
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 20 additions and 5 deletions

View file

@ -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 "$?";

14
src/steps-config/10-hostname.sh Executable file
View file

@ -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 "${?}";