From 0fe685c34c5cdbff278b70c98241b0aa7c5bd6ed Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Tue, 16 Jun 2020 20:05:30 -0400 Subject: moved hashing to shellscript to check for posts removes dependency on sha2 crate and allows users to choose their own hashing algorithm easily. now copies clinte.json to $HOME/.clinte.json once the posts are viewed. a shellscript can be used to compare the hash of the global clinte.json to the hash of the copy. an example script is supplied. on `make install` the example script is installed to /etc/profile.d/, where it will be run for users on login. --- check_new_clinte_posts.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 check_new_clinte_posts.sh (limited to 'check_new_clinte_posts.sh') diff --git a/check_new_clinte_posts.sh b/check_new_clinte_posts.sh new file mode 100755 index 0000000..1d2dfbe --- /dev/null +++ b/check_new_clinte_posts.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +LOCAL_FILE="$HOME/.clinte.json" +LOCAL_HASH=$(sha256sum "$LOCAL_FILE" | cut -d' ' -f1) + +DBFILE="/usr/local/clinte/clinte.json" +DBFILE_HASH=$(sha256sum "$DBFILE" | cut -d' ' -f1) + +if [ "$LOCAL_HASH" != "$DBFILE_HASH" ] +then + printf "%s\n" "New posts on clinte!" +fi \ No newline at end of file -- cgit 1.4.1-2-gfad0