-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcompile.sh
64 lines (54 loc) · 1.85 KB
/
compile.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
#!/bin/bash
#some definitions
realpath=$0
instpath="${realpath%/*}"
if [ "$instpath" = "." ]; then
instpath=`pwd`
fi
######################################
### definition for custom commands ###
######################################
## compile logger and move into filesystem
compile_logger(){
mkdir -p $instpath/logger-bin
gcc -W -Wall -Wextra -Wshadow -Wlong-long -Wformat -Wpointer-arith -rdynamic -pedantic-errors -std=c99 -o $instpath/logger-bin/smw-logger $instpath/logger-src/smw-logger.c -lmysqlclient
cp -f $instpath/logger-bin/smw-logger /usr/local/bin/
}
function pause(){
read -p "$*"
}
clear
echo -e "\n --------------------------------------------------------------\n"
echo " Compile and copy the Solarmax Logger "
echo -e "\n --------------------------------------------------------------\n"
if [ `whoami` != "root" ]; then
echo -e "\n To execute this script, root privileges are required. So please "
echo -e " login as root or use the 'sudo' command to start this installer; "
echo -e " exiting. \n"
exit 1
fi
echo -e "\n\n To run the logger and the php-watcher some requirements have to "
echo -e " be fulfilled. \n"
echo -e " Needed packages: \n"
echo " - GNU C compiler (gcc)"
echo " - libmysqlclient-devel (containing /usr/include/mysql/mysql.h) "
echo " (path may differ)"
echo " - a running Mysql server (may reside on another machine)"
echo " - a running webserver, e. g. Apache with installed and activated "
echo " php extension"
echo -e " - php-modules 'gd' and 'mysql' \n"
echo " Press 'q' to quit here and improve your installation before "
echo " installing this software or press any other key to proceed. "
read -s -n 1 go_on
case $go_on in
q)
exit 0
;;
*)
echo -e "\n OK, let's go on then ... \n"
# return 0
;;
esac
compile_logger
echo ""
pause ' Press Enter key to proceed ...'