#!/bin/sh

pkg_admin=/usr/sbin/pkg_admin

usage() {
	echo 'Usage: download-vulnerability-list [-hs] [-c config_file]' >& $2
	echo "Please use \`\`pkg_admin fetch-pkg-vulnerabilities'' instead." >& $2
	exit $1
}

do_sign=

args=`getopt c:hs $*`
if [ $? -ne 0 ]; then
	usage 1 2
fi

set -- $args

while [ $# -gt 0 ]; do
	case "$1" in
	-c)
		echo "The download-vulnerability-list wrapper does not support -c" >&2
		echo "Please switch to \`\`pkg_admin fetch-pkg-vulnerabilities''." >&2
		exit 1
		;;
	-h)
		usage 0 1
		;;
	-s)
		do_sign=-s
		;;
	esac
	shift
done

exec ${pkg_admin} fetch-pkg-vulnerabilities ${do_sign}
