]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
replace pcre-ism with posix class (thanks to @awaw, fixes #52)
authorLukas Schauer <lukas@schauer.so>
Wed, 16 Dec 2015 12:46:33 +0000 (13:46 +0100)
committerLukas Schauer <lukas@schauer.so>
Wed, 16 Dec 2015 12:46:33 +0000 (13:46 +0100)
letsencrypt.sh

index 34ad3afc84ebe3dd700f66ebb0dba84dc90c5177..64ac436b1eed93b1dee43ee6128f22e9925c2712 100755 (executable)
@@ -193,7 +193,7 @@ hex2bin() {
 }
 
 get_json_string_value() {
-  grep -Eo '"'"${1}"'":\s*"[^"]*"' | cut -d'"' -f4
+  grep -Eo '"'"${1}"'":[[:space:]]*"[^"]*"' | cut -d'"' -f4
 }
 
 get_json_array() {
@@ -408,7 +408,7 @@ command_sign_domains() {
     echo "${PARAM_DOMAIN}" > "${DOMAINS_TXT}"
   fi
   # 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)"
     morenames="$(printf '%s\n' "${line}" | cut -s -d' ' -f2-)"
     cert="${BASEDIR}/certs/${domain}/cert.pem"
@@ -475,7 +475,7 @@ command_help() {
   echo
   (
   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
       echo "Error generating help text." >&2
       exit 1
@@ -484,7 +484,7 @@ command_help() {
   done
   echo "---"
   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
       echo "Error generating help text." >&2
       exit 1