phase 2
This commit is contained in:
21
media/ctrl/client.sh
Executable file
21
media/ctrl/client.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# Build and run the media client (sender)
|
||||
# Requires DRM master access — runs under sudo unless already root.
|
||||
# Usage: ./client.sh [server_addr] e.g. ./client.sh mcrndeb:4444
|
||||
set -euo pipefail
|
||||
|
||||
MEDIA_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
CARGO="${CARGO:-$HOME/.cargo/bin/cargo}"
|
||||
|
||||
LOG_DIR="$MEDIA_DIR/logs"
|
||||
mkdir -p "$LOG_DIR"
|
||||
"$CARGO" build -p cht-client --manifest-path "$MEDIA_DIR/Cargo.toml" 2>&1 | tee "$LOG_DIR/build-client.log"
|
||||
if [ "${PIPESTATUS[0]}" -ne 0 ]; then exit 1; fi
|
||||
|
||||
BIN="$MEDIA_DIR/target/debug/cht-client"
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
exec sudo "$BIN" "$@"
|
||||
else
|
||||
exec "$BIN" "$@"
|
||||
fi
|
||||
Reference in New Issue
Block a user