forked from rogerioadris/rust-usbtmc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·40 lines (31 loc) · 852 Bytes
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace
if [[ ! -v TARGET_HOST ]]; then
readonly TARGET_HOST=pi@hostname
fi
if [[ ! -v TARGET_PATH ]]; then
readonly TARGET_PATH=/home/pi/rust-usbtmc
fi
if [[ ! -v TARGET_ARCH ]]; then
readonly TARGET_ARCH=armv7-unknown-linux-gnueabihf
fi
if [[ ! -v SOURCE_PATH ]]; then
readonly SOURCE_PATH=./target/${TARGET_ARCH}/release/rust-usbtmc
fi
# Commands
# rustup target add armv7-unknown-linux-gnueabihf
# sudo apt install gcc-arm-linux-gnueabihf
# .cargo/config
# [target.armv7-unknown-linux-gnueabihf]
# linker = "arm-linux-gnueabihf-gcc"
# Run deploy
cargo build --release --target=${TARGET_ARCH}
rsync ${SOURCE_PATH} ${TARGET_HOST}:${TARGET_PATH}
if [ $# -ne 0 ]; then
ssh -t ${TARGET_HOST} ${TARGET_PATH} $1
else
ssh -t ${TARGET_HOST} ${TARGET_PATH}
fi