-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·62 lines (54 loc) · 1.11 KB
/
setup.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
#!/bin/sh
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
BLUE="\e[34m"
ENDCOLOR="\e[0m"
INFO="["$BLUE"i"$ENDCOLOR"]"
WARN="["$YELLOW"w"$ENDCOLOR"]"
ERR="["$RED"e"$ENDCOLOR"]"
# Check for root
if [ $EUID -ne 0 ]; then
printf "$ERR Please run this script with super user permission!\n"
exit $EUID
fi
# Install Dependencies
bash ./configure.sh
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
exit $EXIT_CODE;
fi
# Compile
bash ./compile.sh
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
exit $EXIT_CODE
fi
# Install
## BSD family
if [ -x "$(command -v pkg)" ] || [ -x "$(command -v pkg_add)" ] || [ -x "$(command -v pkgin)" ]; then
gmake install
## Linux
else
make install
fi
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
printf "$ERR Couldn't install! Please check if XAWP compiled successfully\n"
exit $EXIT_CODE
fi
# Clean
## BSD family
if [ -x "$(command -v pkg)" ] || [ -x "$(command -v pkg_add)" ] || [ -x "$(command -v pkgin)" ]; then
gmake clean
## Linux
else
make clean
fi
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
printf "$ERR Couldn't clean up\n"
exit $EXIT_CODE
fi
# Done
printf "$INFO Done. Have a nice day!\n"