From f281bf73f376dd676df9da694e3f308bccb37df4 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Fri, 26 Nov 2021 00:49:32 +0000 Subject: [PATCH] run.sh: implement preinstall/install/postinstall logic --- src/run.sh | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/run.sh b/src/run.sh index f60471d..5350d1c 100644 --- a/src/run.sh +++ b/src/run.sh @@ -45,7 +45,12 @@ ask_yesno() { queue_postinstall_step() { local stepname="$1"; - echo "${stepname}" >>"${temp_dir}/steps.txt"; + echo "${stepname}" >>"${temp_dir}/steps-postinstall.txt"; +} +queue_preinstall_step() { + local stepname="$1"; + + echo "${stepname}" >>"${temp_dir}/steps-preinstall.txt"; } queue_apt_install() { @@ -79,7 +84,9 @@ task_end "$?"; task_begin "Setting initial state"; cat apt-packages.txt >"${temp_dir}/apt-packages.txt"; -queue_postinstall_step "base"; + +queue_preinstall_step "10-apt-update.sh"; +queue_postinstall_step "100-ssh-cluster-config.sh"; task_end "$?"; stage_end "$?"; @@ -93,6 +100,8 @@ stage_end "$?"; # ███████ ██ ███████ ██ ██ step_current="1"; +stage_begin "Configuring software choices"; + if ask_yesno "Use apt cache?"; then source ./steps-config/10-apt-cache.sh; fi @@ -100,3 +109,23 @@ fi if ask_yesno "Install Docker?"; then source ./steps-config/10-docker.sh; fi + +stage_end "$?"; + +############################################################################### + +while read -r preinstall_step; do + #shellcheck disable=SC1090 + source "steps-preinstall/${preinstall_step}"; +done < <(cat "${temp_dir}/steps-preinstall.txt"); + +############################################################################### + +apt-get install "$(cat "${temp_dir}/apt-packages.txt")"; + +############################################################################### + +while read -r postinstall_step; do + #shellcheck disable=SC1090 + source "steps-postinstall/${postinstall_step}"; +done < <(cat "${temp_dir}/steps-postinstall.txt");