25 lines
748 B
Bash
25 lines
748 B
Bash
#! /usr/bin/env bash
|
|
|
|
target=raspberrypi-3.local
|
|
dir_target=RpiLedBars
|
|
|
|
# I - Copy project to pi target
|
|
## 1 - select target from ssh config
|
|
|
|
## 2 - rsync project
|
|
rsync -avz --delete --exclude '*.build' --exclude 'cava' --filter='P .build' --backup-dir=../RpiLedBars_backup/"$(date +%F_%H-%M-%S)" ./ -e ssh ${target}:${dir_target}
|
|
|
|
# II - Connect to pi target
|
|
## 1 - Check prequistite (cava, i2s micropphone module, CMake)
|
|
|
|
# 2 - Build project
|
|
if [[ "$?" -eq 0 ]]; then
|
|
ssh ${target} "cd ${dir_target}/backend && cmake -B .build && cmake --build .build"
|
|
fi
|
|
|
|
## 3 - Install project
|
|
# ssh ${target} "cd ${dir_target}/backend && ./install.sh"
|
|
## 3 - Run project
|
|
if [[ "$?" -eq 0 ]]; then
|
|
ssh ${target} "cd ${dir_target}/backend && ./run.sh"
|
|
fi |