28 lines
648 B
Plaintext
28 lines
648 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
daysinadvance=14
|
||
|
url=https://aninix.net/AniNIX/WarrantCanary/raw/branch/main/canary
|
||
|
|
||
|
# ID the update expected date
|
||
|
canarydate="$(curl -s "$url" | grep -A 1 'next two updates' | tail -n 1 | sed 's/^..//' )"
|
||
|
if [ -z "$canarydate" ]; then
|
||
|
echo "Cannot identify the canary's next time."
|
||
|
exit 2
|
||
|
fi
|
||
|
epochcanarydate="$(date -d "$canarydate" +%s)"
|
||
|
|
||
|
# Remove a one-month padding
|
||
|
updatecanarydate=$(( $epochcanarydate - 2592000 ))
|
||
|
|
||
|
# ID today
|
||
|
today="$(date +%s)"
|
||
|
|
||
|
|
||
|
if [[ $today -gt $updatecanarydate ]]; then
|
||
|
echo Time to reseed the warrant canary.
|
||
|
exit 2
|
||
|
else
|
||
|
echo Warrant canary seems to have the right time.
|
||
|
exit 0
|
||
|
fi
|