Fix kickstart error removing old cron symlink (#8849)
* Fix kickstart error removing old cron symlink Fixes this: ```#!sh root@debian:~# bash <(curl -Ss https://my-netdata.io/kickstart.sh) [/root]# '' rm -f /etc/cron.daily/netdata-updater /dev/fd/63: line 114: : command not found FAILED ``` * Fix shellcheck erorrs the same as kickstart-static64.sh * Fix md5sum of kickstart.sh in our docs
James Mills committed
Apr 30, 2020 at 17:22 UTC
98b6eadfa4efdd13aac031415a5f693256e65a67
2 files changed
+262
-259
packaging/installer/kickstart.sh
+261
-258
@@ -33,231 +33,234 @@ PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packag
33
# library functions copied from packaging/installer/functions.sh
34
35
setup_terminal() {
36
- TPUT_RESET=""
37
- TPUT_YELLOW=""
38
- TPUT_WHITE=""
39
- TPUT_BGRED=""
40
- TPUT_BGGREEN=""
41
- TPUT_BOLD=""
42
- TPUT_DIM=""
43
-
44
- # Is stderr on the terminal? If not, then fail
45
- test -t 2 || return 1
46
-
47
- if command -v tput >/dev/null 2>&1; then
48
- if [ $(($(tput colors 2>/dev/null))) -ge 8 ]; then
49
- # Enable colors
50
- TPUT_RESET="$(tput sgr 0)"
51
- TPUT_YELLOW="$(tput setaf 3)"
52
- TPUT_WHITE="$(tput setaf 7)"
53
- TPUT_BGRED="$(tput setab 1)"
54
- TPUT_BGGREEN="$(tput setab 2)"
55
- TPUT_BOLD="$(tput bold)"
56
- TPUT_DIM="$(tput dim)"
57
- fi
58
- fi
59
-
60
- return 0
36
+ TPUT_RESET=""
37
+ TPUT_YELLOW=""
38
+ TPUT_WHITE=""
39
+ TPUT_BGRED=""
40
+ TPUT_BGGREEN=""
41
+ TPUT_BOLD=""
42
+ TPUT_DIM=""
43
+
44
+ # Is stderr on the terminal? If not, then fail
45
+ test -t 2 || return 1
46
+
47
+ if command -v tput > /dev/null 2>&1; then
48
+ if [ $(($(tput colors 2> /dev/null))) -ge 8 ]; then
49
+ # Enable colors
50
+ TPUT_RESET="$(tput sgr 0)"
51
+ TPUT_YELLOW="$(tput setaf 3)"
52
+ TPUT_WHITE="$(tput setaf 7)"
53
+ TPUT_BGRED="$(tput setab 1)"
54
+ TPUT_BGGREEN="$(tput setab 2)"
55
+ TPUT_BOLD="$(tput bold)"
56
+ TPUT_DIM="$(tput dim)"
57
+ fi
58
+ fi
59
+
60
+ return 0
61
}
62
-setup_terminal || echo >/dev/null
62
+setup_terminal || echo > /dev/null
63
64
# -----------------------------------------------------------------------------
65
fatal() {
66
- printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${*} \n\n"
67
- exit 1
66
+ printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${*} \n\n"
67
+ exit 1
68
}
69
70
run_ok() {
71
- printf >&2 "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET} ${*} \n\n"
71
+ printf >&2 "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET} \n\n"
72
}
73
74
run_failed() {
75
- printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} FAILED ${TPUT_RESET} ${*} \n\n"
75
+ printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} FAILED ${TPUT_RESET} \n\n"
76
}
77
78
ESCAPED_PRINT_METHOD=
79
-printf "%q " test >/dev/null 2>&1
80
-[ $? -eq 0 ] && ESCAPED_PRINT_METHOD="printfq"
79
+if printf "%q " test > /dev/null 2>&1; then
80
+ ESCAPED_PRINT_METHOD="printfq"
81
+fi
82
escaped_print() {
82
- if [ "${ESCAPED_PRINT_METHOD}" = "printfq" ]; then
83
- printf "%q " "${@}"
84
- else
85
- printf "%s" "${*}"
86
- fi
87
- return 0
83
+ if [ "${ESCAPED_PRINT_METHOD}" = "printfq" ]; then
84
+ printf "%q " "${@}"
85
+ else
86
+ printf "%s" "${*}"
87
+ fi
88
+ return 0
89
}
90
91
progress() {
91
- echo >&2 " --- ${TPUT_DIM}${TPUT_BOLD}${*}${TPUT_RESET} --- "
92
+ echo >&2 " --- ${TPUT_DIM}${TPUT_BOLD}${*}${TPUT_RESET} --- "
93
}
94
95
run_logfile="/dev/null"
96
run() {
96
- local user="${USER--}" dir="${PWD}" info info_console
97
-
98
- if [ "${UID}" = "0" ]; then
99
- info="[root ${dir}]# "
100
- info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]# "
101
- else
102
- info="[${user} ${dir}]$ "
103
- info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]$ "
104
- fi
105
-
106
- printf >>"${run_logfile}" "${info}"
107
- escaped_print >>"${run_logfile}" "${@}"
108
- printf >>"${run_logfile}" " ... "
109
-
110
- printf >&2 "${info_console}${TPUT_BOLD}${TPUT_YELLOW}"
111
- escaped_print >&2 "${@}"
112
- printf >&2 "${TPUT_RESET}"
113
-
114
- "${@}"
115
-
116
- local ret=$?
117
- if [ ${ret} -ne 0 ]; then
118
- run_failed
119
- printf >>"${run_logfile}" "FAILED with exit code ${ret}\n"
120
- else
121
- run_ok
122
- printf >>"${run_logfile}" "OK\n"
123
- fi
124
-
125
- return ${ret}
97
+ local user="${USER--}" dir="${PWD}" info info_console
98
+
99
+ if [ "${UID}" = "0" ]; then
100
+ info="[root ${dir}]# "
101
+ info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]# "
102
+ else
103
+ info="[${user} ${dir}]$ "
104
+ info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]$ "
105
+ fi
106
+
107
+ {
108
+ printf "${info}"
109
+ escaped_print "${@}"
110
+ printf " ... "
111
+ } >> "${run_logfile}"
112
+
113
+ printf >&2 "${info_console}${TPUT_BOLD}${TPUT_YELLOW}"
114
+ escaped_print >&2 "${@}"
115
+ printf >&2 "${TPUT_RESET}"
116
+
117
+ "${@}"
118
+
119
+ local ret=$?
120
+ if [ ${ret} -ne 0 ]; then
121
+ run_failed
122
+ printf >> "${run_logfile}" "FAILED with exit code ${ret}\n"
123
+ else
124
+ run_ok
125
+ printf >> "${run_logfile}" "OK\n"
126
+ fi
127
+
128
+ return ${ret}
129
}
130
131
fatal() {
129
- printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${*} \n\n"
130
- exit 1
132
+ printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${*} \n\n"
133
+ exit 1
134
}
135
136
warning() {
134
- printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} WARNING ${TPUT_RESET} ${*} \n\n"
135
- if [ "${INTERACTIVE}" = "0" ]; then
136
- fatal "Stopping due to non-interactive mode. Fix the issue or retry installation in an interactive mode."
137
- else
138
- read -r -p "Press ENTER to attempt netdata installation > "
139
- progress "OK, let's give it a try..."
140
- fi
137
+ printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} WARNING ${TPUT_RESET} ${*} \n\n"
138
+ if [ "${INTERACTIVE}" = "0" ]; then
139
+ fatal "Stopping due to non-interactive mode. Fix the issue or retry installation in an interactive mode."
140
+ else
141
+ read -r -p "Press ENTER to attempt netdata installation > "
142
+ progress "OK, let's give it a try..."
143
+ fi
144
}
145
146
create_tmp_directory() {
144
- # Check if tmp is mounted as noexec
145
- if grep -Eq '^[^ ]+ /tmp [^ ]+ ([^ ]*,)?noexec[, ]' /proc/mounts > /dev/null 2>&1; then
146
- pattern="$(pwd)/netdata-kickstart-XXXXXX"
147
- else
148
- pattern="/tmp/netdata-kickstart-XXXXXX"
149
- fi
150
-
151
- mktemp -d $pattern
147
+ # Check if tmp is mounted as noexec
148
+ if grep -Eq '^[^ ]+ /tmp [^ ]+ ([^ ]*,)?noexec[, ]' /proc/mounts > /dev/null 2>&1; then
149
+ pattern="$(pwd)/netdata-kickstart-XXXXXX"
150
+ else
151
+ pattern="/tmp/netdata-kickstart-XXXXXX"
152
+ fi
153
+
154
+ mktemp -d $pattern
155
}
156
157
download() {
155
- url="${1}"
156
- dest="${2}"
157
- if command -v curl >/dev/null 2>&1; then
158
- run curl -sSL --connect-timeout 10 --retry 3 "${url}" >"${dest}" || fatal "Cannot download ${url}"
159
- elif command -v wget >/dev/null 2>&1; then
160
- run wget -T 15 -O - "${url}" >"${dest}" || fatal "Cannot download ${url}"
161
- else
162
- fatal "I need curl or wget to proceed, but neither is available on this system."
163
- fi
158
+ url="${1}"
159
+ dest="${2}"
160
+ if command -v curl > /dev/null 2>&1; then
161
+ run curl -sSL --connect-timeout 10 --retry 3 "${url}" > "${dest}" || fatal "Cannot download ${url}"
162
+ elif command -v wget > /dev/null 2>&1; then
163
+ run wget -T 15 -O - "${url}" > "${dest}" || fatal "Cannot download ${url}"
164
+ else
165
+ fatal "I need curl or wget to proceed, but neither is available on this system."
166
+ fi
167
}
168
169
set_tarball_urls() {
167
- if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
168
- progress "Not fetching remote tarballs, local override was given"
169
- return
170
- fi
171
-
172
- if [ "$1" = "stable" ]; then
173
- local latest
174
- # Simple version
175
- # latest="$(curl -sSL https://api.github.com/repos/netdata/netdata/releases/latest | grep tag_name | cut -d'"' -f4)"
176
- latest="$(download "https://api.github.com/repos/netdata/netdata/releases/latest" /dev/stdout | grep tag_name | cut -d'"' -f4)"
177
- export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/netdata-$latest.tar.gz"
178
- export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt"
179
- else
180
- export NETDATA_TARBALL_URL="https://storage.googleapis.com/netdata-nightlies/netdata-latest.tar.gz"
181
- export NETDATA_TARBALL_CHECKSUM_URL="https://storage.googleapis.com/netdata-nightlies/sha256sums.txt"
182
- fi
170
+ if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
171
+ progress "Not fetching remote tarballs, local override was given"
172
+ return
173
+ fi
174
+
175
+ if [ "$1" = "stable" ]; then
176
+ local latest
177
+ # Simple version
178
+ # latest="$(curl -sSL https://api.github.com/repos/netdata/netdata/releases/latest | grep tag_name | cut -d'"' -f4)"
179
+ latest="$(download "https://api.github.com/repos/netdata/netdata/releases/latest" /dev/stdout | grep tag_name | cut -d'"' -f4)"
180
+ export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/netdata-$latest.tar.gz"
181
+ export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt"
182
+ else
183
+ export NETDATA_TARBALL_URL="https://storage.googleapis.com/netdata-nightlies/netdata-latest.tar.gz"
184
+ export NETDATA_TARBALL_CHECKSUM_URL="https://storage.googleapis.com/netdata-nightlies/sha256sums.txt"
185
+ fi
186
}
187
188
detect_bash4() {
186
- bash="${1}"
187
- if [ -z "${BASH_VERSION}" ]; then
188
- # we don't run under bash
189
- if [ -n "${bash}" ] && [ -x "${bash}" ]; then
190
- # shellcheck disable=SC2016
191
- BASH_MAJOR_VERSION=$(${bash} -c 'echo "${BASH_VERSINFO[0]}"')
192
- fi
193
- else
194
- # we run under bash
195
- BASH_MAJOR_VERSION="${BASH_VERSINFO[0]}"
196
- fi
197
-
198
- if [ -z "${BASH_MAJOR_VERSION}" ]; then
199
- echo >&2 "No BASH is available on this system"
200
- return 1
201
- elif [ $((BASH_MAJOR_VERSION)) -lt 4 ]; then
202
- echo >&2 "No BASH v4+ is available on this system (installed bash is v${BASH_MAJOR_VERSION}"
203
- return 1
204
- fi
205
- return 0
189
+ bash="${1}"
190
+ if [ -z "${BASH_VERSION}" ]; then
191
+ # we don't run under bash
192
+ if [ -n "${bash}" ] && [ -x "${bash}" ]; then
193
+ # shellcheck disable=SC2016
194
+ BASH_MAJOR_VERSION=$(${bash} -c 'echo "${BASH_VERSINFO[0]}"')
195
+ fi
196
+ else
197
+ # we run under bash
198
+ BASH_MAJOR_VERSION="${BASH_VERSINFO[0]}"
199
+ fi
200
+
201
+ if [ -z "${BASH_MAJOR_VERSION}" ]; then
202
+ echo >&2 "No BASH is available on this system"
203
+ return 1
204
+ elif [ $((BASH_MAJOR_VERSION)) -lt 4 ]; then
205
+ echo >&2 "No BASH v4+ is available on this system (installed bash is v${BASH_MAJOR_VERSION}"
206
+ return 1
207
+ fi
208
+ return 0
209
}
210
211
dependencies() {
209
- SYSTEM="$(uname -s 2> /dev/null || uname -v)"
210
- OS="$(uname -o 2> /dev/null || uname -rs)"
211
- MACHINE="$(uname -m 2> /dev/null)"
212
-
213
- echo "System : ${SYSTEM}"
214
- echo "Operating System : ${OS}"
215
- echo "Machine : ${MACHINE}"
216
- echo "BASH major version: ${BASH_MAJOR_VERSION}"
217
-
218
- if [ "${OS}" != "GNU/Linux" ] && [ "${SYSTEM}" != "Linux" ]; then
219
- warning "Cannot detect the packages to be installed on a ${SYSTEM} - ${OS} system."
220
- else
221
- bash="$(command -v bash 2>/dev/null)"
222
- if ! detect_bash4 "${bash}"; then
223
- warning "Cannot detect packages to be installed in this system, without BASH v4+."
224
- else
225
- progress "Fetching script to detect required packages..."
226
- if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" ]; then
227
- if [ -f "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" ]; then
228
- run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" "${TMPDIR}/install-required-packages.sh"
229
- else
230
- fatal "Invalid given dependency file, please check your --local-files parameter options and try again"
231
- fi
232
- else
233
- download "${PACKAGES_SCRIPT}" "${TMPDIR}/install-required-packages.sh"
234
- fi
235
-
236
- if [ ! -s "${TMPDIR}/install-required-packages.sh" ]; then
237
- warning "Downloaded dependency installation script is empty."
238
- else
239
- progress "Running downloaded script to detect required packages..."
240
- run ${sudo} "${bash}" "${TMPDIR}/install-required-packages.sh" ${PACKAGES_INSTALLER_OPTIONS}
241
- # shellcheck disable=SC2181
242
- if [ $? -ne 0 ] ; then
243
- warning "It failed to install all the required packages, but installation might still be possible."
244
- fi
245
- fi
246
-
247
- fi
248
- fi
212
+ SYSTEM="$(uname -s 2> /dev/null || uname -v)"
213
+ OS="$(uname -o 2> /dev/null || uname -rs)"
214
+ MACHINE="$(uname -m 2> /dev/null)"
215
+
216
+ echo "System : ${SYSTEM}"
217
+ echo "Operating System : ${OS}"
218
+ echo "Machine : ${MACHINE}"
219
+ echo "BASH major version: ${BASH_MAJOR_VERSION}"
220
+
221
+ if [ "${OS}" != "GNU/Linux" ] && [ "${SYSTEM}" != "Linux" ]; then
222
+ warning "Cannot detect the packages to be installed on a ${SYSTEM} - ${OS} system."
223
+ else
224
+ bash="$(command -v bash 2> /dev/null)"
225
+ if ! detect_bash4 "${bash}"; then
226
+ warning "Cannot detect packages to be installed in this system, without BASH v4+."
227
+ else
228
+ progress "Fetching script to detect required packages..."
229
+ if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" ]; then
230
+ if [ -f "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" ]; then
231
+ run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" "${TMPDIR}/install-required-packages.sh"
232
+ else
233
+ fatal "Invalid given dependency file, please check your --local-files parameter options and try again"
234
+ fi
235
+ else
236
+ download "${PACKAGES_SCRIPT}" "${TMPDIR}/install-required-packages.sh"
237
+ fi
238
+
239
+ if [ ! -s "${TMPDIR}/install-required-packages.sh" ]; then
240
+ warning "Downloaded dependency installation script is empty."
241
+ else
242
+ progress "Running downloaded script to detect required packages..."
243
+ run ${sudo} "${bash}" "${TMPDIR}/install-required-packages.sh" ${PACKAGES_INSTALLER_OPTIONS}
244
+ # shellcheck disable=SC2181
245
+ if [ $? -ne 0 ]; then
246
+ warning "It failed to install all the required packages, but installation might still be possible."
247
+ fi
248
+ fi
249
+
250
+ fi
251
+ fi
252
}
253
254
safe_sha256sum() {
252
- # Within the contexct of the installer, we only use -c option that is common between the two commands
253
- # We will have to reconsider if we start non-common options
254
- if command -v sha256sum >/dev/null 2>&1; then
255
- sha256sum $@
256
- elif command -v shasum >/dev/null 2>&1; then
257
- shasum -a 256 $@
258
- else
259
- fatal "I could not find a suitable checksum binary to use"
260
- fi
255
+ # Within the contexct of the installer, we only use -c option that is common between the two commands
256
+ # We will have to reconsider if we start non-common options
257
+ if command -v sha256sum > /dev/null 2>&1; then
258
+ sha256sum "$@"
259
+ elif command -v shasum > /dev/null 2>&1; then
260
+ shasum -a 256 "$@"
261
+ else
262
+ fatal "I could not find a suitable checksum binary to use"
263
+ fi
264
}
265
266
# ---------------------------------------------------------------------------------------------------------------------
@@ -275,15 +278,15 @@ updater=""
278
[ -x /etc/periodic/daily/netdata-updater ] && updater=/etc/periodic/daily/netdata-updater
279
[ -x /etc/cron.daily/netdata-updater ] && updater=/etc/cron.daily/netdata-updater
280
if [ -L "${updater}" ]; then
278
- # remove old updater (symlink)
279
- run "${sudo}" rm -f "${updater}"
280
- updater=""
281
+ # remove old updater (symlink)
282
+ run ${sudo} rm -f "${updater}"
283
+ updater=""
284
fi
285
if [ -n "${updater}" ]; then
283
- # attempt to run the updater, to respect any compilation settings already in place
284
- progress "Re-installing netdata..."
285
- run "${sudo}" "${updater}" -f || fatal "Failed to forcefully update netdata"
286
- exit 0
286
+ # attempt to run the updater, to respect any compilation settings already in place
287
+ progress "Re-installing netdata..."
288
+ run ${sudo} "${updater}" -f || fatal "Failed to forcefully update netdata"
289
+ exit 0
290
fi
291
292
# ---------------------------------------------------------------------------------------------------------------------
@@ -295,68 +298,68 @@ NETDATA_INSTALLER_OPTIONS=""
298
NETDATA_UPDATES="--auto-update"
299
RELEASE_CHANNEL="nightly"
300
while [ -n "${1}" ]; do
298
- if [ "${1}" = "all" ]; then
299
- PACKAGES_INSTALLER_OPTIONS="netdata-all"
300
- shift 1
301
- elif [ "${1}" = "--dont-wait" ] || [ "${1}" = "--non-interactive" ]; then
302
- INTERACTIVE=0
303
- shift 1
304
- elif [ "${1}" = "--no-updates" ]; then
305
- # echo >&2 "netdata will not auto-update"
306
- NETDATA_UPDATES=
307
- shift 1
308
- elif [ "${1}" = "--stable-channel" ]; then
309
- RELEASE_CHANNEL="stable"
310
- NETDATA_INSTALLER_OPTIONS="$NETDATA_INSTALLER_OPTIONS --stable-channel"
311
- shift 1
312
- elif [ "${1}" = "--local-files" ]; then
313
- shift 1
314
- if [ -z "${1}" ]; then
315
- fatal "Missing netdata: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
316
- fi
317
-
318
- export NETDATA_LOCAL_TARBALL_OVERRIDE="${1}"
319
- shift 1
320
-
321
- if [ -z "${1}" ]; then
322
- fatal "Missing checksum file: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
323
- fi
324
-
325
- export NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM="${1}"
326
- shift 1
327
-
328
- if [ -z "${1}" ]; then
329
- fatal "Missing go.d tarball: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
330
- fi
331
-
332
- export NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN="${1}"
333
- shift 1
334
-
335
- if [ -z "${1}" ]; then
336
- fatal "Missing go.d config tarball: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
337
- fi
338
-
339
- export NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN_CONFIG="${1}"
340
- shift 1
341
-
342
- if [ -z "${1}" ]; then
343
- fatal "Missing dependencies management scriptlet: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
344
- fi
345
-
346
- export NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT="${1}"
347
- shift 1
348
- else
349
- break
350
- fi
301
+ if [ "${1}" = "all" ]; then
302
+ PACKAGES_INSTALLER_OPTIONS="netdata-all"
303
+ shift 1
304
+ elif [ "${1}" = "--dont-wait" ] || [ "${1}" = "--non-interactive" ]; then
305
+ INTERACTIVE=0
306
+ shift 1
307
+ elif [ "${1}" = "--no-updates" ]; then
308
+ # echo >&2 "netdata will not auto-update"
309
+ NETDATA_UPDATES=
310
+ shift 1
311
+ elif [ "${1}" = "--stable-channel" ]; then
312
+ RELEASE_CHANNEL="stable"
313
+ NETDATA_INSTALLER_OPTIONS="$NETDATA_INSTALLER_OPTIONS --stable-channel"
314
+ shift 1
315
+ elif [ "${1}" = "--local-files" ]; then
316
+ shift 1
317
+ if [ -z "${1}" ]; then
318
+ fatal "Missing netdata: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
319
+ fi
320
+
321
+ export NETDATA_LOCAL_TARBALL_OVERRIDE="${1}"
322
+ shift 1
323
+
324
+ if [ -z "${1}" ]; then
325
+ fatal "Missing checksum file: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
326
+ fi
327
+
328
+ export NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM="${1}"
329
+ shift 1
330
+
331
+ if [ -z "${1}" ]; then
332
+ fatal "Missing go.d tarball: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
333
+ fi
334
+
335
+ export NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN="${1}"
336
+ shift 1
337
+
338
+ if [ -z "${1}" ]; then
339
+ fatal "Missing go.d config tarball: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
340
+ fi
341
+
342
+ export NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN_CONFIG="${1}"
343
+ shift 1
344
+
345
+ if [ -z "${1}" ]; then
346
+ fatal "Missing dependencies management scriptlet: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
347
+ fi
348
+
349
+ export NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT="${1}"
350
+ shift 1
351
+ else
352
+ break
353
+ fi
354
done
355
356
if [ "${INTERACTIVE}" = "0" ]; then
354
- PACKAGES_INSTALLER_OPTIONS="--dont-wait --non-interactive ${PACKAGES_INSTALLER_OPTIONS}"
355
- NETDATA_INSTALLER_OPTIONS="$NETDATA_INSTALLER_OPTIONS --dont-wait"
357
+ PACKAGES_INSTALLER_OPTIONS="--dont-wait --non-interactive ${PACKAGES_INSTALLER_OPTIONS}"
358
+ NETDATA_INSTALLER_OPTIONS="$NETDATA_INSTALLER_OPTIONS --dont-wait"
359
fi
360
361
TMPDIR=$(create_tmp_directory)
359
-cd "${TMPDIR}"
362
+cd "${TMPDIR}" || exit 1
363
364
dependencies
365
@@ -364,32 +367,32 @@ dependencies
367
# download netdata package
368
369
if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
367
- set_tarball_urls "${RELEASE_CHANNEL}"
370
+ set_tarball_urls "${RELEASE_CHANNEL}"
371
369
- download "${NETDATA_TARBALL_CHECKSUM_URL}" "${TMPDIR}/sha256sum.txt"
370
- download "${NETDATA_TARBALL_URL}" "${TMPDIR}/netdata-latest.tar.gz"
372
+ download "${NETDATA_TARBALL_CHECKSUM_URL}" "${TMPDIR}/sha256sum.txt"
373
+ download "${NETDATA_TARBALL_URL}" "${TMPDIR}/netdata-latest.tar.gz"
374
else
372
- progress "Installation sources were given as input, running installation using \"${NETDATA_LOCAL_TARBALL_OVERRIDE}\""
373
- run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM}" "${TMPDIR}/sha256sum.txt"
374
- run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE}" "${TMPDIR}/netdata-latest.tar.gz"
375
+ progress "Installation sources were given as input, running installation using \"${NETDATA_LOCAL_TARBALL_OVERRIDE}\""
376
+ run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM}" "${TMPDIR}/sha256sum.txt"
377
+ run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE}" "${TMPDIR}/netdata-latest.tar.gz"
378
fi
379
377
-if ! grep netdata-latest.tar.gz "${TMPDIR}/sha256sum.txt" | safe_sha256sum -c - >/dev/null 2>&1; then
378
- fatal "Tarball checksum validation failed. Stopping netdata installation and leaving tarball in ${TMPDIR}"
380
+if ! grep netdata-latest.tar.gz "${TMPDIR}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then
381
+ fatal "Tarball checksum validation failed. Stopping netdata installation and leaving tarball in ${TMPDIR}"
382
fi
383
run tar -xf netdata-latest.tar.gz
381
-rm -rf netdata-latest.tar.gz >/dev/null 2>&1
384
+rm -rf netdata-latest.tar.gz > /dev/null 2>&1
385
cd netdata-* || fatal "Cannot cd to netdata source tree"
386
387
# ---------------------------------------------------------------------------------------------------------------------
388
# install netdata from source
389
390
if [ -x netdata-installer.sh ]; then
388
- progress "Installing netdata..."
389
- run ${sudo} ./netdata-installer.sh ${NETDATA_UPDATES} ${NETDATA_INSTALLER_OPTIONS} "${@}" || fatal "netdata-installer.sh exited with error"
390
- if [ -d "${TMPDIR}" ] && [ ! "${TMPDIR}" = "/" ]; then
391
- run ${sudo} rm -rf "${TMPDIR}" >/dev/null 2>&1
392
- fi
391
+ progress "Installing netdata..."
392
+ run ${sudo} ./netdata-installer.sh ${NETDATA_UPDATES} ${NETDATA_INSTALLER_OPTIONS} "${@}" || fatal "netdata-installer.sh exited with error"
393
+ if [ -d "${TMPDIR}" ] && [ ! "${TMPDIR}" = "/" ]; then
394
+ run ${sudo} rm -rf "${TMPDIR}" > /dev/null 2>&1
395
+ fi
396
else
394
- fatal "Cannot install netdata from source (the source directory does not include netdata-installer.sh). Leaving all files in ${TMPDIR}"
397
+ fatal "Cannot install netdata from source (the source directory does not include netdata-installer.sh). Leaving all files in ${TMPDIR}"
398
fi
packaging/installer/methods/kickstart.md
+1
-1
@@ -58,7 +58,7 @@ To use `md5sum` to verify the intregity of the `kickstart.sh` script you will do
58
run the following:
59
60
```bash
61
-[ "3058dbf398ba0d73d02c7626545610f5" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
61
+[ "f1e7aa92ca64b797fdc14df59faad205" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
62
```
63
64
If the script is valid, this command will return `OK, VALID`.