b9874d0941
Add redbear-usb-storage-check in-guest binary that validates USB mass storage read and write I/O: discovers /scheme/disk/ devices, writes a test pattern to sector 2048, reads it back, verifies match, restores original content. Updates test-usb-storage-qemu.sh with write-proof verification step. Includes all accumulated Red Bear OS work: kernel patches, relibc patches, driver infrastructure, DRM/GPU, KDE recipes, firmware, validation tooling, build system hardening, and documentation.
64 lines
1.8 KiB
Bash
Executable File
64 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
RELEASE=""
|
|
CONFIG="redbear-full"
|
|
EXTRA_PACKAGES=()
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
Usage: $(basename "$0") --release=<ver> [--config=<name>] [--extra-package=<pkg> ...]
|
|
EOF
|
|
}
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--release=*) RELEASE="${1#*=}" ;;
|
|
--config=*) CONFIG="${1#*=}" ;;
|
|
--extra-package=*) EXTRA_PACKAGES+=("${1#*=}") ;;
|
|
-h|--help) usage; exit 0 ;;
|
|
*) echo "Unknown: $1" >&2; usage >&2; exit 1 ;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [ -z "$RELEASE" ]; then
|
|
echo "ERROR: --release is required" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ARCHIVE_DIR="$PROJECT_ROOT/sources/redbear-$RELEASE"
|
|
if [ ! -d "$ARCHIVE_DIR" ]; then
|
|
echo "ERROR: release archive not found: $ARCHIVE_DIR" >&2
|
|
echo "Available releases:" >&2
|
|
ls -1d "$PROJECT_ROOT"/sources/redbear-* 2>/dev/null | xargs -n1 basename >&2 || true
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$ARCHIVE_DIR/.complete" ]; then
|
|
echo "ERROR: release archive is not sealed: $ARCHIVE_DIR/.complete missing" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cd "$PROJECT_ROOT"
|
|
|
|
args=("$SCRIPT_DIR/validate-source-trees.py" "$CONFIG" "--release=$RELEASE" "--missing-paths-only")
|
|
for package_name in "${EXTRA_PACKAGES[@]}"; do
|
|
args+=("--extra-package=$package_name")
|
|
done
|
|
|
|
mapfile -t missing_paths < <(python3 "${args[@]}" || true)
|
|
|
|
if [ "${#missing_paths[@]}" -gt 0 ]; then
|
|
echo ">>> Restoring ${#missing_paths[@]} missing source trees for $CONFIG from release $RELEASE"
|
|
"$SCRIPT_DIR/restore-sources.sh" "--release=$RELEASE" "${missing_paths[@]}"
|
|
fi
|
|
|
|
args=("$SCRIPT_DIR/validate-source-trees.py" "$CONFIG" "--release=$RELEASE")
|
|
for package_name in "${EXTRA_PACKAGES[@]}"; do
|
|
args+=("--extra-package=$package_name")
|
|
done
|
|
python3 "${args[@]}"
|