diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-04-02 03:31:32 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-04-02 03:31:32 +0300 |
commit | 345e5c7306c1e6544e304883a8d4c4f3e0b3a16e (patch) | |
tree | b729b82d63ca9f779f8274761b93226634415e6a /makeself/install-or-update.sh | |
parent | d8f4940b79407f76f794a9b3fa517f068a2fa6b5 (diff) |
properly find md5sum
Diffstat (limited to 'makeself/install-or-update.sh')
-rwxr-xr-x | makeself/install-or-update.sh | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/makeself/install-or-update.sh b/makeself/install-or-update.sh index 2331305fb5..658d408f79 100755 --- a/makeself/install-or-update.sh +++ b/makeself/install-or-update.sh @@ -20,6 +20,7 @@ if [ ! -d etc/netdata ] run mkdir -p etc/netdata fi +md5sum="$(which md5sum 2>/dev/null || command -v md5sum 2>/dev/null || command -v md5 2>/dev/null)" for x in $(find etc/netdata.new -name '*.conf' -type f) do # find it relative filename @@ -42,15 +43,19 @@ do continue fi - # find the checksum of the existing file - md5="$(cat "${t}" | md5sum | cut -d ' ' -f 1)" - #echo >&2 "md5: ${md5}" - - # check if it matches - if [ "${configs_signatures[${md5}]}" = "${f}" ] + if [ ! -z "${md5sum}" ] then - run cp "${x}" "${t}" + # find the checksum of the existing file + md5="$(cat "${t}" | ${md5sum} | cut -d ' ' -f 1)" + #echo >&2 "md5: ${md5}" + + # check if it matches + if [ "${configs_signatures[${md5}]}" = "${f}" ] + then + run cp "${x}" "${t}" + fi fi + run mv "${x}" "${t}.orig" done |