Avida-ED-App-Builder/tools/inject_webroot.sh

31 lines
590 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
VER="${1:-${VER:-v4}}"
case "$VER" in
v3) APP_DIR="Avida-ED" ;;
v4) APP_DIR="Avida-ED-Eco" ;;
*) echo "Unsupported VER=$VER. Use v3 or v4." >&2; exit 2 ;;
esac
SRC="apps/$VER/$APP_DIR"
DEST="server-ui/webroot/$APP_DIR"
if [ ! -f "$SRC/index.html" ]; then
echo "Missing $SRC/index.html. Run make fetch-$VER first." >&2
exit 2
fi
rm -rf server-ui/webroot
mkdir -p server-ui/webroot
if command -v rsync >/dev/null 2>&1; then
rsync -a "$SRC/" "$DEST/"
else
mkdir -p "$DEST"
cp -R "$SRC"/. "$DEST"/
fi
echo "Injected $SRC into $DEST"