#!/bin/sh

java="${NICOCACHE_JAVA:-java}"
DOMAINS='*.nicovideo.jp *.ce.nicovideo.jp *.smilevideo.jp *.nimg.jp *.dmc.nico'

cd `dirname $0`

for libfile in "lib/bcprov.jar" "lib/bcpkix.jar"; do
  if [ ! -e $libfile ]; then
    echo "$libfile is not found."
    echo
    echo "NicoCacheCA.jar require lib/bcprov.jar and lib/bcpkix.jar"
    echo "Please download Bouncy Castle:"
    echo "  https://www.bouncycastle.org/latest_releases.html"
    exit 1
  fi
done

$java -jar NicoCacheCA.jar $DOMAINS

