File: remove_ca.sh

package info (click to toggle)
voms-api-java 3.3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,356 kB
  • sloc: java: 7,554; sh: 667; xml: 368; makefile: 5
file content (28 lines) | stat: -rwxr-xr-x 557 bytes parent folder | download
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}"