remove unused install_go.sh (#17339)
Ilya Mashchenko committed
Apr 8, 2024 at 12:40 UTC
eff93c95723844ef245e82333326602b87197a1d
1 file changed
-94
contrib/debian/install_go.sh
deleted
-94
@@ -1,94 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-GO_PACKAGE_VERSION="$1"
4
-LIB_DIR="$2"
5
-LIBEXEC_DIR="$3"
6
-
7
-# ############################################################
8
-# Package Go within netdata (TBD: Package it separately)
9
-safe_sha256sum() {
10
- # Within the context of the installer, we only use -c option that is common between the two commands
11
- # We will have to reconsider if we start non-common options
12
- if command -v sha256sum >/dev/null 2>&1; then
13
- sha256sum $@
14
- elif command -v shasum >/dev/null 2>&1; then
15
- shasum -a 256 $@
16
- else
17
- fatal "I could not find a suitable checksum binary to use"
18
- fi
19
-}
20
-
21
-download_go() {
22
- url="${1}"
23
- dest="${2}"
24
-
25
- if command -v curl >/dev/null 2>&1; then
26
- curl -sSL --connect-timeout 10 --retry 3 "${url}" >"${dest}"
27
- elif command -v wget >/dev/null 2>&1; then
28
- wget -T 15 -O - "${url}" >"${dest}"
29
- else
30
- echo >&2
31
- echo >&2 "Downloading go.d plugin from '${url}' failed because of missing mandatory packages."
32
- echo >&2 "Either add packages or disable it by issuing '--disable-go' in the installer"
33
- echo >&2
34
- exit 1
35
- fi
36
-}
37
-
38
-install_go() {
39
- ARCH_MAP=(
40
- 'i386::386'
41
- 'armhf::arm'
42
- )
43
- if [ -z "${NETDATA_DISABLE_GO+x}" ]; then
44
- ARCH="${DEB_TARGET_ARCH}"
45
-
46
- for index in "${ARCH_MAP[@]}" ; do
47
- KEY="${index%%::*}"
48
- VALUE="${index##*::}"
49
- if [ "$KEY" = "$ARCH" ]; then
50
- ARCH="${VALUE}"
51
- break
52
- fi
53
- done
54
-
55
- OS=$(uname -s | tr '[:upper:]' '[:lower:]')
56
-
57
- echo >&2 "Install go.d.plugin (ARCH=${ARCH}, OS=${OS})"
58
-
59
- tmp=$(mktemp -d /tmp/netdata-go-XXXXXX)
60
- GO_PACKAGE_BASENAME="go.d.plugin-${GO_PACKAGE_VERSION}.${OS}-${ARCH}.tar.gz"
61
- download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/${GO_PACKAGE_BASENAME}" "${tmp}/${GO_PACKAGE_BASENAME}"
62
- download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/config.tar.gz" "${tmp}/config.tar.gz"
63
-
64
- if [ ! -f "${tmp}/${GO_PACKAGE_BASENAME}" ] || [ ! -f "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/${GO_PACKAGE_BASENAME}" ]; then
65
- echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
66
- echo >&2
67
- return 1
68
- fi
69
-
70
- grep "${GO_PACKAGE_BASENAME}\$" "packaging/go.d.checksums" >"${tmp}/sha256sums.txt" 2>/dev/null
71
- grep "config.tar.gz" "packaging/go.d.checksums" >>"${tmp}/sha256sums.txt" 2>/dev/null
72
-
73
- # Checksum validation
74
- if ! (cd "${tmp}" && safe_sha256sum -c "sha256sums.txt"); then
75
-
76
- echo >&2 "go.d plugin checksum validation failure."
77
- echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
78
- echo >&2
79
-
80
- echo "go.d.plugin package files checksum validation failed."
81
- exit 1
82
- fi
83
-
84
- # Install files
85
- tar -xf "${tmp}/config.tar.gz" -C "${LIB_DIR}/conf.d/"
86
- tar xf "${tmp}/${GO_PACKAGE_BASENAME}"
87
- mv "${GO_PACKAGE_BASENAME/\.tar\.gz/}" "${LIBEXEC_DIR}/plugins.d/go.d.plugin"
88
-
89
- rm -rf "${tmp}"
90
- fi
91
- return 0
92
-}
93
-
94
-install_go