Refactored sed methods used in ca functions to working state
This commit is contained in:
parent
761070271c
commit
737089ff6f
2 changed files with 12 additions and 2 deletions
|
@ -39,6 +39,9 @@ opts=$( getopt -o "$short" -l "$long" -n "$PROGNAME" -- "$@" )
|
||||||
if [ 0 -ne $? ]; then echo; usage; exit 1; fi
|
if [ 0 -ne $? ]; then echo; usage; exit 1; fi
|
||||||
eval set -- "$opts";
|
eval set -- "$opts";
|
||||||
|
|
||||||
|
CRT_ONLY=0
|
||||||
|
CNF_ONLY=0
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help) usage; exit 0;;
|
-h|--help) usage; exit 0;;
|
||||||
|
|
|
@ -140,6 +140,7 @@ CA_CRT_E $CA_EMAIL
|
||||||
__DEFAULTS__
|
__DEFAULTS__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO: Remove this, as it's no longer used.
|
||||||
ca_sed_cmd() {
|
ca_sed_cmd() {
|
||||||
# MD5 in CA_CR[TL]_MD5_FP has a non alphabetic character :(
|
# MD5 in CA_CR[TL]_MD5_FP has a non alphabetic character :(
|
||||||
# XXX: pretty sure this is a dirty and wrong way of templating vars
|
# XXX: pretty sure this is a dirty and wrong way of templating vars
|
||||||
|
@ -150,7 +151,7 @@ ca_sed_cmd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ca_template() {
|
ca_template() {
|
||||||
local template dest
|
local template dest sedstr
|
||||||
|
|
||||||
if [ -r "$1" ]; then
|
if [ -r "$1" ]; then
|
||||||
template="$1"
|
template="$1"
|
||||||
|
@ -161,7 +162,13 @@ ca_template() {
|
||||||
fi
|
fi
|
||||||
dest="$2"
|
dest="$2"
|
||||||
|
|
||||||
sed -e "$(ca_sed_cmd)" <"$template" >"$dest"
|
while read ca_var; do
|
||||||
|
sedstr="${sedstr}s"$'\1'"%$ca_var%"$'\1'"${!ca_var}"$'\1'"g; "
|
||||||
|
#sedstr="${sedstr}s%$ca_var%${!ca_var}g; "
|
||||||
|
done < <(set | awk -F\= '/^CA_[A-Z5_]*=/{print $1}')
|
||||||
|
|
||||||
|
#echo "DEBUG: setstr=$sedstr"
|
||||||
|
sed -e "$sedstr" <"$template" >"$dest"
|
||||||
}
|
}
|
||||||
|
|
||||||
ca_gen_crl() {
|
ca_gen_crl() {
|
||||||
|
|
Loading…
Reference in a new issue