diff options
author | Ben Morrison <ben@gbmor.dev> | 2020-06-16 20:05:30 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2020-06-16 20:14:37 -0400 |
commit | 0fe685c34c5cdbff278b70c98241b0aa7c5bd6ed (patch) | |
tree | 5468c2a6d278d901f28085d3b2f1b41a1df4f860 /check_new_clinte_posts.sh | |
parent | 40bb48bb701f88c902b912fb51fea88b5ae9a8b8 (diff) | |
download | clinte-0fe685c34c5cdbff278b70c98241b0aa7c5bd6ed.tar.gz |
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.
Diffstat (limited to 'check_new_clinte_posts.sh')
-rwxr-xr-x | check_new_clinte_posts.sh | 12 |
1 files changed, 12 insertions, 0 deletions
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 |