first commit
This commit is contained in:
commit
32a7ba8e8f
168 files changed
+123856
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build current sources, then start one native process. Rust reads .env as data.
|
||||
set -euo pipefail
|
||||
umask 077
|
||||
project_dir="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$project_dir"
|
||||
# Kept for compatibility: native starts always build now.
|
||||
if [[ "${1:-}" == "--build" ]]; then shift; fi
|
||||
if [[ "${1:-}" == "--docker" ]]; then
|
||||
shift
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo "Docker is required for --docker. Install Docker Engine with Compose, or run ./start.sh natively." >&2
|
||||
exit 1
|
||||
fi
|
||||
exec docker compose -f compose.yaml up -d --build "$@"
|
||||
fi
|
||||
if ! command -v cargo >/dev/null 2>&1; then
|
||||
echo "Install Rust via https://rustup.rs and the build dependencies listed in README.md, or use ./start.sh --docker." >&2
|
||||
exit 1
|
||||
fi
|
||||
# Use the same explicit directory for Cargo and the executable. Relative custom
|
||||
# paths are resolved from the project, including when invoked from elsewhere.
|
||||
build_dir="${CARGO_TARGET_DIR:-$project_dir/target}"
|
||||
if [[ "$build_dir" != /* ]]; then build_dir="$project_dir/$build_dir"; fi
|
||||
CARGO_TARGET_DIR="$build_dir" cargo build --release --locked
|
||||
binary="$build_dir/release/mikrotik-backup"
|
||||
if [[ ! -x "$binary" ]]; then
|
||||
echo "Cargo did not produce the native executable at $binary. Check your Cargo target configuration." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ $# -eq 0 ]]; then set -- serve; fi
|
||||
exec "$binary" "$@"
|
||||
Reference in new issue
Block a user