Assorted kickstart script improvements. (#15243)
* Further clarify a number of errors and warnings in the kickstart script. * Ignore and warn on a handful of safe common unrecognized options.
Austin S. Hemmelgarn committed
Jun 28, 2023 at 07:55 UTC
625b929e7ada4b64bb28bfa5b7cc6147f83de8ed
1 file changed
+20
-13
packaging/installer/kickstart.sh
+20
-13
@@ -7,13 +7,7 @@
7
# ======================================================================
8
# Constants
9
10
-AGENT_BUG_REPORT_URL="https://github.com/netdata/netdata/issues/new/choose"
11
-CLOUD_BUG_REPORT_URL="https://github.com/netdata/netdata-cloud/issues/new/choose"
10
DEFAULT_RELEASE_CHANNEL="nightly"
13
-DISCORD_INVITE="https://discord.gg/5ygS846fR6"
14
-DISCUSSIONS_URL="https://github.com/netdata/netdata/discussions"
15
-DOCS_URL="https://learn.netdata.cloud/docs/"
16
-FORUM_URL="https://community.netdata.cloud/"
11
KICKSTART_OPTIONS="${*}"
12
KICKSTART_SOURCE="$(
13
self=${0}
@@ -25,16 +19,27 @@ KICKSTART_SOURCE="$(
19
cd "${self%/*}" || exit 1
20
echo "$(pwd -P)/${self##*/}"
21
)"
28
-PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"
22
DEFAULT_PLUGIN_PACKAGES=""
23
PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
31
-PUBLIC_CLOUD_URL="https://app.netdata.cloud"
32
-REPOCONFIG_DEB_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig"
24
REPOCONFIG_DEB_VERSION="2-1"
34
-REPOCONFIG_RPM_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig"
25
REPOCONFIG_RPM_VERSION="2-1"
26
START_TIME="$(date +%s)"
27
STATIC_INSTALL_ARCHES="x86_64 armv7l aarch64 ppc64le"
28
+
29
+# ======================================================================
30
+# URLs used throughout the script
31
+
32
+AGENT_BUG_REPORT_URL="https://github.com/netdata/netdata/issues/new/choose"
33
+CLOUD_BUG_REPORT_URL="https://github.com/netdata/netdata-cloud/issues/new/choose"
34
+DISCORD_INVITE="https://discord.gg/5ygS846fR6"
35
+DISCUSSIONS_URL="https://github.com/netdata/netdata/discussions"
36
+DOCS_URL="https://learn.netdata.cloud/docs/"
37
+FORUM_URL="https://community.netdata.cloud/"
38
+INSTALL_DOC_URL="https://learn.netdata.cloud/docs/install-the-netdata-agent/one-line-installer-for-all-linux-systems"
39
+PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"
40
+PUBLIC_CLOUD_URL="https://app.netdata.cloud"
41
+REPOCONFIG_DEB_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig"
42
+REPOCONFIG_RPM_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig"
43
TELEMETRY_URL="https://us-east1-netdata-analytics-bi.cloudfunctions.net/ingest_agent_events"
44
45
# ======================================================================
@@ -83,6 +88,7 @@ CURL="$(PATH="${PATH}:/opt/netdata/bin" command -v curl 2>/dev/null && true)"
88
BADCACHE_MSG="Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour"
89
BADNET_MSG="This is usually a result of a networking issue"
90
ERROR_F0003="Could not find a usable HTTP client. Either curl or wget is required to proceed with installation."
91
+BADOPT_MSG="If you are following a third-party guide online, please see ${INSTALL_DOC_URL} for current instructions for using this script. If you are using a local copy of this script instead of fetching it from our servers, consider updating it. If you intended to pass this option to the installer code, please use either --local-build-options or --static-install-options to specify it instead."
92
93
# ======================================================================
94
# Core program logic
@@ -896,7 +902,7 @@ handle_existing_install() {
902
kickstart-*|legacy-*|binpkg-*|manual-static|unknown)
903
if [ "${INSTALL_TYPE}" = "unknown" ]; then
904
if [ "${EXISTING_INSTALL_IS_NATIVE}" -eq 1 ]; then
899
- warning "Found an existing netdata install managed by the system package manager, but could not determine the install type. Usually this means you installed an unsupported third-party netdata package."
905
+ warning "Found an existing netdata install managed by the system package manager, but could not determine the install type. Usually this means you installed an unsupported third-party netdata package. This script supports claiming most such installs, but attempting to update or reinstall them using this script may be dangerous."
906
else
907
warning "Found an existing netdata install at ${ndprefix}, but could not determine the install type. Usually this means you installed Netdata through your distribution’s regular package repositories or some other unsupported method."
908
fi
@@ -940,7 +946,7 @@ handle_existing_install() {
946
promptmsg="Attempting to update an installation managed by the system package manager is known to not work in most cases. If you are trying to install the latest version of Netdata, you will need to manually uninstall it through your system package manager. ${claimonly_notice} Are you sure you want to continue?"
947
else
948
failmsg="We do not support trying to update or claim installations when we cannot determine the install type. You will need to uninstall the existing install using the same method you used to install it to proceed. ${claimonly_notice}"
943
- promptmsg="Attempting to update an existing install is not officially supported. It may work, but it also might break your system. ${claimonly_notice} Are you sure you want to continue?"
949
+ promptmsg="Attempting to update an existing install with an unknown installation type is not officially supported. It may work, but it also might break your system. ${claimonly_notice} Are you sure you want to continue?"
950
fi
951
if [ "${INTERACTIVE}" -eq 0 ] && [ "${ACTION}" != "claim" ]; then
952
fatal "${failmsg}" F0106
@@ -2213,7 +2219,8 @@ parse_args() {
2219
fatal "A source directory must be specified with the --offline-install-source option." F0501
2220
fi
2221
;;
2216
- *) fatal "Unrecognized option '${1}'. If you intended to pass this option to the installer code, please use either --local-build-options or --static-install-options to specify it instead." F050E ;;
2222
+ "--"|"all"|"--yes"|"-y"|"--force"|"--accept") warning "Option '${1}' is not recognized, ignoring it. ${BADOPT_MSG}" ;;
2223
+ *) fatal "Unrecognized option '${1}'. ${BADOPT_MSG}" F050E ;;
2224
esac
2225
shift 1
2226
done