diff --git a/src/run.sh b/src/run.sh index 02cef61..8049938 100755 --- a/src/run.sh +++ b/src/run.sh @@ -171,6 +171,14 @@ stage_end "$?"; # Pre-install tasks ####################################### +# From here on, *all* tasks must be COMPLETELY NONINTERACTIVE. +# If you have something you need to ask the user, it should have been asked +# above. The reason for this is that we do *not* want the user to be sitting +# around waiting for the next dialog box. They should have to wait only once, +# as this saves time. + +step_current="2"; + stage_begin "Executing pre-install tasks"; while read -r preinstall_step; do #shellcheck disable=SC1090 @@ -190,6 +198,8 @@ stage_end "$?" "1 or more pre-install tasks failed"; # Install packages ####################################### +step_current="3"; + stage_begin "Installing apt packages"; apt-get install --no-install-recommends --yes "$(cat "${temp_dir}/apt-packages.txt")"; stage_end "$?" "Failed to install apt packages"; @@ -206,6 +216,8 @@ stage_end "$?" "Failed to install apt packages"; # Post-install tasks ####################################### +step_current="4"; + stage_begin "Running post-install tasks"; while read -r postinstall_step; do #shellcheck disable=SC1090 @@ -219,8 +231,14 @@ stage_begin "$?" "Failed to run 1 or more post-install tasks"; # Final steps ### +step_current="5"; + source "steps-last/15-ufw.sh"; +############################################################################### + +step_current="done"; + echo " ██████ ██████ ██████ ██ ██ ██ ███████ ██ ██████ ███ ██ ██ ███ ██ ██████ diff --git a/src/steps-config/100-apt-sbrl.sh b/src/steps-config/100-apt-sbrl.sh old mode 100644 new mode 100755 diff --git a/src/steps-config/50-wesher-wireguard.sh b/src/steps-config/50-wesher-wireguard.sh new file mode 100755 index 0000000..b323ce4 --- /dev/null +++ b/src/steps-config/50-wesher-wireguard.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +wesher_secret="$(ask_password "wesher configuration" "Enter the wesher shared secret:")"; + +wesher_join_ip="$(ask_text "wesher configuration" "Enter an IP of a host in the cluster to join:")"; + +queue_apt_install "raspberrypi-kernel-headers" "wireguard" "wesher" "wesher-systemd"; + + +queue_postinstall_step "10-wesher.sh"; diff --git a/src/steps-postinstall/10-wesher.sh b/src/steps-postinstall/10-wesher.sh new file mode 100755 index 0000000..0e82896 --- /dev/null +++ b/src/steps-postinstall/10-wesher.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +task_begin "Configuring wesher"; + +# HACK: Ref https://github.com/costela/wesher/issues/70 +WESHER_CLUSTER_KEY="${wesher_secret}" wesher /usr/local/sbin/wesher --overlay-net 172.31.250.0/16 --log-level info --join "${wesher_join_ip}" & + +sleep 5; +killall wesher; +sleep 5; + +task_end "$?"; + +task_begin "Starting wesher"; + +sudo systemctl enable --now wesher; + +task_end "$?";