diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2020-03-09 11:15:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 11:15:46 -0400 |
commit | d49e6b50ba4a9ff2237685345acf3ded0dbe7a74 (patch) | |
tree | 71d13bc58c4fd446c119690b384c99dcbae5e464 /packaging/installer/install-required-packages.sh | |
parent | 3d81dfbe0ac441b3fa10b0e823275dd505dd03b5 (diff) |
Added various fixes and improvements to the installers. (#8315)
* Don't rotate old Netdata config dirs in static installer.
This should have been removed when we stopped shipping stock configs in
`/etc/netdata`.
* Use a single invocation of the package manager to install dependencies.
This slightly improves the efficiency of the code in question, and also
eliminates a few dozen potential cases of prompting the user if they
want to install specific packages.
* Add correct package name for ulogd on arch.
* Properly finish conversion to Python 3 defaults.
Diffstat (limited to 'packaging/installer/install-required-packages.sh')
-rwxr-xr-x | packaging/installer/install-required-packages.sh | 115 |
1 files changed, 63 insertions, 52 deletions
diff --git a/packaging/installer/install-required-packages.sh b/packaging/installer/install-required-packages.sh index 60b1ff8e3c..6d2905d760 100755 --- a/packaging/installer/install-required-packages.sh +++ b/packaging/installer/install-required-packages.sh @@ -1032,6 +1032,7 @@ declare -A pkg_ulogd=( ['rhel']="WARNING|" ['clearlinux']="WARNING|" ['gentoo']="app-admin/ulogd" + ['arch']="ulogd" ['default']="ulogd2" ) @@ -1283,10 +1284,7 @@ install_apt_get() { read -r -a apt_opts <<< "$opts" # install the required packages - for pkg in "${@}"; do - [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}" - run ${sudo} apt-get "${apt_opts[@]}" install "${pkg}" - done + run ${sudo} apt-get "${apt_opts[@]}" install "${@}" } # ----------------------------------------------------------------------------- @@ -1450,10 +1448,7 @@ install_emerge() { read -r -a emerge_opts <<< "$opts" # install the required packages - for pkg in "${@}"; do - [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}" - run ${sudo} emerge "${emerge_opts[@]}" -v --noreplace "${pkg}" - done + run ${sudo} emerge "${emerge_opts[@]}" -v --noreplace "${@}" } # ----------------------------------------------------------------------------- @@ -1511,10 +1506,7 @@ install_equo() { read -r -a equo_opts <<< "$opts" # install the required packages - for pkg in "${@}"; do - [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}" - run ${sudo} equo i "${equo_opts[@]}" "${pkg}" - done + run ${sudo} equo i "${equo_opts[@]}" "${@}" } # ----------------------------------------------------------------------------- @@ -1570,17 +1562,10 @@ install_pacman() { if [ "${NON_INTERACTIVE}" -eq 1 ]; then echo >&2 "Running in non-interactive mode" # http://unix.stackexchange.com/questions/52277/pacman-option-to-assume-yes-to-every-question/52278 - for pkg in "${@}"; do - [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}" - # Try the noconfirm option, if that fails, go with the legacy way for non-interactive - run ${sudo} pacman --noconfirm --needed -S "${pkg}" || yes | run ${sudo} pacman --needed -S "${pkg}" - done - + # Try the noconfirm option, if that fails, go with the legacy way for non-interactive + run ${sudo} pacman --noconfirm --needed -S "${@}" || yes | run ${sudo} pacman --needed -S "${@}" else - for pkg in "${@}"; do - [[ ${DRYRUN} -eq 0 ]] && echo >&2 "Adding package ${pkg}" - run ${sudo} pacman --needed -S "${pkg}" - done + run ${sudo} pacman --needed -S "${@}" fi } @@ -1675,6 +1660,17 @@ if [ -z "${1}" ]; then exit 1 fi +pv=$(python --version 2>&1) +if [[ "${pv}" =~ ^Python\ 2.* ]]; then + pv=2 +elif [[ "${pv}" =~ ^Python\ 3.* ]]; then + pv=3 +elif [[ "${tree}" == "centos" ]] && [ "${version}" -lt 8 ]; then + pv=2 +else + pv=3 +fi + # parse command line arguments DONT_WAIT=0 NON_INTERACTIVE=0 @@ -1716,17 +1712,24 @@ while [ -n "${1}" ]; do netdata-all) PACKAGES_NETDATA=1 PACKAGES_NETDATA_NODEJS=1 - PACKAGES_NETDATA_PYTHON=1 - PACKAGES_NETDATA_PYTHON_MYSQL=1 - PACKAGES_NETDATA_PYTHON_POSTGRES=1 - PACKAGES_NETDATA_PYTHON_MONGO=1 + if [ "${pv}" -eq 2 ] ; then + PACKAGES_NETDATA_PYTHON=1 + PACKAGES_NETDATA_PYTHON_MYSQL=1 + PACKAGES_NETDATA_PYTHON_POSTGRES=1 + PACKAGES_NETDATA_PYTHON_MONGO=1 + else + PACKAGES_NETDATA_PYTHON3=1 + PACKAGES_NETDATA_PYTHON3_MYSQL=1 + PACKAGES_NETDATA_PYTHON3_POSTGRES=1 + PACKAGES_NETDATA_PYTHON3_MONGO=1 + fi PACKAGES_NETDATA_SENSORS=1 PACKAGES_NETDATA_DATABASE=1 ;; netdata) PACKAGES_NETDATA=1 - PACKAGES_NETDATA_PYTHON=1 + PACKAGES_NETDATA_PYTHON3=1 PACKAGES_NETDATA_DATABASE=1 ;; @@ -1739,18 +1742,33 @@ while [ -n "${1}" ]; do ;; python-mysql | mysql-python | mysqldb | netdata-mysql) - PACKAGES_NETDATA_PYTHON=1 - PACKAGES_NETDATA_PYTHON_MYSQL=1 + if [ "${pv}" -eq 2 ] ; then + PACKAGES_NETDATA_PYTHON=1 + PACKAGES_NETDATA_PYTHON_MYSQL=1 + else + PACKAGES_NETDATA_PYTHON3=1 + PACKAGES_NETDATA_PYTHON3_MYSQL=1 + fi ;; python-postgres | postgres-python | psycopg2 | netdata-postgres) - PACKAGES_NETDATA_PYTHON=1 - PACKAGES_NETDATA_PYTHON_POSTGRES=1 + if [ "${pv}" -eq 2 ] ; then + PACKAGES_NETDATA_PYTHON=1 + PACKAGES_NETDATA_PYTHON_POSTGRES=1 + else + PACKAGES_NETDATA_PYTHON3=1 + PACKAGES_NETDATA_PYTHON3_POSTGRES=1 + fi ;; python-pymongo) - PACKAGES_NETDATA_PYTHON=1 - PACKAGES_NETDATA_PYTHON_MONGO=1 + if [ "${pv}" -eq 2 ] ; then + PACKAGES_NETDATA_PYTHON=1 + PACKAGES_NETDATA_PYTHON_MONGO=1 + else + PACKAGES_NETDATA_PYTHON3=1 + PACKAGES_NETDATA_PYTHON3_MONGO=1 + fi ;; nodejs | netdata-nodejs) @@ -1761,7 +1779,7 @@ while [ -n "${1}" ]; do sensors | netdata-sensors) PACKAGES_NETDATA=1 - PACKAGES_NETDATA_PYTHON=1 + PACKAGES_NETDATA_PYTHON3=1 PACKAGES_NETDATA_SENSORS=1 PACKAGES_NETDATA_DATABASE=1 ;; @@ -1777,11 +1795,17 @@ while [ -n "${1}" ]; do demo | all) PACKAGES_NETDATA=1 PACKAGES_NETDATA_NODEJS=1 - PACKAGES_NETDATA_PYTHON=1 - PACKAGES_NETDATA_PYTHON3=1 - PACKAGES_NETDATA_PYTHON_MYSQL=1 - PACKAGES_NETDATA_PYTHON_POSTGRES=1 - PACKAGES_NETDATA_PYTHON_MONGO=1 + if [ "${pv}" -eq 2 ] ; then + PACKAGES_NETDATA_PYTHON=1 + PACKAGES_NETDATA_PYTHON_MYSQL=1 + PACKAGES_NETDATA_PYTHON_POSTGRES=1 + PACKAGES_NETDATA_PYTHON_MONGO=1 + else + PACKAGES_NETDATA_PYTHON3=1 + PACKAGES_NETDATA_PYTHON3_MYSQL=1 + PACKAGES_NETDATA_PYTHON3_POSTGRES=1 + PACKAGES_NETDATA_PYTHON3_MONGO=1 + fi PACKAGES_DEBUG=1 PACKAGES_IPRANGE=1 PACKAGES_FIREHOL=1 @@ -1830,19 +1854,6 @@ if [ -z "${package_installer}" ] || [ -z "${tree}" ]; then validate_package_trees fi -pv=$(python --version 2>&1) -if [[ "${pv}" =~ ^Python\ 2.* ]]; then - pv=2 -elif [[ "${pv}" =~ ^Python\ 3.* ]]; then - pv=3 - PACKAGES_NETDATA_PYTHON3=1 -elif [[ "${tree}" == "centos" ]] && [ "${version}" -lt 8 ]; then - pv=2 -else - pv=3 - PACKAGES_NETDATA_PYTHON3=1 -fi - [ "${detection}" = "/etc/os-release" ] && cat << EOF /etc/os-release information: |