"shellpki revoke" can be run interactively or not
This commit is contained in:
parent
c83f210387
commit
83d0ef2449
37
shellpki
37
shellpki
|
@ -688,15 +688,42 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
revoke() {
|
revoke() {
|
||||||
if [ "${1}" = "" ]; then
|
non_interactive=0
|
||||||
|
|
||||||
|
# Parse options
|
||||||
|
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
||||||
|
while :; do
|
||||||
|
case $1 in
|
||||||
|
--non-interactive)
|
||||||
|
non_interactive=1
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
# End of all options.
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
-?*)
|
||||||
|
# ignore unknown options
|
||||||
|
warning "Warning: unknown option (ignored): \`$1'"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Default case: If no more options then break out of the loop.
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# The name of the certificate
|
||||||
|
cn="${1:-}"
|
||||||
|
|
||||||
|
if [ -z "${cn}" ]; then
|
||||||
show_usage >&2
|
show_usage >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
crt_file="${CRT_DIR}/${cn}.crt"
|
crt_file="${CRT_DIR}/${cn}.crt"
|
||||||
|
|
||||||
# get CN from param
|
|
||||||
cn="${1}"
|
|
||||||
|
|
||||||
# check if CRT exists
|
# check if CRT exists
|
||||||
if [ ! -f "${crt_file}" ]; then
|
if [ ! -f "${crt_file}" ]; then
|
||||||
error "Unknow CN : ${cn} (\`${crt_file}' not found)"
|
error "Unknow CN : ${cn} (\`${crt_file}' not found)"
|
||||||
|
|
Loading…
Reference in a new issue