-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathl0g1c2docker.bash
35 lines (30 loc) · 1.1 KB
/
l0g1c2docker.bash
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
#!/bin/bash
# l0g1c2docker.bash
# Checks if output folder exists. If folder does not exist it is created.
if [ -d ./out ]
then
echo "Output folder exists"
else
echo "Output folder does not exist. Creating the output folder."
mkdir ./out
fi
# Compress files and copy them inside Docker container
tar -czf ../../L0G1C101.tar.gz ../../L0G1C101/
docker cp ../../L0G1C101.tar.gz core101:/opt/L0G1C101.tar.gz
rm ../../L0G1C101.tar.gz
# Compiles and executes in docker container
echo "Iniciando el contenedor"
docker start core101
echo "Extracting files inside container"
docker exec core101 bash -c "rm -r /opt/L0G1C101"
docker exec core101 bash -c "tar -xf /opt/L0G1C101.tar.gz -C /opt/"
echo "Compilando Core101"
docker exec core101 bash -c "cd /opt/L0G1C101/Core101; make; cd /"
echo "Simulando"
docker exec core101 bash -c "./opt/L0G1C101/Core101/obj_dir/VCore101_top"
echo "Deleting obj_dir for Core101"
docker exec core101 bash -c "rm -r /opt/L0G1C101/Core101/obj_dir"
echo "Copying output file"
docker cp core101:/output_data.txt ./out/output_data.txt
echo "Deteniendo contenedor"
docker stop core101