4.5_demo/deploy.sh
2026-06-01 10:37:23 +08:00

47 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# 设备 IP 地址
DEVICE_IP="10.10.12.107"
DEVICE_USER="root"
TARGET_DIR="/data"
echo "========================================="
echo " Deploying to Device"
echo "========================================="
echo "Device: ${DEVICE_USER}@${DEVICE_IP}"
echo "Target: ${TARGET_DIR}"
echo ""
# 检查编译产物是否存在
if [ ! -f "build-arm-Release/rotation_test" ]; then
echo "❌ Error: rotation_test not found!"
echo "Please run ./build.sh first"
exit 1
fi
# 上传程序
echo "Uploading rotation_test..."
scp build-arm-Release/rotation_test ${DEVICE_USER}@${DEVICE_IP}:${TARGET_DIR}/
if [ $? -eq 0 ]; then
echo ""
echo "========================================="
echo " ✓ Deploy Success!"
echo "========================================="
echo ""
echo "To run on device:"
echo " ssh ${DEVICE_USER}@${DEVICE_IP}"
echo " chmod +x ${TARGET_DIR}/rotation_test"
echo " ${TARGET_DIR}/rotation_test"
echo ""
echo "Or run directly:"
echo " ssh ${DEVICE_USER}@${DEVICE_IP} 'cd ${TARGET_DIR} && chmod +x rotation_test && ./rotation_test'"
echo ""
else
echo ""
echo "========================================="
echo " ✗ Deploy Failed!"
echo "========================================="
exit 1
fi