revert #5457 and test if files exist after installation (#5460)
[netdata patch release]
Paweł Krupa committed
Feb 21, 2019 at 19:34 UTC
24c500a1ce177a1a0653a113303848efc2faad4e
6 files changed
+30
-30
netdata-installer.sh
+5
-17
@@ -43,16 +43,12 @@ fi
43
download() {
44
url="${1}"
45
dest="${2}"
46
- if command -v wget >/dev/null 2>&1; then
47
- if [ -t 1 ]; then
48
- run wget --timeout=5 --tries=3 -O - "${url}" >"${dest}"
49
- else
50
- run wget --timeout=5 --tries=3 --progress=dot:mega -O - "${url}" >"${dest}"
51
- fi
52
- elif command -v curl >/dev/null 2>&1; then
53
- run curl -L --connect-timeout 10 --retry 3 "${url}" >"${dest}"
46
+ if command -v curl >/dev/null 2>&1; then
47
+ run curl -L --connect-timeout 5 --retry 3 "${url}" >"${dest}" || fatal "Cannot download ${url}"
48
+ elif command -v wget >/dev/null 2>&1; then
49
+ run wget -T 15 -O - "${url}" >"${dest}" || fatal "Cannot download ${url}"
50
else
55
- echo >&2 "I need curl or wget to proceed, but neither is available on this system."
51
+ fatal "I need curl or wget to proceed, but neither is available on this system."
52
fi
53
}
54
@@ -816,16 +812,8 @@ install_go() {
812
GO_PACKAGE_BASENAME="go.d.plugin-$GO_PACKAGE_VERSION.$OS-$ARCH"
813
814
download "https://github.com/netdata/go.d.plugin/releases/download/$GO_PACKAGE_VERSION/$GO_PACKAGE_BASENAME" "${tmp}/$GO_PACKAGE_BASENAME"
819
- if [ $? ] ; then
820
- echo >&2 "go.d.plugin package could not be downloaded"
821
- return 1
822
- fi
815
816
download "https://github.com/netdata/go.d.plugin/releases/download/$GO_PACKAGE_VERSION/config.tar.gz" "${tmp}/config.tar.gz"
825
- if [ $? ] ; then
826
- echo >&2 "go.d.plugin config could not be downloaded"
827
- return 1
828
- fi
817
grep "${GO_PACKAGE_BASENAME}" "${installer_dir}/packaging/go.d.checksums" > "${tmp}/sha256sums.txt" 2>/dev/null
818
grep "config.tar.gz" "${installer_dir}/packaging/go.d.checksums" >> "${tmp}/sha256sums.txt" 2>/dev/null
819
packaging/installer/functions.sh
+4
@@ -189,6 +189,10 @@ portable_find_processors() {
189
portable_find_processors
190
191
# -----------------------------------------------------------------------------
192
+fatal() {
193
+ printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${*} \n\n"
194
+ exit 1
195
+}
196
197
run_ok() {
198
printf >&2 "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET} ${*} \n\n"
packaging/installer/kickstart-static64.sh
+4
-4
@@ -83,10 +83,10 @@ fatal() {
83
download() {
84
url="${1}"
85
dest="${2}"
86
- if command -v wget >/dev/null 2>&1; then
87
- run wget -O - "${url}" >"${dest}" || fatal "Cannot download ${url}"
88
- elif command -v curl >/dev/null 2>&1; then
89
- run curl -L "${url}" >"${dest}" || fatal "Cannot download ${url}"
86
+ if command -v curl >/dev/null 2>&1; then
87
+ run curl -L --connect-timeout 5 --retry 3 "${url}" >"${dest}" || fatal "Cannot download ${url}"
88
+ elif command -v wget >/dev/null 2>&1; then
89
+ run wget -T 15 -O - "${url}" >"${dest}" || fatal "Cannot download ${url}"
90
else
91
fatal "I need curl or wget to proceed, but neither is available on this system."
92
fi
packaging/installer/kickstart.sh
+4
-4
@@ -115,10 +115,10 @@ fatal() {
115
download() {
116
url="${1}"
117
dest="${2}"
118
- if command -v wget >/dev/null 2>&1; then
119
- run wget -O - "${url}" >"${dest}" || fatal "Cannot download ${url}"
120
- elif command -v curl >/dev/null 2>&1; then
121
- run curl -L "${url}" >"${dest}" || fatal "Cannot download ${url}"
118
+ if command -v curl >/dev/null 2>&1; then
119
+ run curl -L --connect-timeout 5 --retry 3 "${url}" >"${dest}" || fatal "Cannot download ${url}"
120
+ elif command -v wget >/dev/null 2>&1; then
121
+ run wget -T 15 -O - "${url}" >"${dest}" || fatal "Cannot download ${url}"
122
else
123
fatal "I need curl or wget to proceed, but neither is available on this system."
124
fi
packaging/installer/netdata-updater.sh
+5
-5
@@ -34,12 +34,12 @@ failed() {
34
download() {
35
url="${1}"
36
dest="${2}"
37
- if command -v wget >/dev/null 2>&1; then
38
- wget -O - "${url}" >"${dest}" 2>&3 || echo >&2 "Cannot download ${url}" >&3 2>&3
39
- elif command -v curl >/dev/null 2>&1; then
40
- curl -L "${url}" >"${dest}" 2>&3 || echo "Cannot download ${url}" >&3 2>&3
37
+ if command -v curl >/dev/null 2>&1; then
38
+ curl -L --connect-timeout 5 --retry 3 "${url}" >"${dest}" || fatal "Cannot download ${url}"
39
+ elif command -v wget >/dev/null 2>&1; then
40
+ wget -T 15 -O - "${url}" >"${dest}" || fatal "Cannot download ${url}"
41
else
42
- failed "curl or wget is needed to proceed, but neither is available on this system."
42
+ failed "I need curl or wget to proceed, but neither is available on this system."
43
fi
44
}
45
tests/lifecycle.bats
+8
@@ -2,6 +2,11 @@
2
3
INSTALLATION="$BATS_TMPDIR/installation"
4
ENV="${INSTALLATION}/netdata/etc/netdata/.environment"
5
+# list of files which need to be checked. Path cannot start from '/'
6
+FILES="usr/libexec/netdata/plugins.d/go.d.plugin
7
+ usr/libexec/netdata/plugins.d/charts.d.plugin
8
+ usr/libexec/netdata/plugins.d/python.d.plugin
9
+ usr/libexec/netdata/plugins.d/node.d.plugin"
10
11
setup() {
12
if [ ! -f .gitignore ]; then
@@ -12,6 +17,9 @@ setup() {
17
18
@test "install netdata" {
19
./netdata-installer.sh --dont-wait --dont-start-it --auto-update --install "${INSTALLATION}"
20
+ for file in $FILES; do
21
+ [ ! -f "$BATS_TMPDIR/$file" ]
22
+ done
23
}
24
25
@test "update netdata" {