Files
fips_setup/scripts/00-build-fips.sh
2026-04-11 14:20:42 -04:00

37 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# ==============================================================================
# 00-build-fips.sh
#
# Build FIPS binaries from the bundled ./fips source tree and stage them into
# ./bin so the whole fips_setup directory can be copied to sys-fips.
#
# Usage:
# bash ./scripts/00-build-fips.sh
# ==============================================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
FIPS_DIR="${ROOT_DIR}/fips"
OUT_DIR="${ROOT_DIR}/bin"
if [ ! -f "${FIPS_DIR}/Cargo.toml" ]; then
echo "✗ Missing bundled fips source at: ${FIPS_DIR}"
exit 1
fi
echo "=== Building FIPS binaries from ${FIPS_DIR} ==="
echo ""
cd "${FIPS_DIR}"
cargo build --release --bin fips --bin fipsctl --bin fipstop
mkdir -p "${OUT_DIR}"
install -m 755 "${FIPS_DIR}/target/release/fips" "${OUT_DIR}/fips"
install -m 755 "${FIPS_DIR}/target/release/fipsctl" "${OUT_DIR}/fipsctl"
install -m 755 "${FIPS_DIR}/target/release/fipstop" "${OUT_DIR}/fipstop"
echo ""
echo "✓ Staged binaries in ${OUT_DIR}:"
ls -lh "${OUT_DIR}/fips" "${OUT_DIR}/fipsctl" "${OUT_DIR}/fipstop"