@cryptotaxi247 / netdata-1 / commits / 81251da72

Move the script for installing required packages into the main repo. (#7563)

* Move the script for installing required packages into the main repo. Based on discussion with Costa. Most of what this script is actually used for directly is in the main repo anyway, so it makes more sense to have it there so that any changes get reviewed properly. * Fix typo in RPM package build setup.

Austin S. Hemmelgarn committed Jan 16, 2020 at 07:27 UTC 81251da72c50c0b9efe9efced75452069c4834cb
7 files changed +1781 -9
.travis.yml
+1 -1
@@ -526,7 +526,7 @@ jobs:
526
527 name: Run coverity scan
528 before_script:
529 - - bash <(curl -sS https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh) --dont-wait --non-interactive netdata
529 + - bash <(curl -sS https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh) --dont-wait --non-interactive netdata
530 - sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler
531 script: ./coverity-scan.sh --with-install
532 after_failure: post_message "TRAVIS_MESSAGE" "<!here> Coverity nightly run has failed" "${NOTIF_CHANNEL}"
.travis/package_management/configure_deb_lxc_environment.py
+1 -1
@@ -63,7 +63,7 @@ common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "libnet
63 common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "libcups2-dev"])
64
65 print ("3.1 Run install-required-packages scriptlet")
66 -common.run_command(container, ["wget", "-T", "15", "-O", "%s/.install-required-packages.sh" % build_path, "https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh"])
66 +common.run_command(container, ["wget", "-T", "15", "-O", "%s/.install-required-packages.sh" % build_path, "https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"])
67 common.run_command(container, ["bash", "%s/.install-required-packages.sh" % build_path, "netdata", "--dont-wait", "--non-interactive"])
68
69 print("3.2 Installing package dependencies within LXC container")
.travis/package_management/configure_rpm_lxc_environment.py
+1 -1
@@ -49,7 +49,7 @@ common.run_command(container, ["useradd", "-m", os.environ['BUILDER_NAME']])
49 print("2.1 Preparing repo on LXC container")
50 common.prepare_repo(container)
51
52 -common.run_command(container, ["wget", "-T", "15", "-O", "/home/%s/.install-required-packages.sh" % (os.environ['BUILDER_NAME']), "https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh"])
52 +common.run_command(container, ["wget", "-T", "15", "-O", "/home/%s/.install-required-packages.sh" % (os.environ['BUILDER_NAME']), "https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"])
53 common.run_command(container, ["bash", "/home/%s/.install-required-packages.sh" % (os.environ['BUILDER_NAME']), "netdata", "--dont-wait", "--non-interactive"])
54
55 # Exceptional cases, not available everywhere
packaging/installer/README.md
+4 -4
@@ -52,7 +52,7 @@ To learn more about the pros and cons of using *nightly* vs. *stable* releases,
52 Verify the integrity of the script with this:
53
54 ```bash
55 -[ "0ae8dd3c4c9b976c4342c9fc09d9afae" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
55 +[ "952da7868b2c6b8819a7c600047400f5" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
56 ```
57
58 _It should print `OK, VALID` if the script is the one we ship._
@@ -211,13 +211,13 @@ Try our experimental automatic requirements installer (no need to be root). This
211 Install the packages for having a **basic Netdata installation** (system monitoring and many applications, without `mysql` / `mariadb`, `postgres`, `named`, hardware sensors and `SNMP`):
212
213 ```sh
214 -curl -Ss 'https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh' >/tmp/install-required-packages.sh && bash /tmp/install-required-packages.sh -i netdata
214 +curl -Ss 'https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh' >/tmp/install-required-packages.sh && bash /tmp/install-required-packages.sh -i netdata
215 ```
216
217 Install all the required packages for **monitoring everything Netdata can monitor**:
218
219 ```sh
220 -curl -Ss 'https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh' >/tmp/install-required-packages.sh && bash /tmp/install-required-packages.sh -i netdata-all
220 +curl -Ss 'https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh' >/tmp/install-required-packages.sh && bash /tmp/install-required-packages.sh -i netdata-all
221 ```
222
223 If the above do not work for you, please [open a github issue](https://github.com/netdata/netdata/issues/new?title=packages%20installer%20failed&labels=installation%20help&body=The%20experimental%20packages%20installer%20failed.%0A%0AThis%20is%20what%20it%20says:%0A%0A%60%60%60txt%0A%0Aplease%20paste%20your%20screen%20here%0A%0A%60%60%60) with a copy of the message you get on screen. We are trying to make it work everywhere (this is also why the script [reports back](https://github.com/netdata/netdata/issues/2054) success or failure for all its runs).
@@ -567,7 +567,7 @@ curl -s https://api.github.com/repos/netdata/netdata/releases/latest | grep "bro
567 curl -s https://api.github.com/repos/netdata/netdata/releases/latest | grep "browser_download_url.*txt" | cut -d '"' -f 4 | wget -qi -
568
569 # Netdata dependency handling script
570 -curl -s https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh | wget -qi -
570 +curl -s https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh | wget -qi -
571
572 # go.d plugin
573 # For binaries for OS types and architectures not listed on [go.d releases](https://github.com/netdata/go.d.plugin/releases/latest), kindly open a github issue and we will do our best to serve your request
packaging/installer/install-required-packages.sh new
+1772
@@ -0,0 +1,1772 @@
1 +#!/usr/bin/env bash
2 +
3 +export PATH="${PATH}:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
4 +export LC_ALL=C
5 +
6 +# Be nice on production environments
7 +renice 19 $$ >/dev/null 2>/dev/null
8 +
9 +ME="${0}"
10 +
11 +if [ "${BASH_VERSINFO[0]}" -lt "4" ]
12 +then
13 + echo >&2 "Sorry! This script needs BASH version 4+, but you have BASH version ${BASH_VERSION}"
14 + exit 1
15 +fi
16 +
17 +# These options control which packages we are going to install
18 +# They can be pre-set, but also can be controlled with command line options
19 +PACKAGES_NETDATA=${PACKAGES_NETDATA-0}
20 +PACKAGES_NETDATA_NODEJS=${PACKAGES_NETDATA_NODEJS-0}
21 +PACKAGES_NETDATA_PYTHON=${PACKAGES_NETDATA_PYTHON-0}
22 +PACKAGES_NETDATA_PYTHON3=${PACKAGES_NETDATA_PYTHON3-0}
23 +PACKAGES_NETDATA_PYTHON_MYSQL=${PACKAGES_NETDATA_PYTHON_MYSQL-0}
24 +PACKAGES_NETDATA_PYTHON_POSTGRES=${PACKAGES_NETDATA_PYTHON_POSTGRES-0}
25 +PACKAGES_NETDATA_PYTHON_MONGO=${PACKAGES_NETDATA_PYTHON_MONGO-0}
26 +PACKAGES_DEBUG=${PACKAGES_DEBUG-0}
27 +PACKAGES_IPRANGE=${PACKAGES_IPRANGE-0}
28 +PACKAGES_FIREHOL=${PACKAGES_FIREHOL-0}
29 +PACKAGES_FIREQOS=${PACKAGES_FIREQOS-0}
30 +PACKAGES_UPDATE_IPSETS=${PACKAGES_UPDATE_IPSETS-0}
31 +PACKAGES_NETDATA_DEMO_SITE=${PACKAGES_NETDATA_DEMO_SITE-0}
32 +PACKAGES_NETDATA_SENSORS=${PACKAGES_NETDATA_SENSORS-0}
33 +PACKAGES_NETDATA_DATABASE=${PACKAGES_NETDATA_DATABASE-0}
34 +
35 +# needed commands
36 +lsb_release=$(which lsb_release 2>/dev/null || command -v lsb_release 2>/dev/null)
37 +
38 +# Check which package managers are available
39 +apk=$(which apk 2>/dev/null || command -v apk 2>/dev/null)
40 +apt_get=$(which apt-get 2>/dev/null || command -v apt-get 2>/dev/null)
41 +dnf=$(which dnf 2>/dev/null || command -v dnf 2>/dev/null)
42 +emerge=$(which emerge 2>/dev/null || command -v emerge 2>/dev/null)
43 +equo=$(which equo 2>/dev/null || command -v equo 2>/dev/null)
44 +pacman=$(which pacman 2>/dev/null || command -v pacman 2>/dev/null)
45 +yum=$(which yum 2>/dev/null || command -v yum 2>/dev/null)
46 +zypper=$(which zypper 2>/dev/null || command -v zypper 2>/dev/null)
47 +
48 +distribution=
49 +version=
50 +codename=
51 +package_installer=
52 +tree=
53 +detection=
54 +NAME=
55 +ID=
56 +ID_LIKE=
57 +VERSION=
58 +VERSION_ID=
59 +
60 +usage() {
61 + cat <<EOF
62 +OPTIONS:
63 +
64 +${ME} [--dont-wait] [--non-interactive] \\
65 + [distribution DD [version VV] [codename CN]] [installer IN] [packages]
66 +
67 +Supported distributions (DD):
68 +
69 + - arch (all Arch Linux derivatives)
70 + - centos (all CentOS derivatives)
71 + - gentoo (all Gentoo Linux derivatives)
72 + - sabayon (all Sabayon Linux derivatives)
73 + - debian, ubuntu (all Debian and Ubuntu derivatives)
74 + - redhat, fedora (all Red Hat and Fedora derivatives)
75 + - suse, opensuse (all SuSe and openSuSe derivatives)
76 +
77 +Supported installers (IN):
78 +
79 + - apt-get all Debian / Ubuntu Linux derivatives
80 + - dnf newer Red Hat / Fedora Linux
81 + - emerge all Gentoo Linux derivatives
82 + - equo all Sabayon Linux derivatives
83 + - pacman all Arch Linux derivatives
84 + - yum all Red Hat / Fedora / CentOS Linux derivatives
85 + - zypper all SuSe Linux derivatives
86 + - apk all Alpine derivatives
87 +
88 +Supported packages (you can append many of them):
89 +
90 + - netdata-all all packages required to install netdata
91 + including mysql client, postgres client,
92 + node.js, python, sensors, etc
93 +
94 + - netdata minimum packages required to install netdata
95 + (no mysql client, no nodejs, includes python)
96 +
97 + - nodejs install nodejs
98 + (required for monitoring named and SNMP)
99 +
100 + - python install python
101 +
102 + - python3 install python3
103 +
104 + - python-mysql install MySQLdb
105 + (for monitoring mysql, will install python3 version
106 + if python3 is enabled or detected)
107 +
108 + - python-postgres install psycopg2
109 + (for monitoring postgres, will install python3 version
110 + if python3 is enabled or detected)
111 +
112 + - python-pymongo install python-pymongo (or python3-pymongo for python3)
113 +
114 + - sensors install lm_sensors for monitoring h/w sensors
115 +
116 + - firehol-all packages required for FireHOL, FireQoS, update-ipsets
117 + - firehol packages required for FireHOL
118 + - fireqos packages required for FireQoS
119 + - update-ipsets packages required for update-ipsets
120 +
121 + - demo packages required for running a netdata demo site
122 + (includes nginx and various debugging tools)
123 +
124 +
125 +If you don't supply the --dont-wait option, the program
126 +will ask you before touching your system.
127 +
128 +EOF
129 +}
130 +
131 +release2lsb_release() {
132 + # loads the given /etc/x-release file
133 + # this file is normaly a single line containing something like
134 + #
135 + # X Linux release 1.2.3 (release-name)
136 + #
137 + # It attempts to parse it
138 + # If it succeeds, it returns 0
139 + # otherwise it returns 1
140 +
141 + local file="${1}" x DISTRIB_ID= DISTRIB_RELEASE= DISTRIB_CODENAME= DISTRIB_DESCRIPTION=
142 + echo >&2 "Loading ${file} ..."
143 +
144 +
145 + x="$(cat "${file}" | grep -v "^$" | head -n 1)"
146 +
147 + if [[ "${x}" =~ ^.*[[:space:]]+Linux[[:space:]]+release[[:space:]]+.*[[:space:]]+(.*)[[:space:]]*$ ]]
148 + then
149 + eval "$(echo "${x}" | sed "s|^\(.*\)[[:space:]]\+Linux[[:space:]]\+release[[:space:]]\+\(.*\)[[:space:]]\+(\(.*\))[[:space:]]*$|DISTRIB_ID=\"\1\"\nDISTRIB_RELEASE=\"\2\"\nDISTRIB_CODENAME=\"\3\"|g" | grep "^DISTRIB")"
150 + elif [[ "${x}" =~ ^.*[[:space:]]+Linux[[:space:]]+release[[:space:]]+.*[[:space:]]+$ ]]
151 + then
152 + eval "$(echo "${x}" | sed "s|^\(.*\)[[:space:]]\+Linux[[:space:]]\+release[[:space:]]\+\(.*\)[[:space:]]*$|DISTRIB_ID=\"\1\"\nDISTRIB_RELEASE=\"\2\"|g" | grep "^DISTRIB")"
153 + elif [[ "${x}" =~ ^.*[[:space:]]+release[[:space:]]+.*[[:space:]]+(.*)[[:space:]]*$ ]]
154 + then
155 + eval "$(echo "${x}" | sed "s|^\(.*\)[[:space:]]\+release[[:space:]]\+\(.*\)[[:space:]]\+(\(.*\))[[:space:]]*$|DISTRIB_ID=\"\1\"\nDISTRIB_RELEASE=\"\2\"\nDISTRIB_CODENAME=\"\3\"|g" | grep "^DISTRIB")"
156 + elif [[ "${x}" =~ ^.*[[:space:]]+release[[:space:]]+.*[[:space:]]+$ ]]
157 + then
158 + eval "$(echo "${x}" | sed "s|^\(.*\)[[:space:]]\+release[[:space:]]\+\(.*\)[[:space:]]*$|DISTRIB_ID=\"\1\"\nDISTRIB_RELEASE=\"\2\"|g" | grep "^DISTRIB")"
159 + fi
160 +
161 + distribution="${DISTRIB_ID}"
162 + version="${DISTRIB_RELEASE}"
163 + codename="${DISTRIB_CODENAME}"
164 +
165 + [ -z "${distribution}" ] && echo >&2 "Cannot parse this lsb-release: ${x}" && return 1
166 + detection="${file}"
167 + return 0
168 +}
169 +
170 +get_os_release() {
171 + # Loads the /etc/os-release file
172 + # Only the required fields are loaded
173 + #
174 + # If it manages to load /etc/os-release, it returns 0
175 + # otherwise it returns 1
176 + #
177 + # It searches the ID_LIKE field for a compatible distribution
178 +
179 + local x
180 + if [ -f "/etc/os-release" ]
181 + then
182 + echo >&2 "Loading /etc/os-release ..."
183 +
184 + eval "$(cat /etc/os-release | grep -E "^(NAME|ID|ID_LIKE|VERSION|VERSION_ID)=")"
185 + for x in "${ID}" ${ID_LIKE}
186 + do
187 + case "${x,,}" in
188 + alpine|arch|centos|debian|fedora|gentoo|sabayon|rhel|ubuntu|suse|opensuse-leap|sles)
189 + distribution="${x}"
190 + version="${VERSION_ID}"
191 + codename="${VERSION}"
192 + detection="/etc/os-release"
193 + break
194 + ;;
195 + *)
196 + echo >&2 "Unknown distribution ID: ${x}"
197 + ;;
198 + esac
199 + done
200 + [ -z "${distribution}" ] && echo >&2 "Cannot find valid distribution in: ${ID} ${ID_LIKE}" && return 1
201 + else
202 + echo >&2 "Cannot find /etc/os-release" && return 1
203 + fi
204 +
205 + [ -z "${distribution}" ] && return 1
206 + return 0
207 +}
208 +
209 +get_lsb_release() {
210 + # Loads the /etc/lsb-release file
211 + # If it fails, it attempts to run the command: lsb_release -a
212 + # and parse its output
213 + #
214 + # If it manages to find the lsb-release, it returns 0
215 + # otherwise it returns 1
216 +
217 + if [ -f "/etc/lsb-release" ]
218 + then
219 + echo >&2 "Loading /etc/lsb-release ..."
220 + local DISTRIB_ID= ISTRIB_RELEASE= DISTRIB_CODENAME= DISTRIB_DESCRIPTION=
221 + eval "$(cat /etc/lsb-release | grep -E "^(DISTRIB_ID|DISTRIB_RELEASE|DISTRIB_CODENAME)=")"
222 + distribution="${DISTRIB_ID}"
223 + version="${DISTRIB_RELEASE}"
224 + codename="${DISTRIB_CODENAME}"
225 + detection="/etc/lsb-release"
226 + fi
227 +
228 + if [ -z "${distribution}" -a ! -z "${lsb_release}" ]
229 + then
230 + echo >&2 "Cannot find distribution with /etc/lsb-release"
231 + echo >&2 "Running command: lsb_release ..."
232 + eval "declare -A release=( $(lsb_release -a 2>/dev/null | sed -e "s|^\(.*\):[[:space:]]*\(.*\)$|[\1]=\"\2\"|g") )"
233 + distribution="${release[Distributor ID]}"
234 + version="${release[Release]}"
235 + codename="${release[Codename]}"
236 + detection="lsb_release"
237 + fi
238 +
239 + [ -z "${distribution}" ] && echo >&2 "Cannot find valid distribution with lsb-release" && return 1
240 + return 0
241 +}
242 +
243 +find_etc_any_release() {
244 + # Check for any of the known /etc/x-release files
245 + # If it finds one, it loads it and returns 0
246 + # otherwise it returns 1
247 +
248 + if [ -f "/etc/arch-release" ]
249 + then
250 + release2lsb_release "/etc/arch-release" && return 0
251 + fi
252 +
253 + if [ -f "/etc/centos-release" ]
254 + then
255 + release2lsb_release "/etc/centos-release" && return 0
256 + fi
257 +
258 + if [ -f "/etc/redhat-release" ]
259 + then
260 + release2lsb_release "/etc/redhat-release" && return 0
261 + fi
262 +
263 + if [ -f "/etc/SuSe-release" ]
264 + then
265 + release2lsb_release "/etc/SuSe-release" && return 0
266 + fi
267 +
268 + return 1
269 +}
270 +
271 +autodetect_distribution() {
272 + # autodetection of distribution
273 + get_os_release || get_lsb_release || find_etc_any_release
274 +}
275 +
276 +user_picks_distribution() {
277 + # let the user pick a distribution
278 +
279 + echo >&2
280 + echo >&2 "I NEED YOUR HELP"
281 + echo >&2 "It seems I cannot detect your system automatically."
282 + if [ -z "${equo}" -a -z "${emerge}" -a -z "${apt_get}" -a -z "${yum}" -a -z "${dnf}" -a -z "${pacman}" -a -z "${apk}" ]
283 + then
284 + echo >&2 "And it seems I cannot find a known package manager in this system."
285 + echo >&2 "Please open a github issue to help us support your system too."
286 + exit 1
287 + fi
288 +
289 + local opts=
290 + echo >&2 "I found though that the following installers are available:"
291 + echo >&2
292 + [ ! -z "${apt_get}" ] && echo >&2 " - Debian/Ubuntu based (installer is: apt-get)" && opts="apt-get ${opts}"
293 + [ ! -z "${yum}" ] && echo >&2 " - Redhat/Fedora/Centos based (installer is: yum)" && opts="yum ${opts}"
294 + [ ! -z "${dnf}" ] && echo >&2 " - Redhat/Fedora/Centos based (installer is: dnf)" && opts="dnf ${opts}"
295 + [ ! -z "${zypper}" ] && echo >&2 " - SuSe based (installer is: zypper)" && opts="zypper ${opts}"
296 + [ ! -z "${pacman}" ] && echo >&2 " - Arch Linux based (installer is: pacman)" && opts="pacman ${opts}"
297 + [ ! -z "${emerge}" ] && echo >&2 " - Gentoo based (installer is: emerge)" && opts="emerge ${opts}"
298 + [ ! -z "${equo}" ] && echo >&2 " - Sabayon based (installer is: equo)" && opts="equo ${opts}"
299 + [ ! -z "${apk}" ] && echo >&2 " - Alpine Linux based (installer is: apk)" && opts="apk ${opts}"
300 + echo >&2
301 +
302 + REPLY=
303 + while [ -z "${REPLY}" ]
304 + do
305 + echo "To proceed please write one of these:"
306 + echo "${opts}" | sed -e 's/ /, /g'
307 + read -p ">" REPLY
308 + [ $? -ne 0 ] && REPLY= && continue
309 +
310 + if [ "${REPLY}" = "yum" -a -z "${distribution}" ]
311 + then
312 + REPLY=
313 + while [ -z "${REPLY}" ]
314 + do
315 + read -p "yum in centos, rhel or fedora? > "
316 + [ $? -ne 0 ] && continue
317 +
318 + case "${REPLY,,}" in
319 + fedora|rhel)
320 + distribution="rhel"
321 + ;;
322 + centos)
323 + distribution="centos"
324 + ;;
325 + *)
326 + echo >&2 "Please enter 'centos', 'fedora' or 'rhel'."
327 + REPLY=
328 + ;;
329 + esac
330 + done
331 + REPLY="yum"
332 + fi
333 + check_package_manager "${REPLY}" || REPLY=
334 + done
335 +}
336 +
337 +detect_package_manager_from_distribution() {
338 + case "${1,,}" in
339 + arch*|manjaro*)
340 + package_installer="install_pacman"
341 + tree="arch"
342 + if [ ${IGNORE_INSTALLED} -eq 0 -a -z "${pacman}" ]
343 + then
344 + echo >&2 "command 'pacman' is required to install packages on a '${distribution} ${version}' system."
345 + exit 1
346 + fi
347 + ;;
348 +
349 + sabayon*)
350 + package_installer="install_equo"
351 + tree="sabayon"
352 + if [ ${IGNORE_INSTALLED} -eq 0 -a -z "${equo}" ]
353 + then
354 + echo >&2 "command 'equo' is required to install packages on a '${distribution} ${version}' system."
355 + # Maybe offer to fall back on emerge? Both installers exist in Sabayon...
356 + exit 1
357 + fi
358 + ;;
359 +
360 + alpine*)
361 + package_installer="install_apk"
362 + tree="alpine"
363 + if [ ${IGNORE_INSTALLED} -eq 0 -a -z "${apk}" ]
364 + then
365 + echo >&2 "command 'apk' is required to install packages on a '${distribution} ${version}' system."
366 + exit 1
367 + fi
368 + ;;
369 +
370 + gentoo*)
371 + package_installer="install_emerge"
372 + tree="gentoo"
373 + if [ ${IGNORE_INSTALLED} -eq 0 -a -z "${emerge}" ]
374 + then
375 + echo >&2 "command 'emerge' is required to install packages on a '${distribution} ${version}' system."
376 + exit 1
377 + fi
378 + ;;
379 +
380 + debian*|ubuntu*)
381 + package_installer="install_apt_get"
382 + tree="debian"
383 + if [ ${IGNORE_INSTALLED} -eq 0 -a -z "${apt_get}" ]
384 + then
385 + echo >&2 "command 'apt-get' is required to install packages on a '${distribution} ${version}' system."
386 + exit 1
387 + fi
388 + ;;
389 +
390 + centos*|clearos*)
391 + echo >&2 "You should have EPEL enabled to install all the prerequisites."
392 + echo >&2 "Check: http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/"
393 + package_installer="install_yum"
394 + tree="centos"
395 + if [ ${IGNORE_INSTALLED} -eq 0 -a -z "${yum}" ]
396 + then
397 + echo >&2 "command 'yum' is required to install packages on a '${distribution} ${version}' system."
398 + exit 1
399 + fi
400 + ;;
401 +
402 + fedora*|redhat*|red\ hat*|rhel*)
403 + package_installer=
404 + tree="rhel"
405 + [ ! -z "${yum}" ] && package_installer="install_yum"
406 + [ ! -z "${dnf}" ] && package_installer="install_dnf"
407 + if [ ${IGNORE_INSTALLED} -eq 0 -a -z "${package_installer}" ]
408 + then
409 + echo >&2 "command 'yum' or 'dnf' is required to install packages on a '${distribution} ${version}' system."
410 + exit 1
411 + fi
412 + ;;
413 +
414 + suse*|opensuse*|sles*)
415 + package_installer="install_zypper"
416 + tree="suse"
417 + if [ ${IGNORE_INSTALLED} -eq 0 -a -z "${zypper}" ]
418 + then
419 + echo >&2 "command 'zypper' is required to install packages on a '${distribution} ${version}' system."
420 + exit 1
421 + fi
422 + ;;
423 +
424 + *)
425 + # oops! unknown system
426 + user_picks_distribution
427 + ;;
428 + esac
429 +}
430 +
431 +check_package_manager() {
432 + # This is called only when the user is selecting a package manager
433 + # It is used to verify the user selection is right
434 +
435 + echo >&2 "Checking package manager: ${1}"
436 +
437 + case "${1}" in
438 + apt-get)
439 + [ ${IGNORE_INSTALLED} -eq 0 -a -z "${apt_get}" ] && echo >&2 "${1} is not available." && return 1
440 + package_installer="install_apt_get"
441 + tree="debian"
442 + detection="user-input"
443 + return 0
444 + ;;
445 +
446 + dnf)
447 + [ ${IGNORE_INSTALLED} -eq 0 -a -z "${dnf}" ] && echo >&2 "${1} is not available." && return 1
448 + package_installer="install_dnf"
449 + tree="rhel"
450 + detection="user-input"
451 + return 0
452 + ;;
453 +
454 + apk)
455 + [ ${IGNORE_INSTALLED} -eq 0 -a -z "${apk}" ] && echo >&2 "${1} is not available." && return 1
456 + package_installer="install_apk"
457 + tree="alpine"
458 + detection="user-input"
459 + return 0
460 + ;;
461 +
462 + equo)
463 + [ ${IGNORE_INSTALLED} -eq 0 -a -z "${equo}" ] && echo >&2 "${1} is not available." && return 1
464 + package_installer="install_equo"
465 + tree="sabayon"
466 + detection="user-input"
467 + return 0
468 + ;;
469 +
470 + emerge)
471 + [ ${IGNORE_INSTALLED} -eq 0 -a -z "${emerge}" ] && echo >&2 "${1} is not available." && return 1
472 + package_installer="install_emerge"
473 + tree="gentoo"
474 + detection="user-input"
475 + return 0
476 + ;;
477 +
478 + pacman)
479 + [ ${IGNORE_INSTALLED} -eq 0 -a -z "${pacman}" ] && echo >&2 "${1} is not available." && return 1
480 + package_installer="install_pacman"
481 + tree="arch"
482 + detection="user-input"
483 +
484 + return 0
485 + ;;
486 +
487 + zypper)
488 + [ ${IGNORE_INSTALLED} -eq 0 -a -z "${zypper}" ] && echo >&2 "${1} is not available." && return 1
489 + package_installer="install_zypper"
490 + tree="suse"
491 + detection="user-input"
492 + return 0
493 + ;;
494 +
495 + yum)
496 + [ ${IGNORE_INSTALLED} -eq 0 -a -z "${yum}" ] && echo >&2 "${1} is not available." && return 1
497 + package_installer="install_yum"
498 + if [ "${distribution}" = "centos" ]
499 + then
500 + tree="centos"
501 + else
502 + tree="rhel"
503 + fi
504 + detection="user-input"
505 + return 0
506 + ;;
507 +
508 + *)
509 + echo >&2 "Invalid package manager: '${1}'."
510 + return 1
511 + ;;
512 + esac
513 +}
514 +
515 +require_cmd() {
516 + # check if any of the commands given as argument
517 + # are present on this system
518 + # If any of them is available, it returns 0
519 + # otherwise 1
520 +
521 + [ ${IGNORE_INSTALLED} -eq 1 ] && return 1
522 +
523 + local wanted found
524 + for wanted in "${@}"
525 + do
526 + found="$(which "${wanted}" 2>/dev/null)"
527 + [ -z "${found}" ] && found="$(command -v "${wanted}" 2>/dev/null)"
528 + [ ! -z "${found}" -a -x "${found}" ] && return 0
529 + done
530 +
531 + return 1
532 +}
533 +
534 +declare -A pkg_find=(
535 + ['fedora']="findutils"
536 + ['default']="WARNING|"
537 +)
538 +
539 +declare -A pkg_distro_sdk=(
540 + ['alpine']="alpine-sdk"
541 + ['default']="NOTREQUIRED"
542 + )
543 +
544 +declare -A pkg_autoconf=(
545 + ['gentoo']="sys-devel/autoconf"
546 + ['default']="autoconf"
547 + )
548 +
549 +# required to compile netdata with --enable-sse
550 +# https://github.com/firehol/netdata/pull/450
551 +declare -A pkg_autoconf_archive=(
552 + ['gentoo']="sys-devel/autoconf-archive"
553 + ['alpine']="WARNING|"
554 + ['default']="autoconf-archive"
555 +
556 + # exceptions
557 + ['centos-6']="WARNING|"
558 + ['rhel-6']="WARNING|"
559 + ['rhel-7']="WARNING|"
560 + )
561 +
562 +declare -A pkg_autogen=(
563 + ['gentoo']="sys-devel/autogen"
564 + ['alpine']="WARNING|"
565 + ['default']="autogen"
566 +
567 + # exceptions
568 + ['centos-6']="WARNING|"
569 + ['rhel-6']="WARNING|"
570 + ['ubuntu-18']="WARNING|"
571 + )
572 +
573 +declare -A pkg_automake=(
574 + ['gentoo']="sys-devel/automake"
575 + ['default']="automake"
576 + )
577 +
578 +declare -A pkg_bridge_utils=(
579 + ['gentoo']="net-misc/bridge-utils"
580 + ['default']="bridge-utils"
581 + )
582 +
583 +declare -A pkg_chrony=(
584 + ['default']="chrony"
585 + )
586 +
587 +declare -A pkg_curl=(
588 + ['gentoo']="net-misc/curl"
589 + ['sabayon']="net-misc/curl"
590 + ['default']="curl"
591 + )
592 +
593 +declare -A pkg_gzip=(
594 + ['default']="gzip"
595 +)
596 +
597 +declare -A pkg_tar=(
598 + ['default']="tar"
599 + )
600 +
601 +declare -A pkg_git=(
602 + ['gentoo']="dev-vcs/git"
603 + ['default']="git"
604 + )
605 +
606 +declare -A pkg_gcc=(
607 + ['gentoo']="sys-devel/gcc"
608 + ['default']="gcc"
609 + )
610 +
611 +declare -A pkg_gdb=(
612 + ['gentoo']="sys-devel/gdb"
613 + ['default']="gdb"
614 + )
615 +
616 +declare -A pkg_iotop=(
617 + ['default']="iotop"
618 + )
619 +
620 +declare -A pkg_iproute2=(
621 + ['alpine']="iproute2"
622 + ['debian']="iproute2"
623 + ['gentoo']="sys-apps/iproute2"
624 + ['sabayon']="sys-apps/iproute2"
625 + ['default']="iproute"
626 +
627 + # exceptions
628 + ['ubuntu-12.04']="iproute"
629 + )
630 +
631 +declare -A pkg_ipset=(
632 + ['gentoo']="net-firewall/ipset"
633 + ['default']="ipset"
634 + )
635 +
636 +declare -A pkg_jq=(
637 + ['gentoo']="app-misc/jq"
638 + ['default']="jq"
639 + )
640 +
641 +declare -A pkg_iptables=(
642 + ['gentoo']="net-firewall/iptables"
643 + ['default']="iptables"
644 + )
645 +
646 +declare -A pkg_libz_dev=(
647 + ['alpine']="zlib-dev"
648 + ['arch']="zlib"
649 + ['centos']="zlib-devel"
650 + ['debian']="zlib1g-dev"
651 + ['gentoo']="sys-libs/zlib"
652 + ['sabayon']="sys-libs/zlib"
653 + ['rhel']="zlib-devel"
654 + ['suse']="zlib-devel"
655 + ['default']=""
656 + )
657 +
658 +declare -A pkg_libuuid_dev=(
659 + ['alpine']="util-linux-dev"
660 + ['arch']="util-linux"
661 + ['centos']="libuuid-devel"
662 + ['debian']="uuid-dev"
663 + ['gentoo']="sys-apps/util-linux"
664 + ['sabayon']="sys-apps/util-linux"
665 + ['rhel']="libuuid-devel"
666 + ['suse']="libuuid-devel"
667 + ['default']=""
668 + )
669 +
670 +declare -A pkg_libmnl_dev=(
671 + ['alpine']="libmnl-dev"
672 + ['arch']="libmnl"
673 + ['centos']="libmnl-devel"
674 + ['debian']="libmnl-dev"
675 + ['gentoo']="net-libs/libmnl"
676 + ['sabayon']="net-libs/libmnl"
677 + ['rhel']="libmnl-devel"
678 + ['suse']="libmnl-devel"
679 + ['default']=""
680 + )
681 +
682 +declare -A pkg_lm_sensors=(
683 + ['alpine']="lm_sensors"
684 + ['arch']="lm_sensors"
685 + ['centos']="lm_sensors"
686 + ['debian']="lm-sensors"
687 + ['gentoo']="sys-apps/lm_sensors"
688 + ['sabayon']="sys-apps/lm_sensors"
689 + ['rhel']="lm_sensors"
690 + ['suse']="sensors"
691 + ['default']="lm_sensors"
692 + )
693 +
694 +declare -A pkg_logwatch=(
695 + ['default']="logwatch"
696 + )
697 +
698 +declare -A pkg_lxc=(
699 + ['default']="lxc"
700 + )
701 +
702 +declare -A pkg_mailutils=(
703 + ['default']="mailutils"
704 + )
705 +
706 +declare -A pkg_make=(
707 + ['gentoo']="sys-devel/make"
708 + ['default']="make"
709 + )
710 +
711 +declare -A pkg_netcat=(
712 + ['alpine']="netcat-openbsd"
713 + ['arch']="netcat"
714 + ['centos']="nmap-ncat"
715 + ['debian']="netcat"
716 + ['gentoo']="net-analyzer/netcat"
717 + ['sabayon']="net-analyzer/gnu-netcat"
718 + ['rhel']="nmap-ncat"
719 + ['suse']="netcat-openbsd"
720 + ['default']="netcat"
721 +
722 + # exceptions
723 + ['centos-6']="nc"
724 + ['rhel-6']="nc"
725 + )
726 +
727 +declare -A pkg_nginx=(
728 + ['gentoo']="www-servers/nginx"
729 + ['default']="nginx"
730 + )
731 +
732 +declare -A pkg_nodejs=(
733 + ['gentoo']="net-libs/nodejs"
734 + ['default']="nodejs"
735 +
736 + # exceptions
737 + ['rhel-6']="WARNING|To install nodejs check: https://nodejs.org/en/download/package-manager/"
738 + ['rhel-7']="WARNING|To install nodejs check: https://nodejs.org/en/download/package-manager/"
739 + ['centos-6']="WARNING|To install nodejs check: https://nodejs.org/en/download/package-manager/"
740 + ['debian-6']="WARNING|To install nodejs check: https://nodejs.org/en/download/package-manager/"
741 + ['debian-7']="WARNING|To install nodejs check: https://nodejs.org/en/download/package-manager/"
742 + )
743 +
744 +declare -A pkg_postfix=(
745 + ['default']="postfix"
746 + )
747 +
748 +declare -A pkg_pkg_config=(
749 + ['alpine']="pkgconfig"
750 + ['arch']="pkgconfig"
751 + ['centos']="pkgconfig"
752 + ['debian']="pkg-config"
753 + ['gentoo']="dev-util/pkgconfig"
754 + ['sabayon']="virtual/pkgconfig"
755 + ['rhel']="pkgconfig"
756 + ['suse']="pkg-config"
757 + ['default']="pkg-config"
758 + )
759 +
760 +declare -A pkg_python=(
761 + ['gentoo']="dev-lang/python"
762 + ['sabayon']="dev-lang/python:2.7"
763 + ['default']="python"
764 +
765 + # Exceptions
766 + ['centos-8']="python2"
767 + )
768 +
769 +declare -A pkg_python_mysqldb=(
770 + ['alpine']="py-mysqldb"
771 + ['arch']="mysql-python"
772 + ['centos']="MySQL-python"
773 + ['debian']="python-mysqldb"
774 + ['gentoo']="dev-python/mysqlclient"
775 + ['sabayon']="dev-python/mysqlclient"
776 + ['rhel']="MySQL-python"
777 + ['suse']="python-PyMySQL"
778 + ['default']="python-mysql"
779 +
780 + # exceptions
781 + ['fedora-24']="python2-mysql"
782 + )
783 +
784 +declare -A pkg_python3_mysqldb=(
785 + ['alpine']="WARNING|"
786 + ['arch']="WARNING|"
787 + ['centos']="WARNING|"
788 + ['debian']="python3-mysqldb"
789 + ['gentoo']="dev-python/mysqlclient"
790 + ['sabayon']="dev-python/mysqlclient"
791 + ['rhel']="WARNING|"
792 + ['suse']="WARNING|"
793 + ['default']="WARNING|"
794 +
795 + # exceptions
796 + ['debian-6']="WARNING|"
797 + ['debian-7']="WARNING|"
798 + ['debian-8']="WARNING|"
799 + ['ubuntu-12.04']="WARNING|"
800 + ['ubuntu-12.10']="WARNING|"
801 + ['ubuntu-13.04']="WARNING|"
802 + ['ubuntu-13.10']="WARNING|"
803 + ['ubuntu-14.04']="WARNING|"
804 + ['ubuntu-14.10']="WARNING|"
805 + ['ubuntu-15.04']="WARNING|"
806 + ['ubuntu-15.10']="WARNING|"
807 + )
808 +
809 +declare -A pkg_python_psycopg2=(
810 + ['alpine']="py-psycopg2"
811 + ['arch']="python2-psycopg2"
812 + ['centos']="python-psycopg2"
813 + ['debian']="python-psycopg2"
814 + ['gentoo']="dev-python/psycopg"
815 + ['sabayon']="dev-python/psycopg:2"
816 + ['rhel']="python-psycopg2"
817 + ['suse']="python-psycopg2"
818 + ['default']="python-psycopg2"
819 + )
820 +
821 +declare -A pkg_python3_psycopg2=(
822 + ['alpine']="py3-psycopg2"
823 + ['arch']="python-psycopg2"
824 + ['centos']="WARNING|"
825 + ['debian']="WARNING|"
826 + ['gentoo']="dev-python/psycopg"
827 + ['sabayon']="dev-python/psycopg:2"
828 + ['rhel']="WARNING|"
829 + ['suse']="WARNING|"
830 + ['default']="WARNING|"
831 + )
832 +
833 +declare -A pkg_python_pip=(
834 + ['alpine']="py-pip"
835 + ['gentoo']="dev-python/pip"
836 + ['sabayon']="dev-python/pip"
837 + ['default']="python-pip"
838 + )
839 +
840 +declare -A pkg_python3_pip=(
841 + ['alpine']="py3-pip"
842 + ['arch']="python-pip"
843 + ['centos']="WARNING|"
844 + ['gentoo']="dev-python/pip"
845 + ['sabayon']="dev-python/pip"
846 + ['rhel']="WARNING|"
847 + ['default']="python3-pip"
848 + )
849 +
850 +declare -A pkg_python_pymongo=(
851 + ['alpine']="WARNING|"
852 + ['arch']="python2-pymongo"
853 + ['centos']="WARNING|"
854 + ['debian']="python-pymongo"
855 + ['gentoo']="dev-python/pymongo"
856 + ['suse']="python-pymongo"
857 + ['default']="python-pymongo"
858 + )
859 +
860 +declare -A pkg_python3_pymongo=(
861 + ['alpine']="WARNING|"
862 + ['arch']="python-pymongo"
863 + ['centos']="WARNING|"
864 + ['debian']="python3-pymongo"
865 + ['gentoo']="dev-python/pymongo"
866 + ['suse']="python3-pymongo"
867 + ['default']="python3-pymongo"
868 + )
869 +
870 +declare -A pkg_python_requests=(
871 + ['alpine']="py-requests"
872 + ['arch']="python2-requests"
873 + ['centos']="python-requests"
874 + ['debian']="python-requests"
875 + ['gentoo']="dev-python/requests"
876 + ['sabayon']="dev-python/requests"
877 + ['rhel']="python-requests"
878 + ['suse']="python-requests"
879 + ['default']="python-requests"
880 +
881 + ['alpine-3.1.4']="WARNING|"
882 + ['alpine-3.2.3']="WARNING|"
883 + )
884 +
885 +declare -A pkg_python3_requests=(
886 + ['alpine']="py3-requests"
887 + ['arch']="python-requests"
888 + ['centos']="WARNING|"
889 + ['debian']="WARNING|"
890 + ['gentoo']="dev-python/requests"
891 + ['sabayon']="dev-python/requests"
892 + ['rhel']="WARNING|"
893 + ['suse']="WARNING|"
894 + ['default']="WARNING|"
895 + )
896 +
897 +declare -A pkg_lz4=(
898 + ['alpine']="lz4-dev"
899 + ['debian']="liblz4-dev"
900 + ['ubuntu']="liblz4-dev"
901 + ['suse']="liblz4-devel"
902 + ['gentoo']="app-arch/lz4"
903 + ['default']="lz4-devel"
904 + )
905 +
906 +declare -A pkg_libuv=(
907 + ['alpine']="libuv-dev"
908 + ['debian']="libuv1-dev"
909 + ['ubuntu']="libuv1-dev"
910 + ['gentoo']="dev-libs/libuv"
911 + ['arch']="libuv"
912 + ['default']="libuv-devel"
913 + )
914 +
915 +declare -A pkg_openssl=(
916 + ['alpine']="openssl-dev"
917 + ['debian']="libssl-dev"
918 + ['ubuntu']="libssl-dev"
919 + ['suse']="libopenssl-devel"
920 + ['default']="openssl-devel"
921 + )
922 +
923 +declare -A pkg_judy=(
924 + ['alpine']="WARNING|" # TODO - need to add code to download and install judy for alpine case
925 + ['debian']="libjudy-dev"
926 + ['ubuntu']="libjudy-dev"
927 + ['suse']="judy-devel"
928 + ['gentoo']="dev-libs/judy"
929 + ['arch']="judy"
930 + ['default']="Judy-devel"
931 + )
932 +
933 +declare -A pkg_python3=(
934 + ['gentoo']="dev-lang/python"
935 + ['sabayon']="dev-lang/python:3.4"
936 + ['default']="python3"
937 +
938 + # exceptions
939 + ['centos-6']="WARNING|"
940 + )
941 +
942 +declare -A pkg_screen=(
943 + ['gentoo']="app-misc/screen"
944 + ['sabayon']="app-misc/screen"
945 + ['default']="screen"
946 + )
947 +
948 +declare -A pkg_sudo=(
949 + ['default']="sudo"
950 + )
951 +
952 +declare -A pkg_sysstat=(
953 + ['default']="sysstat"
954 + )
955 +
956 +declare -A pkg_tcpdump=(
957 + ['gentoo']="net-analyzer/tcpdump"
958 + ['default']="tcpdump"
959 + )
960 +
961 +declare -A pkg_traceroute=(
962 + ['alpine']=" "
963 + ['gentoo']="net-analyzer/traceroute"
964 + ['default']="traceroute"
965 + )
966 +
967 +declare -A pkg_valgrind=(
968 + ['gentoo']="dev-util/valgrind"
969 + ['default']="valgrind"
970 + )
971 +
972 +declare -A pkg_ulogd=(
973 + ['centos']="WARNING|"
974 + ['rhel']="WARNING|"
975 + ['gentoo']="app-admin/ulogd"
976 + ['default']="ulogd2"
977 + )
978 +
979 +declare -A pkg_unzip=(
980 + ['gentoo']="app-arch/unzip"
981 + ['default']="unzip"
982 + )
983 +
984 +declare -A pkg_zip=(
985 + ['gentoo']="app-arch/zip"
986 + ['default']="zip"
987 + )
988 +
989 +validate_installed_package() {
990 + validate_${package_installer} "${p}"
991 +}
992 +
993 +suitable_package() {
994 + local package="${1//-/_}" p= v="${version//.*/}"
995 +
996 + # echo >&2 "Searching for ${package}..."
997 +
998 + eval "p=\${pkg_${package}['${distribution,,}-${version,,}']}"
999 + [ -z "${p}" ] && eval "p=\${pkg_${package}['${distribution,,}-${v,,}']}"
1000 + [ -z "${p}" ] && eval "p=\${pkg_${package}['${distribution,,}']}"
1001 + [ -z "${p}" ] && eval "p=\${pkg_${package}['${tree}-${version}']}"
1002 + [ -z "${p}" ] && eval "p=\${pkg_${package}['${tree}-${v}']}"
1003 + [ -z "${p}" ] && eval "p=\${pkg_${package}['${tree}']}"
1004 + [ -z "${p}" ] && eval "p=\${pkg_${package}['default']}"
1005 +
1006 + if [[ "${p/|*}" =~ ^(ERROR|WARNING|INFO)$ ]]
1007 + then
1008 + echo >&2 "${p/|*/}"
1009 + echo >&2 "package ${1} is not available in this system."
1010 + if [ -z "${p/*|/}" ]
1011 + then
1012 + echo >&2 "You may try to install without it."
1013 + else
1014 + echo >&2 "${p/*|/}"
1015 + fi
1016 + echo >&2
1017 + return 1
1018 + elif [ "${p}" = "NOTREQUIRED" ]
1019 + then
1020 + return 0
1021 + elif [ -z "${p}" ]
1022 + then
1023 + echo >&2 "WARNING"
1024 + echo >&2 "package ${1} is not availabe in this system."
1025 + echo >&2
1026 + return 1
1027 + else
1028 + if [ ${IGNORE_INSTALLED} -eq 0 ]
1029 + then
1030 + validate_installed_package "${p}"
1031 + else
1032 + echo "${p}"
1033 + fi
1034 + return 0
1035 + fi
1036 +}
1037 +
1038 +packages() {
1039 + # detect the packages we need to install on this system
1040 +
1041 + # -------------------------------------------------------------------------
1042 + # basic build environment
1043 +
1044 + suitable_package distro-sdk
1045 +
1046 + require_cmd git || suitable_package git
1047 + require_cmd find || suitable_package find
1048 +
1049 + require_cmd gcc || \
1050 + require_cmd gcc-multilib || suitable_package gcc
1051 +
1052 + require_cmd make || suitable_package make
1053 + require_cmd autoconf || suitable_package autoconf
1054 + suitable_package autoconf-archive
1055 + require_cmd autogen || suitable_package autogen
1056 + require_cmd automake || suitable_package automake
1057 + require_cmd pkg-config || suitable_package pkg-config
1058 +
1059 + # -------------------------------------------------------------------------
1060 + # debugging tools for development
1061 +
1062 + if [ ${PACKAGES_DEBUG} -ne 0 ]
1063 + then
1064 + require_cmd traceroute || suitable_package traceroute
1065 + require_cmd tcpdump || suitable_package tcpdump
1066 + require_cmd screen || suitable_package screen
1067 +
1068 + if [ ${PACKAGES_NETDATA} -ne 0 ]
1069 + then
1070 + require_cmd gdb || suitable_package gdb
1071 + require_cmd valgrind || suitable_package valgrind
1072 + fi
1073 + fi
1074 +
1075 + # -------------------------------------------------------------------------
1076 + # common command line tools
1077 +
1078 + if [ ${PACKAGES_NETDATA} -ne 0 ]
1079 + then
1080 + require_cmd tar || suitable_package tar
1081 + require_cmd curl || suitable_package curl
1082 + require_cmd gzip || suitable_package gzip
1083 + require_cmd nc || suitable_package netcat
1084 + fi
1085 +
1086 + # -------------------------------------------------------------------------
1087 + # firehol/fireqos/update-ipsets command line tools
1088 +
1089 + if [ ${PACKAGES_FIREQOS} -ne 0 ]
1090 + then
1091 + require_cmd ip || suitable_package iproute2
1092 + fi
1093 +
1094 + if [ ${PACKAGES_FIREHOL} -ne 0 ]
1095 + then
1096 + require_cmd iptables || suitable_package iptables
1097 + require_cmd ipset || suitable_package ipset
1098 + require_cmd ulogd ulogd2 || suitable_package ulogd
1099 + require_cmd traceroute || suitable_package traceroute
1100 + require_cmd bridge || suitable_package bridge-utils
1101 + fi
1102 +
1103 + if [ ${PACKAGES_UPDATE_IPSETS} -ne 0 ]
1104 + then
1105 + require_cmd ipset || suitable_package ipset
1106 + require_cmd zip || suitable_package zip
1107 + require_cmd funzip || suitable_package unzip
1108 + fi
1109 +
1110 + # -------------------------------------------------------------------------
1111 + # netdata libraries
1112 +
1113 + if [ ${PACKAGES_NETDATA} -ne 0 ]
1114 + then
1115 + suitable_package libz-dev
1116 + suitable_package libuuid-dev
1117 + suitable_package libmnl-dev
1118 + fi
1119 +
1120 + # -------------------------------------------------------------------------
1121 + # sensors
1122 +
1123 + if [ ${PACKAGES_NETDATA_SENSORS} -ne 0 ]
1124 + then
1125 + require_cmd sensors || suitable_package lm_sensors
1126 + fi
1127 +
1128 + # -------------------------------------------------------------------------
1129 + # sensors
1130 + if [ ${PACKAGES_NETDATA_DATABASE} -ne 0 ]
1131 + then
1132 + suitable_package libuv
1133 + suitable_package lz4
1134 + suitable_package openssl
1135 + suitable_package judy
1136 + fi
1137 +
1138 + # -------------------------------------------------------------------------
1139 + # scripting interpreters for netdata plugins
1140 +
1141 + if [ ${PACKAGES_NETDATA_NODEJS} -ne 0 ]
1142 + then
1143 + require_cmd nodejs node js || suitable_package nodejs
1144 + fi
1145 +
1146 + # -------------------------------------------------------------------------
1147 + # python2
1148 +
1149 + if [ ${PACKAGES_NETDATA_PYTHON} -ne 0 ]
1150 + then
1151 + require_cmd python || suitable_package python
1152 +
1153 + [ ${PACKAGES_NETDATA_PYTHON_MONGO} -ne 0 ] && suitable_package python-pymongo
1154 + # suitable_package python-requests
1155 + # suitable_package python-pip
1156 +
1157 + [ ${PACKAGES_NETDATA_PYTHON_MYSQL} -ne 0 ] && suitable_package python-mysqldb
1158 + [ ${PACKAGES_NETDATA_PYTHON_POSTGRES} -ne 0 ] && suitable_package python-psycopg2
1159 + fi
1160 +
1161 + # -------------------------------------------------------------------------
1162 + # python3
1163 +
1164 + if [ ${PACKAGES_NETDATA_PYTHON3} -ne 0 ]
1165 + then
1166 + require_cmd python3 || suitable_package python3
1167 +
1168 + suitable_package python3-pymongo
1169 + [ ${PACKAGES_NETDATA_PYTHON_MONGO} -ne 0 ] && suitable_package python3-pymongo
1170 + # suitable_package python3-requests
1171 + # suitable_package python3-pip
1172 +
1173 + [ ${PACKAGES_NETDATA_PYTHON_MYSQL} -ne 0 ] && suitable_package python3-mysqldb
1174 + [ ${PACKAGES_NETDATA_PYTHON_POSTGRES} -ne 0 ] && suitable_package python3-psycopg2
1175 + fi
1176 +
1177 + # -------------------------------------------------------------------------
1178 + # applications needed for the netdata demo sites
1179 +
1180 + if [ ${PACKAGES_NETDATA_DEMO_SITE} -ne 0 ]
1181 + then
1182 + require_cmd sudo || suitable_package sudo
1183 + require_cmd jq || suitable_package jq
1184 + require_cmd nginx || suitable_package nginx
1185 + require_cmd postconf || suitable_package postfix
1186 + require_cmd lxc-create || suitable_package lxc
1187 + require_cmd logwatch || suitable_package logwatch
1188 + require_cmd mail || suitable_package mailutils
1189 + require_cmd iostat || suitable_package sysstat
1190 + require_cmd iotop || suitable_package iotop
1191 + fi
1192 +}
1193 +
1194 +DRYRUN=0
1195 +run() {
1196 +
1197 + printf >&2 "%q " "${@}"
1198 + printf >&2 "\n"
1199 +
1200 + if [ ! "${DRYRUN}" -eq 1 ]
1201 + then
1202 + "${@}"
1203 + return $?
1204 + fi
1205 + return 0
1206 +}
1207 +
1208 +sudo=
1209 +if [ ${UID} -ne 0 ]
1210 + then
1211 + sudo="sudo"
1212 +fi
1213 +
1214 +# -----------------------------------------------------------------------------
1215 +# debian / ubuntu
1216 +
1217 +validate_install_apt_get() {
1218 + echo >&2 " > Checking if package '${*}' is installed..."
1219 + [ "$(dpkg-query -W --showformat='${Status}\n' "${*}")" = "install ok installed" ] || echo "${*}"
1220 +}
1221 +
1222 +install_apt_get() {
1223 + # download the latest package info
1224 + if [ "${DRYRUN}" -eq 1 ]
1225 + then
1226 + echo >&2 " >> IMPORTANT << "
1227 + echo >&2 " Please make sure your system is up to date"
1228 + echo >&2 " by running: ${sudo} apt-get update "
1229 + echo >&2
1230 + fi
1231 +
1232 + local opts=""
1233 + if [ ${NON_INTERACTIVE} -eq 1 ]
1234 + then
1235 + echo >&2 "Running in non-interactive mode"
1236 + # http://serverfault.com/questions/227190/how-do-i-ask-apt-get-to-skip-any-interactive-post-install-configuration-steps
1237 + export DEBIAN_FRONTEND="noninteractive"
1238 + opts="${opts} -yq"
1239 + fi
1240 +
1241 + # install the required packages
1242 + for pkg in "${@}"; do
1243 + [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}"
1244 + run ${sudo} apt-get ${opts} install "${pkg}"
1245 + done
1246 +}
1247 +
1248 +
1249 +# -----------------------------------------------------------------------------
1250 +# centos / rhel
1251 +
1252 +validate_install_yum() {
1253 + echo >&2 " > Checking if package '${*}' is installed..."
1254 + yum list installed "${*}" >/dev/null 2>&1 || echo "${*}"
1255 +}
1256 +
1257 +install_yum() {
1258 + # download the latest package info
1259 + if [ "${DRYRUN}" -eq 1 ]
1260 + then
1261 + echo >&2 " >> IMPORTANT << "
1262 + echo >&2 " Please make sure your system is up to date"
1263 + echo >&2 " by running: ${sudo} yum update "
1264 + echo >&2
1265 + fi
1266 +
1267 + local opts=
1268 + if [ ${NON_INTERACTIVE} -eq 1 ]
1269 + then
1270 + echo >&2 "Running in non-interactive mode"
1271 + # http://unix.stackexchange.com/questions/87822/does-yum-have-an-equivalent-to-apt-aptitudes-debian-frontend-noninteractive
1272 + opts="-y"
1273 + fi
1274 +
1275 + # install the required packages
1276 + run ${sudo} yum ${opts} install "${@}" # --enablerepo=epel-testing
1277 +}
1278 +
1279 +
1280 +# -----------------------------------------------------------------------------
1281 +# fedora
1282 +
1283 +validate_install_dnf() {
1284 + echo >&2 " > Checking if package '${*}' is installed..."
1285 + dnf list installed "${*}" >/dev/null 2>&1 || echo "${*}"
1286 +}
1287 +
1288 +install_dnf() {
1289 + # download the latest package info
1290 + if [ "${DRYRUN}" -eq 1 ]
1291 + then
1292 + echo >&2 " >> IMPORTANT << "
1293 + echo >&2 " Please make sure your system is up to date"
1294 + echo >&2 " by running: ${sudo} dnf update "
1295 + echo >&2
1296 + fi
1297 +
1298 + local opts=
1299 + if [ ${NON_INTERACTIVE} -eq 1 ]
1300 + then
1301 + echo >&2 "Running in non-interactive mode"
1302 + # man dnf
1303 + opts="-y"
1304 + fi
1305 +
1306 + # install the required packages
1307 + # --setopt=strict=0 allows dnf to proceed
1308 + # installing whatever is available
1309 + # even if a package is not found
1310 + opts="$opts --setopt=strict=0"
1311 + run ${sudo} dnf ${opts} install "${@}"
1312 +}
1313 +
1314 +# -----------------------------------------------------------------------------
1315 +# gentoo
1316 +
1317 +validate_install_emerge() {
1318 + echo "${*}"
1319 +}
1320 +
1321 +install_emerge() {
1322 + # download the latest package info
1323 + # we don't do this for emerge - it is very slow
1324 + # and most users are expected to do this daily
1325 + # emerge --sync
1326 + if [ "${DRYRUN}" -eq 1 ]
1327 + then
1328 + echo >&2 " >> IMPORTANT << "
1329 + echo >&2 " Please make sure your system is up to date"
1330 + echo >&2 " by running: ${sudo} emerge --sync or ${sudo} eix-sync "
1331 + echo >&2
1332 + fi
1333 +
1334 + local opts="--ask"
1335 + if [ ${NON_INTERACTIVE} -eq 1 ]
1336 + then
1337 + echo >&2 "Running in non-interactive mode"
1338 + opts=""
1339 + fi
1340 +
1341 + # install the required packages
1342 + for pkg in "${@}"; do
1343 + [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}"
1344 + run ${sudo} emerge ${opts} -v --noreplace "${pkg}"
1345 + done
1346 +}
1347 +
1348 +
1349 +# -----------------------------------------------------------------------------
1350 +# alpine
1351 +
1352 +validate_install_apk() {
1353 + echo "${*}"
1354 +}
1355 +
1356 +install_apk() {
1357 + # download the latest package info
1358 + if [ "${DRYRUN}" -eq 1 ]
1359 + then
1360 + echo >&2 " >> IMPORTANT << "
1361 + echo >&2 " Please make sure your system is up to date"
1362 + echo >&2 " by running: ${sudo} apk update "
1363 + echo >&2
1364 + fi
1365 +
1366 + local opts="--force-broken-world"
1367 + if [ ${NON_INTERACTIVE} -eq 1 ]
1368 + then
1369 + echo >&2 "Running in non-interactive mode"
1370 + else
1371 + opts="${opts} -i"
1372 + fi
1373 +
1374 + # install the required packages
1375 + run ${sudo} apk add ${opts} "${@}"
1376 +}
1377 +
1378 +# -----------------------------------------------------------------------------
1379 +# sabayon
1380 +
1381 +validate_install_equo() {
1382 + echo >&2 " > Checking if package '${*}' is installed..."
1383 + equo s --installed "${*}" >/dev/null 2>&1 || echo "${*}"
1384 +}
1385 +
1386 +install_equo() {
1387 + # download the latest package info
1388 + if [ "${DRYRUN}" -eq 1 ]
1389 + then
1390 + echo >&2 " >> IMPORTANT << "
1391 + echo >&2 " Please make sure your system is up to date"
1392 + echo >&2 " by running: ${sudo} equo up "
1393 + echo >&2
1394 + fi
1395 +
1396 + local opts="-av"
1397 + if [ ${NON_INTERACTIVE} -eq 1 ]
1398 + then
1399 + echo >&2 "Running in non-interactive mode"
1400 + opts="-v"
1401 + fi
1402 +
1403 + # install the required packages
1404 + for pkg in "${@}"; do
1405 + [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}"
1406 + run ${sudo} equo i ${opts} "${pkg}"
1407 + done
1408 +}
1409 +
1410 +# -----------------------------------------------------------------------------
1411 +# arch
1412 +
1413 +PACMAN_DB_SYNCED=0
1414 +validate_install_pacman() {
1415 +
1416 + if [ ${PACMAN_DB_SYNCED} -eq 0 ]; then
1417 + echo >&2 " > Running pacman -Sy to sync the database"
1418 + local x=$(pacman -Sy)
1419 + [ ! -n "${x}" ] && echo "${*}"
1420 + PACMAN_DB_SYNCED=1
1421 + fi;
1422 + echo >&2 " > Checking if package '${*}' is installed..."
1423 +
1424 + # In pacman, you can utilize alternative flags to exactly match package names,
1425 + # but is highly likely we require pattern matching too in this so we keep -s and match
1426 + # the exceptional cases like so
1427 + local x=""
1428 + case "${package}" in
1429 + "gcc")
1430 + # Temporary workaround: In archlinux, default installation includes runtime libs under package "gcc"
1431 + # These are not sufficient for netdata install, so we need to make sure that the appropriate libraries are there
1432 + # by ensuring devel libs are available
1433 + x=$(pacman -Qs "${*}" | grep "base-devel")
1434 + ;;
1435 + "tar")
1436 + x=$(pacman -Qs "${*}" | grep "local/tar")
1437 + ;;
1438 + "make")
1439 + x=$(pacman -Qs "${*}" | grep "local/make ")
1440 + ;;
1441 + *)
1442 + x=$(pacman -Qs "${*}")
1443 + ;;
1444 + esac
1445 +
1446 + [ ! -n "${x}" ] && echo "${*}"
1447 +}
1448 +
1449 +install_pacman() {
1450 + # download the latest package info
1451 + if [ "${DRYRUN}" -eq 1 ]
1452 + then
1453 + echo >&2 " >> IMPORTANT << "
1454 + echo >&2 " Please make sure your system is up to date"
1455 + echo >&2 " by running: ${sudo} pacman -Syu "
1456 + echo >&2
1457 + fi
1458 +
1459 + # install the required packages
1460 + if [ ${NON_INTERACTIVE} -eq 1 ]
1461 + then
1462 + echo >&2 "Running in non-interactive mode"
1463 + # http://unix.stackexchange.com/questions/52277/pacman-option-to-assume-yes-to-every-question/52278
1464 + for pkg in "${@}"; do
1465 + [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}"
1466 + # Try the noconfirm option, if that fails, go with the legacy way for non-interactive
1467 + run ${sudo} pacman --noconfirm --needed -S "${pkg}" || yes | run ${sudo} pacman --needed -S "${pkg}"
1468 + done
1469 +
1470 + else
1471 + for pkg in "${@}"; do
1472 + [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}"
1473 + run ${sudo} pacman --needed -S "${pkg}"
1474 + done
1475 + fi
1476 +}
1477 +
1478 +# -----------------------------------------------------------------------------
1479 +# suse / opensuse
1480 +
1481 +validate_install_zypper() {
1482 + rpm -q "${*}" >/dev/null 2>&1 || echo "${*}"
1483 +}
1484 +
1485 +install_zypper() {
1486 + # download the latest package info
1487 + if [ "${DRYRUN}" -eq 1 ]
1488 + then
1489 + echo >&2 " >> IMPORTANT << "
1490 + echo >&2 " Please make sure your system is up to date"
1491 + echo >&2 " by running: ${sudo} zypper update "
1492 + echo >&2
1493 + fi
1494 +
1495 + local opts="--ignore-unknown"
1496 + if [ ${NON_INTERACTIVE} -eq 1 ]
1497 + then
1498 + echo >&2 "Running in non-interactive mode"
1499 + # http://unix.stackexchange.com/questions/82016/how-to-use-zypper-in-bash-scripts-for-someone-coming-from-apt-get
1500 + opts="${opts} --non-interactive"
1501 + fi
1502 +
1503 + # install the required packages
1504 + run ${sudo} zypper ${opts} install "${@}"
1505 +}
1506 +
1507 +install_failed() {
1508 + local ret="${1}"
1509 + cat <<EOF
1510 +
1511 +
1512 +
1513 +We are very sorry!
1514 +
1515 +Installation of required packages failed.
1516 +
1517 +What to do now:
1518 +
1519 + 1. Make sure your system is updated.
1520 + Most of the times, updating your system will resolve the issue.
1521 +
1522 + 2. If the error message is about a specific package, try removing
1523 + that package from the command and run it again.
1524 + Depending on the broken package, you may be able to continue.
1525 +
1526 + 3. Let us know. We may be able to help.
1527 + Open a github issue with the above log, at:
1528 +
1529 + https://github.com/firehol/netdata/issues
1530 +
1531 +
1532 +EOF
1533 + remote_log "FAILED" ${ret}
1534 + exit 1
1535 +}
1536 +
1537 +remote_log() {
1538 + # log success or failure on our system
1539 + # to help us solve installation issues
1540 + curl >/dev/null 2>&1 -Ss --max-time 3 "https://registry.my-netdata.io/log/installer?status=${1}&error=${2}&distribution=${distribution}&version=${version}&installer=${package_installer}&tree=${tree}&detection=${detection}&netdata=${PACKAGES_NETDATA}&nodejs=${PACKAGES_NETDATA_NODEJS}&python=${PACKAGES_NETDATA_PYTHON}&python3=${PACKAGES_NETDATA_PYTHON3}&mysql=${PACKAGES_NETDATA_PYTHON_MYSQL}&postgres=${PACKAGES_NETDATA_PYTHON_POSTGRES}&pymongo=${PACKAGES_NETDATA_PYTHON_MONGO}&sensors=${PACKAGES_NETDATA_SENSORS}&database=${PACKAGE_NETDATA_DATABASE}&firehol=${PACKAGES_FIREHOL}&fireqos=${PACKAGES_FIREQOS}&iprange=${PACKAGES_IPRANGE}&update_ipsets=${PACKAGES_UPDATE_IPSETS}&demo=${PACKAGES_NETDATA_DEMO_SITE}"
1541 +}
1542 +
1543 +if [ -z "${1}" ]
1544 + then
1545 + usage
1546 + exit 1
1547 +fi
1548 +
1549 +# parse command line arguments
1550 +DONT_WAIT=0
1551 +NON_INTERACTIVE=0
1552 +IGNORE_INSTALLED=0
1553 +while [ ! -z "${1}" ]
1554 +do
1555 + case "${1}" in
1556 + distribution)
1557 + distribution="${2}"
1558 + shift
1559 + ;;
1560 +
1561 + version)
1562 + version="${2}"
1563 + shift
1564 + ;;
1565 +
1566 + codename)
1567 + codename="${2}"
1568 + shift
1569 + ;;
1570 +
1571 + installer)
1572 + check_package_manager "${2}" || exit 1
1573 + shift
1574 + ;;
1575 +
1576 + dont-wait|--dont-wait|-n)
1577 + DONT_WAIT=1
1578 + ;;
1579 +
1580 + non-interactive|--non-interactive|-y)
1581 + NON_INTERACTIVE=1
1582 + ;;
1583 +
1584 + ignore-installed|--ignore-installed|-i)
1585 + IGNORE_INSTALLED=1
1586 + ;;
1587 +
1588 + netdata-all)
1589 + PACKAGES_NETDATA=1
1590 + PACKAGES_NETDATA_NODEJS=1
1591 + PACKAGES_NETDATA_PYTHON=1
1592 + PACKAGES_NETDATA_PYTHON_MYSQL=1
1593 + PACKAGES_NETDATA_PYTHON_POSTGRES=1
1594 + PACKAGES_NETDATA_PYTHON_MONGO=1
1595 + PACKAGES_NETDATA_SENSORS=1
1596 + PACKAGES_NETDATA_DATABASE=1
1597 + ;;
1598 +
1599 + netdata)
1600 + PACKAGES_NETDATA=1
1601 + PACKAGES_NETDATA_PYTHON=1
1602 + PACKAGES_NETDATA_DATABASE=1
1603 + ;;
1604 +
1605 + python|netdata-python)
1606 + PACKAGES_NETDATA_PYTHON=1
1607 + ;;
1608 +
1609 + python3|netdata-python3)
1610 + PACKAGES_NETDATA_PYTHON3=1
1611 + ;;
1612 +
1613 + python-mysql|mysql-python|mysqldb|netdata-mysql)
1614 + PACKAGES_NETDATA_PYTHON=1
1615 + PACKAGES_NETDATA_PYTHON_MYSQL=1
1616 + ;;
1617 +
1618 + python-postgres|postgres-python|psycopg2|netdata-postgres)
1619 + PACKAGES_NETDATA_PYTHON=1
1620 + PACKAGES_NETDATA_PYTHON_POSTGRES=1
1621 + ;;
1622 +
1623 + python-pymongo)
1624 + PACKAGES_NETDATA_PYTHON=1
1625 + PACKAGES_NETDATA_PYTHON_MONGO=1
1626 + ;;
1627 +
1628 + nodejs|netdata-nodejs)
1629 + PACKAGES_NETDATA=1
1630 + PACKAGES_NETDATA_NODEJS=1
1631 + PACKAGES_NETDATA_DATABASE=1
1632 + ;;
1633 +
1634 + sensors|netdata-sensors)
1635 + PACKAGES_NETDATA=1
1636 + PACKAGES_NETDATA_PYTHON=1
1637 + PACKAGES_NETDATA_SENSORS=1
1638 + PACKAGES_NETDATA_DATABASE=1
1639 + ;;
1640 +
1641 + firehol|update-ipsets|firehol-all|fireqos)
1642 + PACKAGES_IPRANGE=1
1643 + PACKAGES_FIREHOL=1
1644 + PACKAGES_FIREQOS=1
1645 + PACKAGES_IPRANGE=1
1646 + PACKAGES_UPDATE_IPSETS=1
1647 + ;;
1648 +
1649 + demo|all)
1650 + PACKAGES_NETDATA=1
1651 + PACKAGES_NETDATA_NODEJS=1
1652 + PACKAGES_NETDATA_PYTHON=1
1653 + PACKAGES_NETDATA_PYTHON3=1
1654 + PACKAGES_NETDATA_PYTHON_MYSQL=1
1655 + PACKAGES_NETDATA_PYTHON_POSTGRES=1
1656 + PACKAGES_NETDATA_PYTHON_MONGO=1
1657 + PACKAGES_DEBUG=1
1658 + PACKAGES_IPRANGE=1
1659 + PACKAGES_FIREHOL=1
1660 + PACKAGES_FIREQOS=1
1661 + PACKAGES_UPDATE_IPSETS=1
1662 + PACKAGES_NETDATA_DEMO_SITE=1
1663 + PACKAGES_NETDATA_DATABASE=1
1664 + ;;
1665 +
1666 + help|-h|--help)
1667 + usage
1668 + exit 1
1669 + ;;
1670 +
1671 + *)
1672 + echo >&2 "ERROR: Cannot understand option '${1}'"
1673 + echo >&2
1674 + usage
1675 + exit 1
1676 + ;;
1677 + esac
1678 + shift
1679 +done
1680 +
1681 +# Check for missing core commands like grep, warn the user to install it and bail out cleanly
1682 +if ! command -v grep > /dev/null 2>&1; then
1683 + echo >&2
1684 + echo >&2 "ERROR: 'grep' is required for the install to run correctly and was not found on the system."
1685 + echo >&2 "Please install grep and run the installer again."
1686 + echo >&2
1687 + exit 1
1688 +fi
1689 +
1690 +if [ -z "${package_installer}" -o -z "${tree}" ]
1691 + then
1692 + if [ -z "${distribution}" ]
1693 + then
1694 + # we dont know the distribution
1695 + autodetect_distribution || user_picks_distribution
1696 + fi
1697 +
1698 + # When no package installer is detected, try again from distro info if any
1699 + if [ -z "${package_installer}" ]; then
1700 + detect_package_manager_from_distribution "${distribution}"
1701 + fi
1702 +
1703 +fi
1704 +
1705 +pv=$(python --version 2>&1)
1706 +if [[ "${pv}" =~ ^Python\ 2.* ]]
1707 +then
1708 + pv=2
1709 +elif [[ "${pv}" =~ ^Python\ 3.* ]]
1710 +then
1711 + pv=3
1712 + PACKAGES_NETDATA_PYTHON3=1
1713 +else
1714 + pv=2
1715 +fi
1716 +
1717 +[ "${detection}" = "/etc/os-release" ] && cat <<EOF
1718 +
1719 +/etc/os-release information:
1720 +NAME : ${NAME}
1721 +VERSION : ${VERSION}
1722 +ID : ${ID}
1723 +ID_LIKE : ${ID_LIKE}
1724 +VERSION_ID : ${VERSION_ID}
1725 +EOF
1726 +
1727 +cat <<EOF
1728 +
1729 +We detected these:
1730 +Distribution : ${distribution}
1731 +Version : ${version}
1732 +Codename : ${codename}
1733 +Package Manager : ${package_installer}
1734 +Packages Tree : ${tree}
1735 +Detection Method: ${detection}
1736 +Default Python v: ${pv} $([ ${pv} -eq 2 -a ${PACKAGES_NETDATA_PYTHON3} -eq 1 ] && echo "(will install python3 too)")
1737 +
1738 +EOF
1739 +
1740 +PACKAGES_TO_INSTALL=( $(packages | sort -u) )
1741 +
1742 +if [ ${#PACKAGES_TO_INSTALL[@]} -gt 0 ]
1743 + then
1744 + echo >&2
1745 + echo >&2 "The following command will be run:"
1746 + echo >&2
1747 + DRYRUN=1
1748 + ${package_installer} "${PACKAGES_TO_INSTALL[@]}"
1749 + DRYRUN=0
1750 + echo >&2
1751 + echo >&2
1752 +
1753 + if [ ${DONT_WAIT} -eq 0 -a ${NON_INTERACTIVE} -eq 0 ]
1754 + then
1755 + read -p "Press ENTER to run it > " || exit 1
1756 + fi
1757 +
1758 + ${package_installer} "${PACKAGES_TO_INSTALL[@]}" || install_failed $?
1759 +
1760 + echo >&2
1761 + echo >&2 "All Done! - Now proceed to the next step."
1762 + echo >&2
1763 +
1764 +else
1765 + echo >&2
1766 + echo >&2 "All required packages are already installed. Now proceed to the next step."
1767 + echo >&2
1768 +fi
1769 +
1770 +remote_log "OK"
1771 +
1772 +exit 0
packaging/installer/kickstart.sh
+1 -1
@@ -27,7 +27,7 @@
27 # shellcheck disable=SC2039,SC2059,SC2086
28
29 # External files
30 -PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh"
30 +PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"
31
32 # ---------------------------------------------------------------------------------------------------------------------
33 # library functions copied from packaging/installer/functions.sh
tests/updater_checks.sh
+1 -1
@@ -68,7 +68,7 @@ esac
68 # Download and run depednency scriptlet, before anything else
69 #
70 deps_tool="/tmp/deps_tool.$$.sh"
71 -curl -Ss -o ${deps_tool} https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh
71 +curl -Ss -o ${deps_tool} https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh
72 if [ -f "${deps_tool}" ]; then
73 echo "Running dependency handling script.."
74 chmod +x "${deps_tool}"