diff options
author | James Mills <prologic@shortcircuit.net.au> | 2020-05-07 03:34:36 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-07 03:34:36 +1000 |
commit | 935eb39007f7ea3726df46907c5e1d953958e395 (patch) | |
tree | f2366df1c766dd89b91521010b90674f5b70f098 /netdata-installer.sh | |
parent | b07904f779273d525d9a1810b6159bb762d5c877 (diff) |
Fix missing NETDATA_STOP_CMD in netdata-installer.sh (#8897)
* Fix missing NETDATA_STOP_CMD in netdata-installer.sh
* Fix shellcheck warnings
* Fix more shellcheck warnings
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-x | netdata-installer.sh | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh index be58027c48..b8fe2a6a75 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -53,7 +53,7 @@ defer_error_highlighted() { } print_deferred_errors() { - if [ -n "${NETDATA_DEFERRED_ERRORS}" ] ; then + if [ -n "${NETDATA_DEFERRED_ERRORS}" ]; then echo >&2 echo >&2 "The following non-fatal errors were encountered during the installation process:" # shellcheck disable=SC2059 @@ -281,7 +281,7 @@ while [ -n "${1}" ]; do "--disable-go") NETDATA_DISABLE_GO=1 ;; "--enable-ebpf") NETDATA_ENABLE_EBPF=1 ;; "--disable-cloud") - if [ -n "${NETDATA_REQUIRE_CLOUD}" ] ; then + if [ -n "${NETDATA_REQUIRE_CLOUD}" ]; then echo "Cloud explicitly enabled, ignoring --disable-cloud." else NETDATA_DISABLE_CLOUD=1 @@ -289,7 +289,7 @@ while [ -n "${1}" ]; do fi ;; "--require-cloud") - if [ -n "${NETDATA_DISABLE_CLOUD}" ] ; then + if [ -n "${NETDATA_DISABLE_CLOUD}" ]; then echo "Cloud explicitly disabled, ignoring --require-cloud." else NETDATA_REQUIRE_CLOUD=1 @@ -529,7 +529,7 @@ bundle_libmosquitto() { run_ok "libmosquitto built and prepared." else run_failed "Failed to build libmosquitto." - if [ -n "${NETDATA_REQUIRE_CLOUD}" ] ; then + if [ -n "${NETDATA_REQUIRE_CLOUD}" ]; then exit 1 else defer_error_highlighted "Unable to fetch sources for libmosquitto. You will not be able to connect this node to Netdata Cloud." @@ -537,7 +537,7 @@ bundle_libmosquitto() { fi else run_failed "Unable to fetch sources for libmosquitto." - if [ -n "${NETDATA_REQUIRE_CLOUD}" ] ; then + if [ -n "${NETDATA_REQUIRE_CLOUD}" ]; then exit 1 else defer_error_highlighted "Unable to fetch sources for libmosquitto. You will not be able to connect this node to Netdata Cloud." @@ -578,7 +578,7 @@ bundle_libwebsockets() { return 0 fi - if [ -z "$(command -v cmake)" ] ; then + if [ -z "$(command -v cmake)" ]; then run_failed "Could not find cmake, which is required to build libwebsockets. The install process will continue, but you may not be able to connect this node to Netdata Cloud." defer_error_highlighted "Could not find cmake, which is required to build libwebsockets. The install process will continue, but you may not be able to connect this node to Netdata Cloud." return 0 @@ -603,7 +603,7 @@ bundle_libwebsockets() { run_ok "libwebsockets built and prepared." else run_failed "Failed to build libwebsockets." - if [ -n "${NETDATA_REQUIRE_CLOUD}" ] ; then + if [ -n "${NETDATA_REQUIRE_CLOUD}" ]; then exit 1 else defer_error_highlighted "Failed to build libwebsockets. You may not be able to connect this node to Netdata Cloud." @@ -611,7 +611,7 @@ bundle_libwebsockets() { fi else run_failed "Unable to fetch sources for libwebsockets." - if [ -n "${NETDATA_REQUIRE_CLOUD}" ] ; then + if [ -n "${NETDATA_REQUIRE_CLOUD}" ]; then exit 1 else defer_error_highlighted "Unable to fetch sources for libwebsockets. You may not be able to connect this node to Netdata Cloud." @@ -624,7 +624,7 @@ bundle_libwebsockets # ----------------------------------------------------------------------------- # If we have the dashboard switching logic, make sure we're on the classic # dashboard during the install (updates don't work correctly otherwise). -if [ -x "${NETDATA_PREFIX}/usr/libexec/netdata-switch-dashboard.sh" ] ; then +if [ -x "${NETDATA_PREFIX}/usr/libexec/netdata-switch-dashboard.sh" ]; then "${NETDATA_PREFIX}/usr/libexec/netdata-switch-dashboard.sh" classic fi @@ -1035,15 +1035,13 @@ install_react_dashboard() { DASHBOARD_PACKAGE_BASENAME="dashboard.tar.gz" if fetch_and_verify "dashboard" \ - "https://github.com/netdata/dashboard/releases/download/${DASHBOARD_PACKAGE_VERSION}/${DASHBOARD_PACKAGE_BASENAME}" \ - "${DASHBOARD_PACKAGE_BASENAME}" \ - "${tmp}" \ - "${NETDATA_LOCAL_TARBALL_OVERRIDE_DASHBOARD}" - then - if run tar -xf "${tmp}/${DASHBOARD_PACKAGE_BASENAME}" -C "${tmp}" && \ - copy_react_dashboard "${tmp}/build" && \ - rm -rf "${tmp}" - then + "https://github.com/netdata/dashboard/releases/download/${DASHBOARD_PACKAGE_VERSION}/${DASHBOARD_PACKAGE_BASENAME}" \ + "${DASHBOARD_PACKAGE_BASENAME}" \ + "${tmp}" \ + "${NETDATA_LOCAL_TARBALL_OVERRIDE_DASHBOARD}"; then + if run tar -xf "${tmp}/${DASHBOARD_PACKAGE_BASENAME}" -C "${tmp}" && + copy_react_dashboard "${tmp}/build" && + rm -rf "${tmp}"; then run_ok "React dashboard installed." else run_failed "Failed to install React dashboard. The install process will continue, but you will not be able to use the new dashboard." @@ -1405,6 +1403,10 @@ fi # ----------------------------------------------------------------------------- progress "Install netdata at system init" +# By default we assume the shutdown/startup of the Netdata Agent are effectively +# without any system supervisor/init like SystemD or SysV. So we assume the most +# basic startup/shutdown commands... +NETDATA_STOP_CMD="${NETDATA_PREFIX}/usr/bin/netdatacli shutdown-agent" NETDATA_START_CMD="${NETDATA_PREFIX}/usr/sbin/netdata" if grep -q docker /proc/1/cgroup > /dev/null 2>&1; then |