Commit a896ac43 authored by Marcus Greiff's avatar Marcus Greiff

Updated util files

parent 12b29454
Pipeline #572 passed with stage
in 30 seconds
......@@ -30,7 +30,7 @@ Next, open a new terminal on the HOST and cd to the /util directory of the LabCo
`cd && cd .julia/v0.6/LabConnection/util'
This directory contains some nice utility files to operate the BB from the host. To flash it with the current revision of the software, including all dependencies, simply type `./flash.sh'
This directory contains some nice utility files to operate the BB from the host. To flash it with the current revision of the software, including all dependencies, simply execut the shells cript `flash.sh'.
## Setting up automatic communication between the BB and the HOST via TCP
To setup automatic start of julia server on the beagle bone
......
#!/bin/bash
###############################################################################
# This line of code connects to the BBB via ssh, runs the startup file and
# remains in the shell of the BBB after executing startup.sh on the BBB
#
# The code may be executed from anywhere on the HOST computer.
###############################################################################
ssh -t debian@192.168.7.2 "./LabConnections.jl/util/startup.sh; bash -l"
#!/bin/bash
#Run in this file un util folder, copies to BB
BLUE='\033[0;34m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
BASEDIR=../../$(dirname "$0")
# Dependencies
packages=(LabConnections YAML Codecs Compat)
# Create an empty directory to bundle packages
if [ -d ${BASEDIR}/juliapackages ]; then
rm -rf ${BASEDIR}/juliapackages
fi
mkdir ${BASEDIR}/juliapackages
# Copy packets to the juliapackages directory
flag=true
printf "${GREEN}Bundling...${NC}\n\n"
for (( i=0; i<${#packages[@]}; i++ )); do
{
printf "${BLUE} * ${packages[$i]}${NC}\n"
cp -r ../../${packages[$i]} ${BASEDIR}/juliapackages
} || {
printf "${BLUE}WARNING.${NC} Could not bundle package ${packages[$i]}${NC}\n"
flag=false
}
done
# Transfer files
if [ "$flag" = true ] ; then
{
printf "\n${GREEN}Transferring files...${NC}"
scp -r ${BASEDIR}/juliapackages debian@192.168.7.2:/home/debian
printf "${GREEN}...complete!${NC}\n"
} || {
printf "${RED}ABORTING.${NC} All packets could not be transferred, remove /home/debian/juliapackages on the BBB.\n"
}
else
printf "${RED}ABORTING.${NC} All packets could not be budled, check their existence on the HOST\n"
fi
# Remove temporary directory
rm -rf ${BASEDIR}/juliapackages
#!/bin/bash
###############################################################################
# This code clones or upps the most recent code from github and transfers it to
# the BBB before connecting to it and running the startup file on the BBB.
#
# The code may be executed from anywhere on the HOST computer.
###############################################################################
BLUE='\033[0;34m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
printf "${BLUE}Updating project${NC}\n..."
codeHost=gitlab.control.lth.se
codeUser=labdev
projects=(LabConnections.jl)
flag=false
for project in "${projects[@]}"; do
{
if [ -d "${project}" ]; then
# Try to clone repository
printf "${GREEN}Pulling /${project}...${NC}\n"
cd "${project}"
echo $(ls)
git pull "https://${codeHost}/${codeUser}/${project}.git"
cd ".."
else
printf "${GREEN}Cloning /${project}...${NC}\n"
git clone "https://${codeHost}/${codeUser}/${project}.git"
fi
} || { # catch
# save log for exception
flag=false
printf "${RED}Could not udate repository /${project}${NC}, aborting.\n"
}
done
printf "${BLUE}Initializing Transferring files to BBB${NC}\n"
if [ "{flag}"=true ]; then
for project in "${projects[@]}"; do
{
printf "${GREEN}Transferring /${project}...${NC}\n"
scp -r ${project} debian@192.168.7.2:/home/debian
} || { # catch
# save log for exception
flag=false
printf "${RED}Could not send project /${project} to the BBB, aborting!${NC}\n"
}
done
fi
printf "${BLUE}Deleting temporary files...${NC}\n"
for project in "${projects[@]}"; do
{
rm -rf ${project}
} || {
printf "${RED}Could not delete project /${project}, aborting!${NC}\n"
}
done
printf "${BLUE}Connecting to the BBB...${NC}\n"
{
ssh -t debian@192.168.7.2 "./LabConnections.jl/util/startup.sh; bash -l"
} || {
printf "${RED}Could Connect to the BBB!${NC}\n"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment