only overwrite (echo >) if the contents changed
This commit is contained in:
parent
144f4af14d
commit
6b9299c89d
11
Makefile
11
Makefile
@ -17,7 +17,16 @@ fetch_updates:
|
|||||||
| jq -c '.result[]' \
|
| jq -c '.result[]' \
|
||||||
| while read -r update_msg; \
|
| while read -r update_msg; \
|
||||||
do \
|
do \
|
||||||
echo $$update_msg > data/$$(echo $$update_msg | jq -c '.update_id').update_id.json; \
|
file="data/$$(echo $$update_msg | jq -c '.update_id').update_id.json"; \
|
||||||
|
if [ -f "$$file" ]; then \
|
||||||
|
old_md5=$$(md5sum "$$file" | cut -d' ' -f1); \
|
||||||
|
new_md5=$$(echo "$$update_msg" | md5sum | cut -d' ' -f1); \
|
||||||
|
if [ "$$old_md5" != "$$new_md5" ]; then \
|
||||||
|
echo "$$update_msg" > "$$file"; \
|
||||||
|
fi; \
|
||||||
|
else \
|
||||||
|
echo "$$update_msg" > "$$file"; \
|
||||||
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user