-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-interceptors.sh
executable file
·112 lines (87 loc) · 2.95 KB
/
install-interceptors.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
#
#
# Install the Confluent Control Center Monitoring Interceptors
# Primarily for CI use and populating the binary wheels.
#
# Requires sudo.
#
# Usage: $0 tools/install-interceptors.sh
#
set -e
# pkgtype (rpm, deb, osx), will be empty on outer invocation.
pkgtype=$1
# Confluent Platform release version
CPVER=5.4
# confluent-librdkafka-plugins version
PLUGINVER=v0.11.3
# Stage directory for wheels
stagedir=staging/libs
[[ -d $stagedir ]] || mkdir -p $stagedir
if [[ -z $pkgtype ]]; then
# Automatic platform detection
if [[ $(uname -s) == Darwin ]]; then
exec $0 osx
elif apt-get -v >/dev/null 2>&1; then
# Debian, et.al.
exec $0 deb
elif yum version >/dev/null 2>&1; then
# RHEL, et.al.
exec $0 rpm
else
echo "$0: Unsupported platform: $(uname -s)"
exit 1
fi
elif [[ $pkgtype == rpm ]]; then
sudo rpm --import https://packages.confluent.io/rpm/${CPVER}/archive.key
echo "
[Confluent.dist]
name=Confluent repository (dist)
baseurl=https://packages.confluent.io/rpm/${CPVER}/7
gpgcheck=1
gpgkey=https://packages.confluent.io/rpm/${CPVER}/archive.key
enabled=1
[Confluent]
name=Confluent repository
baseurl=https://packages.confluent.io/rpm/${CPVER}
gpgcheck=1
gpgkey=https://packages.confluent.io/rpm/${CPVER}/archive.key
enabled=1
" | sudo tee /etc/yum.repos.d/confluent.repo
sudo yum install -y confluent-librdkafka-plugins
cp /usr/lib64/monitoring-interceptor.so.1 $stagedir/monitoring-interceptor.so
sudo yum erase -y confluent-librdkafka-plugins
elif [[ $pkgtype == deb ]]; then
need_pkgs=""
if [[ ! -x /usr/bin/wget ]]; then
need_pkgs="${need_pkgs} wget"
fi
if [[ ! -x /usr/bin/add-apt-repository ]]; then
need_pkgs="${need_pkgs} software-properties-common"
fi
if [[ ! -x /usr/bin/gpg ]]; then
need_pkgs="${need_pkgs} gnupg"
fi
if [[ ! -f /usr/lib/apt/methods/https ]]; then
need_pkgs="${need_pkgs} apt-transport-https"
fi
if [[ -n $need_pkgs ]]; then
echo "Installing $need_pkgs"
sudo apt-get update
sudo apt-get install -y $need_pkgs
fi
wget -qO - https://packages.confluent.io/deb/${CPVER}/archive.key | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://packages.confluent.io/deb/${CPVER} stable main"
sudo apt-get update
sudo apt-get install -y confluent-librdkafka-plugins
# Copy library to staging dir
cp $(dpkg -L confluent-librdkafka-plugins | grep monitoring-interceptor.so.1) $stagedir/monitoring-interceptor.so
sudo apt-get purge -y confluent-librdkafka-plugins
elif [[ $pkgtype == osx ]]; then
wget -O monitoring.zip http://packages.confluent.io/archive/${CPVER}/confluent-librdkafka-plugins-${PLUGINVER}.zip
unzip monitoring.zip monitoring-interceptor.dylib
otool -L monitoring-interceptor.dylib
mv monitoring-interceptor.dylib $stagedir/
fi
echo "Staging dir $stagedir content:"
ls -la $stagedir