Skip to content
Snippets Groups Projects
Commit 5a52b15a authored by Marcus Greiff's avatar Marcus Greiff
Browse files

Add utility shell scripts for file transfer and setting up environments

parent d1fbbe64
Branches
Tags
No related merge requests found
#!/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 "./LabConnection.jl/util/startup.sh; bash -l"
#!/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 "./LabConnection.jl/util/startup.sh; bash -l"
#!/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=(LabConnection.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 folder /${project} to the BBB, aborting!${NC}\n"
}
done
fi
printf "${BLUE}Connecting to the BBB${NC}\n"
{
ssh -t debian@192.168.7.2 "./LabConnection.jl/util/startup.sh; bash -l"
} || {
printf "${RED}Could Connect to the BBB!${NC}\n"
}
#!/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=(LabConnection.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 folder /${project} to the BBB, aborting!${NC}\n"
}
done
fi
printf "${BLUE}Connecting to the BBB${NC}\n"
{
ssh -t debian@192.168.7.2 "./LabConnection.jl/util/startup.sh; bash -l"
} || {
printf "${RED}Could Connect to the BBB!${NC}\n"
}
#!/bin/bash
###############################################################################
# This pice of code attemps to scp files from the BBB to a directory $PWD/temp
#
# The code may be executed from anywhere on the HOST computer.
###############################################################################
{
if [ ! -d "temp" ]; then
mkdir temp
fi
sudo scp -r debian@192.168.7.2:/home/debian/$1 $PWD/temp
} || {
echo "Could not find or transfer $1, check that the file exists on the BBB"
}
#!/bin/bash
###############################################################################
# This pice of tries to scp files from the BBB to a directory $PWD/temp
#
# The code may be executed from anywhere on the HOST computer.
###############################################################################
{
if [ ! -d "temp" ]; then
mkdir temp
fi
sudo scp -r debian@192.168.7.2:/home/debian/$1 $PWD/temp
} || {
echo "Could not find or transfer $1, check that the file exists on the BBB"
}
#!/bin/sh
ls
cd "LabConnection.jl/test/BeagleBone"
sudo /home/debian/julia-903644385b/bin/julia
#!/bin/sh
ls
cd "LabConnection.jl/test/BeagleBone"
sudo /home/debian/julia-903644385b/bin/julia
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment