run.sh: implement preinstall/install/postinstall logic
Some checks are pending
continuous-integration/laminar-eldarion Build failed with exit code 128 after 1 second

This commit is contained in:
Starbeamrainbowlabs 2021-11-26 00:49:32 +00:00
parent aa96b66372
commit f281bf73f3
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -45,7 +45,12 @@ ask_yesno() {
queue_postinstall_step() { queue_postinstall_step() {
local stepname="$1"; 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() { queue_apt_install() {
@ -79,7 +84,9 @@ task_end "$?";
task_begin "Setting initial state"; task_begin "Setting initial state";
cat apt-packages.txt >"${temp_dir}/apt-packages.txt"; 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 "$?"; task_end "$?";
stage_end "$?"; stage_end "$?";
@ -93,6 +100,8 @@ stage_end "$?";
# ███████ ██ ███████ ██ ██ # ███████ ██ ███████ ██ ██
step_current="1"; step_current="1";
stage_begin "Configuring software choices";
if ask_yesno "Use apt cache?"; then if ask_yesno "Use apt cache?"; then
source ./steps-config/10-apt-cache.sh; source ./steps-config/10-apt-cache.sh;
fi fi
@ -100,3 +109,23 @@ fi
if ask_yesno "Install Docker?"; then if ask_yesno "Install Docker?"; then
source ./steps-config/10-docker.sh; source ./steps-config/10-docker.sh;
fi 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");