1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/bin/bash -e
# SPDX-FileCopyrightText: 2024 Istituto Nazionale di Fisica Nucleare
#
# SPDX-License-Identifier: EUPL-1.2
# don't rely on the CA_NAME env var, but prefer an explicit command line argument
if [ $# -ne 1 ]; then
>&2 echo "Usage: remove_ca.sh ca-name"
exit 1
fi
ca_name="$1"
if [ ! -d "${ca_name}" ]; then
>&2 echo "Directory '${ca_name}' does not exist"
exit 1
fi
if [ ! -d "${ca_name}/private" ]; then
>&2 echo "Directory '${ca_name}' does not look like a CA"
exit 1
fi
rm -r ${ca_name}
echo "Removed CA under ${ca_name}"
|