cluster-deployment/src/run.sh

57 lines
1.7 KiB
Bash
Raw Normal View History

2021-11-25 23:44:31 +00:00
#!/usr/bin/env bash
if [[ "${EUID}" -ne 0 ]]; then
echo "This script must be run as root." >&2;
exit 1;
fi
###############################################################################
2021-11-26 00:06:18 +00:00
step_current="0";
step_max="1";
###############################################################################
2021-11-25 23:44:31 +00:00
###
# Load the lantern build engine
###
# Make sure the current directory is the location of this script to simplify matters
cd "$(dirname "$(readlink -f "$0")")" || { echo "Error: Failed to cd to script directory" >&2; exit 1; };
lantern_path="lib/lantern-build-engine/";
# Check out the lantern git submodule if needed
if [ ! -f "${lantern_path}/lantern.sh" ]; then git submodule update --init "${lantern_path}"; fi
#shellcheck disable=SC1090
source "${lantern_path}/lantern.sh";
2021-11-26 00:06:18 +00:00
#shellcheck disable=SC1090
source "/etc/os-release";
###############################################################################
###############################################################################
ask_yesno() {
local question="$1";
whiptail --title "Step ${step_current} / ${step_max}" --yesno "${question}" 40 8;
return "$?"; # Not actually needed, but best to be explicit
}
2021-11-25 23:44:31 +00:00
###############################################################################
2021-11-26 00:06:18 +00:00
# ███████ ████████ ███████ ██████ ██
# ██ ██ ██ ██ ██ ███
# ███████ ██ █████ ██████ ██
# ██ ██ ██ ██ ██
# ███████ ██ ███████ ██ ██
step_current="1";
if ask_yesno "Use apt cache?"; then
source ./steps/10-apt-cache.sh;
fi