-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·86 lines (77 loc) · 1.85 KB
/
configure
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
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
libs=(libcurl libssl libpcre libssh)
function apt_based(){
packages=(libcurl4-openssl-dev libssl-dev libpcre3-dev libssh-dev)
for i in "${packages[@]}"
do
printf "Checking package: ${i}\t"
dpkg -s "$i" &> /dev/null
if [ "$?" != "0" ];then
printf "Not found\n"
printf "Trying install package: ${i}\n"
apt-get install "$i"
else
printf "Installed\n"
fi
done
}
function yum_based(){
packages=(pcre-devel libcurl-devel openssl-devel libssh-devel)
for i in "${packages[@]}"
do
printf "Checking package: ${i}\t"
yum list installed &> /dev/null
if [ "$?" != "0" ];then
printf "Not found\n"
printf "Trying install package: ${i}\n"
yum install "$i"
else
printf "Installed\n"
fi
done
}
function brew_based(){
packages=(pcre openssl libssh)
for i in "${packages[@]}"
do
printf "Checking package: ${i}\t"
brew list &> /dev/null
if [ "$?" != "0" ];then
printf "Not found\n"
printf "Trying install package: ${i}\n"
brew install "$i"
else
printf "Installed\n"
fi
done
}
if [ -n "$(which brew)" ];then
printf "brew based\n";
brew_based
else
printf "Checking libraries...\n"
for i in "${libs[@]}"
do
printf "${i}\t"
ldconfig -p | grep "${i}" > /dev/null
if [ "$?" == "0" ];then
printf "Ok\n"
else
printf "not found\n"
error=1
fi
done
[ "$error" != "1" ] && exit;
printf "Checking system...\n"
if [ -n "$(which apt-get)" ];then
printf "apt-get based\n";
apt_based
elif [ -n "$(which yum)" ];then
printf "yum based\n";
yum_based
else
printf "yum or apt-get not found,\n"
printf "you can download and install the following libs:\n"
printf "libcurl, libpcre, libssl and libssh\n\n"
fi
fi