summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2020-06-17 02:03:10 -0400
committerBen Morrison <ben@gbmor.dev>2020-06-17 02:03:10 -0400
commita0d9d84d424efc86f1ab78c88c479a60b7ed841a (patch)
tree957f1bc89b885ef049be9f5c8572bf7fb0bf896f
parent39ca959bfa67d07fb6255dd09884861e4a0648fa (diff)
downloadclinte-a0d9d84d424efc86f1ab78c88c479a60b7ed841a.tar.gz
testing for OS to improve portability of new post notification
-rwxr-xr-xcheck_new_clinte_posts.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/check_new_clinte_posts.sh b/check_new_clinte_posts.sh
index 806c6c7..9086b3a 100755
--- a/check_new_clinte_posts.sh
+++ b/check_new_clinte_posts.sh
@@ -1,10 +1,18 @@
 #!/bin/sh
 
-LOCAL_FILE="$HOME/.clinte.json"
-LOCAL_HASH=$(sha256sum "$LOCAL_FILE" 2>/dev/null | cut -d' ' -f1)
+OS=$(uname)
 
+LOCAL_FILE="$HOME/.clinte.json"
 DBFILE="/usr/local/clinte/clinte.json"
-DBFILE_HASH=$(sha256sum "$DBFILE" | cut -d' ' -f1)
+
+if [ $OS = "Linux" ]
+then
+    LOCAL_HASH=$(sha256sum "$LOCAL_FILE" 2>/dev/null | cut -d' ' -f1)
+    DBFILE_HASH=$(sha256sum "$DBFILE" | cut -d' ' -f1)
+else
+    LOCAL_HASH=$(sha256 "$LOCAL_FILE" 2>/dev/null | cut -d' ' -f1)
+    DBFILE_HASH=$(sha256 "$DBFILE" | cut -d' ' -f1)
+fi
 
 if [ "$LOCAL_HASH" != "$DBFILE_HASH" ]
 then