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