-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·53 lines (35 loc) · 1.39 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
# Checking if the user entered a path name when running the bash file.
# If no additional pathname is entered, the bash script will exit echoing an error message.
if [ $# -eq 0 ]
then
echo "Usage: source ./install.sh <pathname> ";
exit;
fi
# If the file already exists installation of the source package will begin.
# Otherwise, the script will ask the user if he wants to create the package and install the source inside of it.
if [ ! -d $1 ]
then
echo "Error: Directory $1 DOES NOT exist.";
while true; do
read -p "Do you want to create $1 directory? [Y/n] " yn
case $yn in
[Yy]* ) mkdir $1; break;;
[Nn]* ) exit;;
* ) "Please, answer y for yes or n for no.";;
esac
done
fi
echo "Begin program installation on $1 ... ";
# Unzipping of the source file and moveing all the needed files inside the newly created directory.
unzip sources.zip -d $1;
echo "Program installed on $1";
echo "Begin sources' compilation ...";
# Compiling of all the scripts and moveing the executables all to the same directory.
gcc $1/master/master.c -o $1/ms;
gcc $1/unnamedPipe/unnamedPipe.c -o $1/up;
gcc $1/namedPipe/namedPipe.c -o $1/np;
gcc $1/circularBuffer/circularBuffer.c -o $1/cb -pthread -lrt;
gcc $1/socket/socket.c -o $1/sock;
echo "You can run the program in $1 with ./run.sh or either get some info about the precessing by running ./help.sh";
# Setting the folder's name as a global variable.
export X=$1;