updated fping plugin to install fping 3.15; fixes #1720
Costa Tsaousis (ktsaou) committed
Feb 5, 2017 at 04:36 UTC
4b8fe019b5737a8526b917de2e8dbeac0a3123d2
1 file changed
+25
-6
plugins.d/fping.plugin
+25
-6
@@ -22,20 +22,39 @@ if [ "${1}" = "install" ]
22
"${@}" || exit 1
23
}
24
25
+ download() {
26
+ local curl="$(which curl 2>/dev/null || command -v curl 2>/dev/null)"
27
+ [ ! -z "${curl}" ] && run curl -s -L "${1}" && return 0
28
+
29
+ local wget="$(which wget 2>/dev/null || command -v wget 2>/dev/null)"
30
+ [ ! -z "${wget}" ] && run wget -q -O - "${1}" && return 0
31
+
32
+ echo >&2 "Cannot find 'curl' or 'wget' in this system." && exit 1
33
+ }
34
+
35
[ ! -d /usr/src ] && run mkdir -p /usr/src
36
[ ! -d /usr/local/bin ] && run mkdir -p /usr/local/bin
37
38
run cd /usr/src
39
30
- if [ -d fping-ktsaou.git ]
40
+ if [ -d fping-3.15 ]
41
then
32
- run cd fping-ktsaou.git
33
- run git pull
34
- else
35
- run git clone https://github.com/ktsaou/fping.git fping-ktsaou.git
36
- run cd fping-ktsaou.git
42
+ run rm -rf fping-3.15 || exit 1
43
fi
44
45
+ download 'https://github.com/schweikert/fping/archive/3.15.tar.gz' | run tar -zxvpf -
46
+ [ $? -ne 0 ] && exit 1
47
+ run cd fping-3.15 || exit 1
48
+
49
+ #if [ -d fping-ktsaou.git ]
50
+ # then
51
+ # run cd fping-ktsaou.git
52
+ # run git pull
53
+ #else
54
+ # run git clone https://github.com/ktsaou/fping.git fping-ktsaou.git
55
+ # run cd fping-ktsaou.git
56
+ #fi
57
+
58
run ./autogen.sh
59
run ./configure --prefix=/usr/local
60
run make clean