-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
77 lines (57 loc) · 1.66 KB
/
install.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
#!/bin/bash
# In order to install the program you have to run the install.sh.
# If there isn't any first argument, which is <pathname>, there will be an echo
# containing the information to how install the program
# <pathname> is the folder you have to create in which you insert all processes' folders.
if [ $# -eq 0 ]
then
echo "To install correctly insert this line: source ./install.sh <pathname> ";
exit;
fi
# If there isn't any folder inside the path, we have to create it. We can check if there is a
# folder thanks to this if statement ($1 is the folder we have to create).
if [ ! -d $1 ]
then
echo "There is an ERROR: $1 directory does NOT exist!";
while true; do
read -p "Do you want to create $1 directory? [y/n] " yn
case $yn in
[y]* ) mkdir $1; break;;
[n]* ) exit;;
* ) "y = yes & n = no";;
esac
done
fi
# Thanks to the following lines we will unzip the sources.script.
# We export the path of the folder in order to use it in a
# file bash.
echo "Program installation on $1 ... ";
export X=$1;
unzip sources.zip -d $1;
# Compile of all the .c files and we put the executables inside a new
# Putting the executables inside a new folder.
echo "Compiling files on sources ...";
cd $1
cd funnamedpipe
gcc -o up unnamed_pipe.c
cd ..
cd fnamedpipe
gcc -o np named_pipe.c
cd ..
cd fsocket
gcc -o sck socket.c
cd ..
cd fcircularbuffer
gcc -o cb circular_buffer.c -lpthread -lrt
cd ..
cd fmaster
gcc -o master master.c
cd ..
mkdir executables
mv funnamedpipe/up executables
mv fnamedpipe/np executables
mv fsocket/sck executables
mv fcircularbuffer/cb executables
mv fmaster/master executables
cd ..
echo "Run the program with ./run.sh ";