summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2023-02-28 10:30:39 -0500
committerGitHub <noreply@github.com>2023-02-28 10:30:39 -0500
commit76ca052b9d2fb5324946b9d229059892e8e9debd (patch)
tree0832cd5a699098a2b1a0fe6fd8f8e134d9a7a4fe /packaging
parente9af6180814ea456cabc424880cd80f7a23d1e23 (diff)
Add an option to the kickstart script to override distro detection. (#14589)
Takes a single argument consisting of the values of the `ID`, `VERSION_ID`, and `VERSION_CODENAME` fields from the os-release file for the target distribution, separated by `:`. The codename part is optional for non-DEB distros, in which case the final `:` may be left off. This allows for better handling of platforms that are ABI-compatible derivatives of our supported platforms, both in that it allows users to install with native packages on them, and in that it allows us to better test such setups.
Diffstat (limited to 'packaging')
-rwxr-xr-xpackaging/installer/kickstart.sh121
-rw-r--r--packaging/installer/methods/kickstart.md1
2 files changed, 75 insertions, 47 deletions
diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh
index be847db087..48ea0f6091 100755
--- a/packaging/installer/kickstart.sh
+++ b/packaging/installer/kickstart.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
-# Next unused error code: F050F
+# Next unused error code: F0512
# ======================================================================
# Constants
@@ -632,71 +632,78 @@ safe_sha256sum() {
}
get_system_info() {
+ SYSARCH="$(uname -m)"
+
case "$(uname -s)" in
Linux)
SYSTYPE="Linux"
- os_release_file=
- if [ -s "/etc/os-release" ] && [ -r "/etc/os-release" ]; then
- os_release_file="/etc/os-release"
- elif [ -s "/usr/lib/os-release" ] && [ -r "/usr/lib/os-release" ]; then
- os_release_file="/usr/lib/os-release"
- else
- warning "Cannot find usable OS release information. Native packages will not be available for this install."
- fi
-
- if [ -n "${os_release_file}" ]; then
- # shellcheck disable=SC1090
- . "${os_release_file}"
-
- DISTRO="${ID}"
- SYSVERSION="${VERSION_ID}"
- SYSCODENAME="${VERSION_CODENAME}"
- SYSARCH="$(uname -m)"
+ if [ -z "${SKIP_DISTRO_DETECTION}" ]; then
+ os_release_file=
+ if [ -s "/etc/os-release" ] && [ -r "/etc/os-release" ]; then
+ os_release_file="/etc/os-release"
+ elif [ -s "/usr/lib/os-release" ] && [ -r "/usr/lib/os-release" ]; then
+ os_release_file="/usr/lib/os-release"
+ else
+ warning "Cannot find usable OS release information. Native packages will not be available for this install."
+ fi
- supported_compat_names="debian ubuntu centos fedora opensuse ol arch"
+ if [ -n "${os_release_file}" ]; then
+ # shellcheck disable=SC1090
+ . "${os_release_file}"
- if str_in_list "${DISTRO}" "${supported_compat_names}"; then
- DISTRO_COMPAT_NAME="${DISTRO}"
+ DISTRO="${ID}"
+ SYSVERSION="${VERSION_ID}"
+ SYSCODENAME="${VERSION_CODENAME}"
else
- case "${DISTRO}" in
- opensuse-leap)
- DISTRO_COMPAT_NAME="opensuse"
- ;;
- cloudlinux|almalinux|rocky|rhel)
- DISTRO_COMPAT_NAME="centos"
- ;;
- artix|manjaro|obarun)
- DISTRO_COMPAT_NAME="arch"
- ;;
- *)
- DISTRO_COMPAT_NAME="unknown"
- ;;
- esac
+ DISTRO="unknown"
+ DISTRO_COMPAT_NAME="unknown"
+ SYSVERSION="unknown"
+ SYSCODENAME="unknown"
fi
+ else
+ warning "Distribution auto-detection overridden by user. This is not guaranteed to work, and is not officially supported."
+ fi
- case "${DISTRO_COMPAT_NAME}" in
- centos|ol)
- SYSVERSION=$(echo "$SYSVERSION" | cut -d'.' -f1)
- ;;
- esac
+ supported_compat_names="debian ubuntu centos fedora opensuse ol arch"
+
+ if str_in_list "${DISTRO}" "${supported_compat_names}"; then
+ DISTRO_COMPAT_NAME="${DISTRO}"
else
- DISTRO="unknown"
- DISTRO_COMPAT_NAME="unknown"
- SYSVERSION="unknown"
- SYSCODENAME="unknown"
- SYSARCH="$(uname -m)"
+ case "${DISTRO}" in
+ opensuse-leap)
+ DISTRO_COMPAT_NAME="opensuse"
+ ;;
+ cloudlinux|almalinux|rocky|rhel)
+ DISTRO_COMPAT_NAME="centos"
+ ;;
+ artix|manjaro|obarun)
+ DISTRO_COMPAT_NAME="arch"
+ ;;
+ *)
+ DISTRO_COMPAT_NAME="unknown"
+ ;;
+ esac
fi
+
+ case "${DISTRO_COMPAT_NAME}" in
+ centos|ol)
+ SYSVERSION=$(echo "$SYSVERSION" | cut -d'.' -f1)
+ ;;
+ ubuntu|debian)
+ if [ -z "${SYSCODENAME}" ]; then
+ fatal "Could not determine ${DISTRO} release code name. This is required information on these systems." F0511
+ fi
+ ;;
+ esac
;;
Darwin)
SYSTYPE="Darwin"
SYSVERSION="$(sw_vers -buildVersion)"
- SYSARCH="$(uname -m)"
;;
FreeBSD)
SYSTYPE="FreeBSD"
SYSVERSION="$(uname -K)"
- SYSARCH="$(uname -m)"
;;
*)
fatal "Unsupported system type detected. Netdata cannot be installed on this system using this script." F0200
@@ -1477,6 +1484,10 @@ try_package_install() {
;;
esac
+ if [ -n "${SKIP_DISTRO_DETECTION}" ]; then
+ warning "Attempting to use native packages with a distro override. This is not officially supported, but may work in some cases. If your system requires a distro override to use native packages, please open an feature request at ${AGENT_BUG_REPORT_URL} about it so that we can update the installer to auto-detect this."
+ fi
+
if [ -n "${INSTALL_VERSION}" ]; then
if echo "${INSTALL_VERSION}" | grep -q "nightly"; then
new_release="-edge"
@@ -2191,6 +2202,22 @@ parse_args() {
AUTO_UPDATE=0
shift 1
;;
+ "--distro-override")
+ if [ -n "${2}" ]; then
+ SKIP_DISTRO_DETECTION=1
+ DISTRO="$(echo "${2}" | cut -f 1 -d ':' | tr '[:upper:]' '[:lower:]')"
+ SYSVERSION="$(echo "${2}" | cut -f 2 -d ':')"
+ SYSCODENAME="$(echo "${2}" | cut -f 3 -d ':' | tr '[:upper:]' '[:lower:]')"
+
+ if [ -z "${SYSVERSION}" ]; then
+ fatal "You must specify a release as well as a distribution name." F0510
+ fi
+
+ shift 1
+ else
+ fatal "A distribution name and release must be specified for the --distro-override option." F050F
+ fi
+ ;;
"--uninstall")
ACTION="uninstall"
NETDATA_COMMAND="uninstall"
diff --git a/packaging/installer/methods/kickstart.md b/packaging/installer/methods/kickstart.md
index 7996c44869..679c172f73 100644
--- a/packaging/installer/methods/kickstart.md
+++ b/packaging/installer/methods/kickstart.md
@@ -105,6 +105,7 @@ The `kickstart.sh` script accepts a number of optional parameters to control how
- `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of `http://[user:pass@]host:ip` for an HTTP(S) proxy.
See [connecting through a proxy](https://github.com/netdata/netdata/blob/master/claim/README.md#connect-through-a-proxy) for details.
- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://api.netdata.cloud`.
+- `--override-distro`: Override the distro detection logic and assume the system is using a specific Linux distribution and release. Takes a single argument consisting of the values of the `ID`, `VERSION_ID`, and `VERSION_CODENAME` fields from `/etc/os-release` for the desired distribution.
Additionally, the following environment variables may be used to further customize how the script runs (most users