check if the downloaded file is the same with the old one

This commit is contained in:
Costa Tsaousis (ktsaou) 2015-02-06 12:54:43 +02:00
parent 68f52a99f9
commit d290bc3054

@ -149,6 +149,18 @@ update() {
return 1
fi
if [ -f "${install}.source" ]
then
diff "${install}.source" "${tmp}" >/dev/null 2>&1
if [ $? -eq 0 ]
then
# they are the same
rm "${tmp}"
test ${SILENT} -ne 1 && echo >&2 "Downloaded file for ${ipset}, is the same with the previous one."
return 0
fi
fi
test ${SILENT} -ne 1 && echo >&2 "Saving ${ipset} to ${install}.source"
mv "${tmp}" "${install}.source" || return 1