Commit e298e3bc authored by ssrq's avatar ssrq

[type/__easy_rsa_pki] Simplify current-vars-condensed explorer

parent a6f1c6ac
#!/bin/sh -e
# Return the currently set variables in a "condensed form".
# Only variables which are not commented are printed.
# I.e. each line looks like the following example:
#
# EASYRSA_KEY_SIZE "1911"
#
# Also, for better comparison, the lines are sorted.
directory="/${__object_id:?}"
vars_file="${directory}/vars"
currently_set_variables=""
if [ -f ${vars_file} ]; then
currently_set_variables=$(
cat "${vars_file}" \
| grep -e '^[ \t]*set_var[ \t]*EASYRSA' \
| sed 's/^\s*//' | sed 's/set_var\s*//' \
| sed 's/\(EASYRSA_[A-Z_]*\)[ \t][ \t]*\(.*\)/\1 \2/' \
| sort
)
fi
printf "%s" "${currently_set_variables}"
#!/bin/sh -e
#
# Return the currently set variables in a sorted and "condensed" form.
# Only variables which are not commented are printed.
# I.e. each line looks like the following example:
#
# EASYRSA_DN "org"
# EASYRSA_REQ_COUNTRY "CH"
# EASYRSA_KEY_SIZE 2048
#
base_dir="/${__object_id:?}"
vars_file="${base_dir}/vars"
test -f "${vars_file}" || exit 0
sed -n 's/^[ \t]*set_var[ \t]\{1,\}\([A-Z_0-9]\{1,\}\)[ \t]\{1,\}/\1 /p' \
"${vars_file}" \
| sort
......@@ -72,7 +72,7 @@ vars_and_values=$(
done < "${__type:?}/files/param_mapping.txt"
)
current_vars_values_sorted=$(cat "${__object:?}/explorer/current-vars-condensed")
current_vars_values_sorted=$(cat "${__object:?}/explorer/vars")
supplied_vars_values_sorted=$(printf "%s" "${vars_and_values}" | sort)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment