67 lines
1.4 KiB
Bash
67 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_PATH="${BASH_SOURCE[0]:-}"
|
|
if [ -n "${SCRIPT_PATH}" ] && [ "${SCRIPT_PATH}" != "bash" ] && [ "${SCRIPT_PATH}" != "-" ] && [ -f "${SCRIPT_PATH}" ]; then
|
|
SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_PATH}")" && pwd)"
|
|
else
|
|
SCRIPT_DIR="$(pwd)"
|
|
fi
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
build.sh - compile Zenbook Duo runtime and UI without installing
|
|
|
|
Usage:
|
|
./build.sh [--runtime-only | --ui-only]
|
|
|
|
Builds:
|
|
- Background services -> ui-tauri-react/src-tauri/target/release/
|
|
- Control Panel UI -> ui-tauri-react/src-tauri/target/release/bundle/
|
|
|
|
Install built artifacts with:
|
|
./install-rust-runtime.sh --install-only
|
|
./install-ui.sh --install-only --dir .
|
|
EOF
|
|
}
|
|
|
|
BUILD_RUNTIME=true
|
|
BUILD_UI=true
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
case "$1" in
|
|
--runtime-only)
|
|
BUILD_UI=false
|
|
shift
|
|
;;
|
|
--ui-only)
|
|
BUILD_RUNTIME=false
|
|
shift
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "ERROR: unknown argument: $1" >&2
|
|
usage >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ "${BUILD_RUNTIME}" = true ]; then
|
|
echo "==> Building Rust runtime"
|
|
"${SCRIPT_DIR}/build-rust-runtime.sh"
|
|
fi
|
|
|
|
if [ "${BUILD_UI}" = true ]; then
|
|
echo "==> Building Control Panel UI"
|
|
"${SCRIPT_DIR}/install-ui.sh" --dir "${SCRIPT_DIR}" --build-only --skip-prereqs
|
|
fi
|
|
|
|
echo
|
|
echo "Build complete. Install with:"
|
|
echo " ./install-rust-runtime.sh --install-only"
|
|
echo " ./install-ui.sh --install-only --dir ."
|