32 lines
1.3 KiB
Bash
32 lines
1.3 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Build the recorder for aarch64, check it against the car's glibc, and install it
|
||
|
|
# on an Orin as the yukart-recorder service.
|
||
|
|
#
|
||
|
|
# usage: scripts/deploy-recorder.sh [host] (default: mikkeli-orin-nano)
|
||
|
|
#
|
||
|
|
# Cross-compiles from the workstation (the documented fallback): the development
|
||
|
|
# Orin is the preferred native build host. Either way check-glibc.sh gates it.
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
HOST="${1:-mikkeli-orin-nano}"
|
||
|
|
cd "$(dirname "$0")/.."
|
||
|
|
TARGET=aarch64-unknown-linux-gnu
|
||
|
|
BIN="target/$TARGET/release/recorder"
|
||
|
|
|
||
|
|
cargo build --release --target "$TARGET"
|
||
|
|
scripts/check-glibc.sh "$BIN"
|
||
|
|
|
||
|
|
# Binary lives under ~/infra per the host repo's guidelines; /usr/local/bin gets a symlink.
|
||
|
|
ssh "$HOST" 'mkdir -p ~/infra/svc-core'
|
||
|
|
scp -q "$BIN" "$HOST:infra/svc-core/recorder.new"
|
||
|
|
scp -q deploy/yukart-recorder.service "$HOST:infra/svc-core/yukart-recorder.service"
|
||
|
|
ssh "$HOST" 'set -e
|
||
|
|
mv ~/infra/svc-core/recorder.new ~/infra/svc-core/recorder
|
||
|
|
sudo ln -sfn "$HOME/infra/svc-core/recorder" /usr/local/bin/yukart-recorder
|
||
|
|
sudo install -m 0644 ~/infra/svc-core/yukart-recorder.service /etc/systemd/system/yukart-recorder.service
|
||
|
|
sudo systemctl daemon-reload
|
||
|
|
sudo systemctl enable yukart-recorder.service >/dev/null
|
||
|
|
sudo systemctl restart yukart-recorder.service
|
||
|
|
sleep 1
|
||
|
|
systemctl --no-pager --lines=5 status yukart-recorder.service'
|