#!/bin/sh

set -exu

# check whether the whitelist.txt supplied by the Debian package is the same
# that would be generated by upstream's index.php
#
# we have to copy the code to a new location because otherwise we cannot remove
# whitelist.txt and have no write access to the cache directory
cp -a /usr/share/rss-bridge "$ADTTMP"
rm "$ADTTMP/rss-bridge/whitelist.txt"
rm "$ADTTMP/rss-bridge/cache"
mkdir "$ADTTMP/rss-bridge/cache"
php "$ADTTMP/rss-bridge/index.php"
diff -u "$ADTTMP/rss-bridge/whitelist.txt" /usr/share/rss-bridge/whitelist.txt
