replace pcre-ism with posix class (thanks to @awaw, fixes #52)

This commit is contained in:
Lukas Schauer
2015-12-16 13:46:33 +01:00
parent 5a29d1853e
commit 760b689407

View File

@@ -193,7 +193,7 @@ hex2bin() {
} }
get_json_string_value() { get_json_string_value() {
grep -Eo '"'"${1}"'":\s*"[^"]*"' | cut -d'"' -f4 grep -Eo '"'"${1}"'":[[:space:]]*"[^"]*"' | cut -d'"' -f4
} }
get_json_array() { get_json_array() {
@@ -408,7 +408,7 @@ command_sign_domains() {
echo "${PARAM_DOMAIN}" > "${DOMAINS_TXT}" echo "${PARAM_DOMAIN}" > "${DOMAINS_TXT}"
fi fi
# Generate certificates for all domains found in domains.txt. Check if existing certificate are about to expire # Generate certificates for all domains found in domains.txt. Check if existing certificate are about to expire
<"${DOMAINS_TXT}" sed 's/^[ ]*//g;s/[ ]*$//g' | grep -v '^#' | grep -v '^$' | while read -r line; do <"${DOMAINS_TXT}" sed 's/^[[:space:]]*//g;s/[[:space:]]*$//g' | grep -vE '^(#|$)' | while read -r line; do
domain="$(printf '%s\n' "${line}" | cut -d' ' -f1)" domain="$(printf '%s\n' "${line}" | cut -d' ' -f1)"
morenames="$(printf '%s\n' "${line}" | cut -s -d' ' -f2-)" morenames="$(printf '%s\n' "${line}" | cut -s -d' ' -f2-)"
cert="${BASEDIR}/certs/${domain}/cert.pem" cert="${BASEDIR}/certs/${domain}/cert.pem"
@@ -475,7 +475,7 @@ command_help() {
echo echo
( (
echo "Commands:" echo "Commands:"
grep -e '^\s*# Usage:' -e '^\s*# Description:' -e '^command_.*()\s*{' "${0}" | while read -r usage; read -r description; read -r command; do grep -e '^[[:space:]]*# Usage:' -e '^[[:space:]]*# Description:' -e '^command_.*()[[:space:]]*{' "${0}" | while read -r usage; read -r description; read -r command; do
if [[ ! "${usage}" =~ Usage ]] || [[ ! "${description}" =~ Description ]] || [[ ! "${command}" =~ ^command_ ]]; then if [[ ! "${usage}" =~ Usage ]] || [[ ! "${description}" =~ Description ]] || [[ ! "${command}" =~ ^command_ ]]; then
echo "Error generating help text." >&2 echo "Error generating help text." >&2
exit 1 exit 1
@@ -484,7 +484,7 @@ command_help() {
done done
echo "---" echo "---"
echo "Parameters:" echo "Parameters:"
grep -E -e '^\s*# PARAM_Usage:' -e '^\s*# PARAM_Description:' "${0}" | while read -r usage; read -r description; do grep -E -e '^[[:space:]]*# PARAM_Usage:' -e '^[[:space:]]*# PARAM_Description:' "${0}" | while read -r usage; read -r description; do
if [[ ! "${usage}" =~ Usage ]] || [[ ! "${description}" =~ Description ]]; then if [[ ! "${usage}" =~ Usage ]] || [[ ! "${description}" =~ Description ]]; then
echo "Error generating help text." >&2 echo "Error generating help text." >&2
exit 1 exit 1