properly find md5sum
Costa Tsaousis (ktsaou) committed
Apr 2, 2017 at 03:31 UTC
345e5c7306c1e6544e304883a8d4c4f3e0b3a16e
2 files changed
+13
-8
makeself/install-or-update.sh
+12
-7
@@ -20,6 +20,7 @@ if [ ! -d etc/netdata ]
20
run mkdir -p etc/netdata
21
fi
22
23
+md5sum="$(which md5sum 2>/dev/null || command -v md5sum 2>/dev/null || command -v md5 2>/dev/null)"
24
for x in $(find etc/netdata.new -name '*.conf' -type f)
25
do
26
# find it relative filename
@@ -42,15 +43,19 @@ do
43
continue
44
fi
45
45
- # find the checksum of the existing file
46
- md5="$(cat "${t}" | md5sum | cut -d ' ' -f 1)"
47
- #echo >&2 "md5: ${md5}"
48
-
49
- # check if it matches
50
- if [ "${configs_signatures[${md5}]}" = "${f}" ]
46
+ if [ ! -z "${md5sum}" ]
47
then
52
- run cp "${x}" "${t}"
48
+ # find the checksum of the existing file
49
+ md5="$(cat "${t}" | ${md5sum} | cut -d ' ' -f 1)"
50
+ #echo >&2 "md5: ${md5}"
51
+
52
+ # check if it matches
53
+ if [ "${configs_signatures[${md5}]}" = "${f}" ]
54
+ then
55
+ run cp "${x}" "${t}"
56
+ fi
57
fi
58
+
59
run mv "${x}" "${t}.orig"
60
done
61
makeself/jobs/99-makeself.install.sh
+1
-1
@@ -54,7 +54,7 @@ fi
54
55
56
# -----------------------------------------------------------------------------
57
-# remove the links to allow the untaring the archive
57
+# remove the links to allow untaring the archive
58
59
rm "${NETDATA_INSTALL_PATH}/sbin" \
60
"${NETDATA_INSTALL_PATH}/usr/bin" \