~gbmor/clinte

ref: a69f61ca987afe9c9f4bc7ca03032b68ee99a55f clinte/check_new_clinte_posts.sh -rwxr-xr-x 606 bytes
a69f61caBenjamin Morrison moved makefile install target to shellscript 1 year, 28 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

check_clinte()
{
    OS=$(uname)
    LOCAL_FILE="$HOME/.clinte.json"
    DBFILE='/usr/local/clinte/clinte.json'

    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
        printf '%s\n\n' 'New posts on clinte!'
    fi
}

if [ ! -e "$HOME/.hushclinte" ]; then
    check_clinte
fi