-
Notifications
You must be signed in to change notification settings - Fork 6
/
run_locally_bo.sh
executable file
·33 lines (28 loc) · 1.04 KB
/
run_locally_bo.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
#! /bin/bash
if (( $# < 2 ))
then
echo "Invalid number of arguments."
echo "Usage: $0 <singularity_image.sif> <cmd>"
exit
fi
rrc_root=`pwd`
rrc_image=$1
expdir=${rrc_root}/build
export SINGULARITYENV_DISPLAY=$DISPLAY
# build dir
if [ -d ${expdir}/catkin_ws ]
then
rm -r ${expdir}
fi
# build catkin workspace
mkdir -p ${expdir}/catkin_ws/src/usercode
mkdir -p ${expdir}/logs
cp -r ${rrc_root}/python ${expdir}/catkin_ws/src/usercode
cp -r ${rrc_root}/*.txt ${expdir}/catkin_ws/src/usercode
cp -r ${rrc_root}/*.json ${expdir}/catkin_ws/src/usercode
cp -r ${rrc_root}/*.xml ${expdir}/catkin_ws/src/usercode
cp -r ${rrc_root}/setup.py ${expdir}/catkin_ws/src/usercode
cp -r ${rrc_root}/scripts ${expdir}/catkin_ws/src/usercode
singularity exec --cleanenv --contain -B ${expdir}/catkin_ws:/ws ${rrc_image} bash -c ". /setup.bash; cd /ws; catbuild"
# run command
singularity exec --cleanenv --contain --nv -B '/':/root_dir,${expdir}/catkin_ws:/ws,${expdir}/logs:/logdir,/run,/dev ${rrc_image} bash -c ". /setup.bash; . /ws/devel/setup.bash; ${*:2}"