recreate_index_file.sh: some minor changes on script output.

This commit is contained in:
Christoph 2019-07-16 17:58:27 +02:00
parent dd2fa4c7d1
commit 840e1cf9dc

View File

@ -20,9 +20,16 @@ clean_up() {
# Perform program exit housekeeping # Perform program exit housekeeping
rm -f "$log_file" rm -f "$log_file"
blank_line
exit $1 exit $1
} }
blank_line() {
if $terminal ; then
echo ""
fi
}
trim() { trim() {
local var="$*" local var="$*"
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
@ -201,6 +208,8 @@ fi
if [[ -d "${OPENVPN_BASE_DIR}/pki" ]] ; then if [[ -d "${OPENVPN_BASE_DIR}/pki" ]] ; then
warn "Only available for old easyrsa layout managed accounts." warn "Only available for old easyrsa layout managed accounts."
clean_up 0 clean_up 0
else
blank_line
fi fi
[[ -n "$KEY_DIR" ]] || KEY_DIR="${OPENVPN_BASE_DIR}/keys" [[ -n "$KEY_DIR" ]] || KEY_DIR="${OPENVPN_BASE_DIR}/keys"
[[ -n "$CRL_PEM" ]] || CRL_PEM="${KEY_DIR}/crl.pem" [[ -n "$CRL_PEM" ]] || CRL_PEM="${KEY_DIR}/crl.pem"
@ -226,7 +235,7 @@ else
fatal "No index file '${INDEX_FILE}' found!" fatal "No index file '${INDEX_FILE}' found!"
fi fi
echo blank_line
while IFS= read -r -d '' cert ; do while IFS= read -r -d '' cert ; do
[[ "$cert" =~ dh[[:digit:]]+\.pem ]] && continue [[ "$cert" =~ dh[[:digit:]]+\.pem ]] && continue
[[ "$cert" =~ crl\.pem ]] && continue [[ "$cert" =~ crl\.pem ]] && continue
@ -301,6 +310,7 @@ else
fi fi
warn "Check manually if '${INDEX_FILE}' and '${SERIAL_FILE}' seems to be ok.." warn "Check manually if '${INDEX_FILE}' and
'${SERIAL_FILE}' seems to be ok.."
clean_up 0 clean_up 0