Sets class before running any bootstrap

This commit is contained in:
Michel Fedde 2025-02-25 11:21:20 +01:00
parent abaee21ad8
commit 614aed4c12
4 changed files with 15 additions and 3 deletions

View file

@ -40,17 +40,17 @@ display() {
runfile() {
local command="$1"
local prompt="Do you wish to run $command? [Yn] "
local prompt="Do you wish to run $command? [Ynq]"
local display="Executing $command"
local promptLength=$((${#prompt} + 1))
local promptLength=$((${#prompt}))
local displayLength=${#display}
local maxWidth=$((promptLength > displayLength ? promptLength : displayLength))
_header ${maxWidth}
read -p "| $prompt" -n 1 -r
read -p "| $prompt" -n 1 -r -s
echo " |"
if [[ $REPLY =~ ^[Nn]$ ]]; then
@ -58,6 +58,12 @@ runfile() {
return
fi
if [[ $REPLY =~ ^[Qq]$ ]]; then
_footer ${maxWidth}
display "Exiting..."
exit 0
fi
echo -n "| $display"
_repeat $((maxWidth - displayLength)) " "
echo " |"
@ -72,9 +78,15 @@ runfile() {
set -eu
SCRIPTPATH="$(
cd -- "$(dirname "$0")" >/dev/null 2>&1
pwd -P
)"
# Directory to look for bootstrap executables in
BOOTSTRAP_D="${BASH_SOURCE[0]}.d"
$SCRIPTPATH/_set_class.sh
if [[ ! -d "$BOOTSTRAP_D" ]]; then
echo "Error: bootstrap directory '$BOOTSTRAP_D' not found" >&2
exit 1