#! /usr/bin/env bash
set -eo pipefail

SCRIPT="$(basename "$0")"

usage() {
cat <<END
usage:
	$SCRIPT <file.crt>

	Remove file.crt from /usr/local/share/ca-certificates and then
	update CA certificates.
END
}

if [ "$#" -ne 1 ]; then
	usage
	exit 1
fi

if ! rm -f /usr/local/share/ca-certificates/"$1"; then
	echo "$SCRIPT: could not remove certificate, are you root?" >&2
	exit 1
fi

update-ca-certificates --fresh
