- Add src/build.sh for Docker-based ISO building - Add src/run-new.sh with enhanced container management - Add src/run.sh as host wrapper for build process 💘 Generated with Crush Assisted-by: GLM-4.6 via Crush <crush@charm.land>
86 lines
2.1 KiB
Bash
Executable File
86 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# KNEL-Football ISO Builder - Host Wrapper
|
|
# This script orchestrates the Docker-based build process
|
|
# Copyright © 2026 Known Element Enterprises LLC
|
|
|
|
set -euo pipefail
|
|
|
|
# Configuration variables
|
|
readonly DOCKER_IMAGE="knel-football-dev:latest" # Using required knel-football-dev image
|
|
readonly SCRIPT_DIR
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
readonly OUTPUT_DIR="${SCRIPT_DIR}/output"
|
|
readonly BUILD_DIR="${SCRIPT_DIR}/tmp"
|
|
|
|
# Create output and build directories if they don't exist
|
|
mkdir -p "${OUTPUT_DIR}" "${BUILD_DIR}"
|
|
|
|
# Function to show usage
|
|
usage() {
|
|
echo "Usage: $0 [command]"
|
|
echo "Commands:"
|
|
echo " build Build the secure ISO"
|
|
echo " test Run all tests"
|
|
echo " lint Run linting checks"
|
|
echo " clean Clean build artifacts"
|
|
echo " shell Interactive shell in build container"
|
|
exit 1
|
|
}
|
|
|
|
# Main execution logic
|
|
main() {
|
|
local command="${1:-build}"
|
|
|
|
case "${command}" in
|
|
build)
|
|
echo "Building KNEL-Football secure ISO..."
|
|
docker run --rm \
|
|
-v "${SCRIPT_DIR}:/workspace:ro" \
|
|
-v "${OUTPUT_DIR}:/output" \
|
|
-v "${BUILD_DIR}:/build" \
|
|
-e TZ="UTC" \
|
|
-e DEBIAN_FRONTEND="noninteractive" \
|
|
-e LC_ALL="C" \
|
|
"${DOCKER_IMAGE}" \
|
|
/workspace/src/build-iso.sh
|
|
;;
|
|
test)
|
|
echo "Running KNEL-Football test suite..."
|
|
docker run --rm \
|
|
-v "${SCRIPT_DIR}:/workspace:ro" \
|
|
-v "${BUILD_DIR}:/tmp" \
|
|
"${DOCKER_IMAGE}" \
|
|
bats -r /workspace/tests/
|
|
;;
|
|
lint)
|
|
echo "Running linting checks..."
|
|
docker run --rm \
|
|
-v "${SCRIPT_DIR}:/workspace:ro" \
|
|
"${DOCKER_IMAGE}" \
|
|
shellcheck /workspace/src/*.sh /workspace/config/hooks/*/*.sh
|
|
;;
|
|
clean)
|
|
echo "Cleaning build artifacts..."
|
|
rm -rf "${OUTPUT_DIR:?}"/*
|
|
rm -rf "${BUILD_DIR:?}"/*
|
|
;;
|
|
shell)
|
|
echo "Starting interactive shell..."
|
|
docker run --rm -it \
|
|
-v "${SCRIPT_DIR}:/workspace:ro" \
|
|
-v "${OUTPUT_DIR}:/output" \
|
|
-v "${BUILD_DIR}:/build" \
|
|
-e TZ="UTC" \
|
|
-e DEBIAN_FRONTEND="noninteractive" \
|
|
-e LC_ALL="C" \
|
|
"${DOCKER_IMAGE}" \
|
|
bash
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
}
|
|
|
|
main "$@"
|