-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployToBeagleBone.sh
executable file
·119 lines (118 loc) · 2.51 KB
/
deployToBeagleBone.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash -
#===============================================================================
#
# FILE: deplyToBeagleBone.sh
#
# USAGE: ./deplyToBeagleBone.sh
#
# DESCRIPTION:
#
# OPTIONS:
# REQUIREMENTS: indido-arm
# BUGS: ---
# NOTES: ---
# AUTHOR: Vinay Yadav,
# ORGANIZATION: Freelancer
# CREATED: Tuesday 23 December 2014 09:51
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
## user at beaglebone
UNAME=robot
## ip of beaglebone
REMOTE=192.168.7.2
## ros project directory
REMOTE_DIR="/home/robot/projects/ros-projects-arm/"
## Here libs will be put
LIB_DIR="/home/robot/libs/"
## file sendor
BIN=rsync
## optargs
TEMP=`getopt -o hblmre::p: --long binaries,libs,manifest,roslaunch,extra::,project:, -- "$@"`
eval set -- "$TEMP"
## default settings
B=0;L=0;M=0;R=0;E=0
while true
do
case $1 in
-b|--binaries)
#echo "Deploying Binaries."
B=1
shift;;
-l|--libs)
#echo "Libraries deployed"
L=1
shift;;
-m|--manifest)
#echo "manifest deployed"
M=1
shift;;
-r|--raslaunch)
#echo "roslaunch file deployed"
R=1
shift;;
-e|--extra)
#echo "Extra are deployed : ${2}"
E=1
shift 2;;
-p|--project)
#echo "Deploying Project : ${2}"
PROJECT=$2
source /opt/ros/indigo-arm/env-arm-ros.sh
HOST_DIR=`rospack find $2`
shift 2;;
--)
shift; break;;
*)
echo "-b to send binary"
echo "-m to send manifest file"
echo "-l to send libs"
echo "-p project name to be deployed : required"
echo "-e deploy some extra file"
exit 0
esac
done
if [[ -d "$HOST_DIR" ]]
then
echo "Deploying project : $PROJECT"
REMOTE_DIR=${REMOTE_DIR}/$(echo ${HOST_DIR} | cut -d/ -f6- )
if [[ "$M" = 1 ]];
then
echo "Deploying manifest file."
if [[ -f "$HOST_DIR/manifest.xml" ]]
then
$BIN $HOST_DIR/manifest.xml $UNAME@$REMOTE:$REMOTE_DIR/
fi
fi
if [[ "$B" = 1 ]];
then
echo "Deploying Binaries."
if [[ $(ls "$HOST_DIR/bin/") ]]
then
$BIN $HOST_DIR/bin/* $UNAME@$REMOTE:$REMOTE_DIR/bin/
fi
fi
if [[ "$L" = 1 ]];
then
echo "Libraries deployed"
if [[ $(ls "$HOST_DIR/lib/") ]]
then
$BIN $HOST_DIR/lib/* $UNAME@$REMOTE:$LIB_DIR/
fi
fi
if [[ "$R" = 1 ]];
then
echo "roslaunch file deployed"
if [[ -f "$HOST_DIR/roslaunch/*" ]]
then
$BIN $HOST_DIR/roslaunch/* $UNAME@$REMOTE:$REMOTE_DIR/roslaunch/
fi
fi
if [[ "$E" = 1 ]];
then
echo "some extra file"
fi
else
echo "Project name $REMOTE_DIR not found"
exit 0;
fi