From 8647b74cbc7f134b22d8b5ab6f9975440736dc37 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 6 Nov 2019 22:27:16 +0000 Subject: [PATCH] Use the POSIX compliant flag for `sed`. Fixes Mac OS bootstrapping. --- bootstrap-salt.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 9bc4030..9991fed 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -674,7 +674,7 @@ if [ -n "$_PY_EXE" ]; then if [ "$(uname)" = "Darwin" ]; then _PY_PKG_VER=$(echo "$_PY_EXE" | sed "s/\\.//g") else - _PY_PKG_VER=$(echo "$_PY_EXE" | sed -r "s/\\.//g") + _PY_PKG_VER=$(echo "$_PY_EXE" | sed -E "s/\\.//g") fi _PY_MAJOR_VERSION=$(echo "$_PY_PKG_VER" | cut -c 7) @@ -933,11 +933,11 @@ __strip_duplicates() { __sort_release_files() { KNOWN_RELEASE_FILES=$(echo "(arch|alpine|centos|debian|ubuntu|fedora|redhat|suse|\ mandrake|mandriva|gentoo|slackware|turbolinux|unitedlinux|void|lsb|system|\ - oracle|os)(-|_)(release|version)" | sed -r 's:[[:space:]]::g') + oracle|os)(-|_)(release|version)" | sed -E 's:[[:space:]]::g') primary_release_files="" secondary_release_files="" # Sort know VS un-known files first - for release_file in $(echo "${@}" | sed -r 's:[[:space:]]:\n:g' | sort -f | uniq); do + for release_file in $(echo "${@}" | sed -E 's:[[:space:]]:\n:g' | sort -f | uniq); do match=$(echo "$release_file" | grep -E -i "${KNOWN_RELEASE_FILES}") if [ "${match}" != "" ]; then primary_release_files="${primary_release_files} ${release_file}" @@ -962,7 +962,7 @@ __sort_release_files() { done # Echo the results collapsing multiple white-space into a single white-space - echo "${primary_release_files} ${secondary_release_files}" | sed -r 's:[[:space:]]+:\n:g' + echo "${primary_release_files} ${secondary_release_files}" | sed -E 's:[[:space:]]+:\n:g' } @@ -1181,17 +1181,17 @@ __gather_sunos_system_info() { case "$line" in *OpenIndiana*oi_[0-9]*) DISTRO_NAME="OpenIndiana" - DISTRO_VERSION=$(echo "$line" | sed -nr "s/OpenIndiana(.*)oi_([[:digit:]]+)(.*)/\\2/p") + DISTRO_VERSION=$(echo "$line" | sed -nE "s/OpenIndiana(.*)oi_([[:digit:]]+)(.*)/\\2/p") break ;; *OpenSolaris*snv_[0-9]*) DISTRO_NAME="OpenSolaris" - DISTRO_VERSION=$(echo "$line" | sed -nr "s/OpenSolaris(.*)snv_([[:digit:]]+)(.*)/\\2/p") + DISTRO_VERSION=$(echo "$line" | sed -nE "s/OpenSolaris(.*)snv_([[:digit:]]+)(.*)/\\2/p") break ;; *Oracle*Solaris*[0-9]*) DISTRO_NAME="Oracle Solaris" - DISTRO_VERSION=$(echo "$line" | sed -nr "s/(Oracle Solaris) ([[:digit:]]+)(.*)/\\2/p") + DISTRO_VERSION=$(echo "$line" | sed -nE "s/(Oracle Solaris) ([[:digit:]]+)(.*)/\\2/p") break ;; *Solaris*) @@ -1712,7 +1712,7 @@ echoinfo " Distribution: ${DISTRO_NAME} ${DISTRO_VERSION}" echo # Simplify distro name naming on functions -DISTRO_NAME_L=$(echo "$DISTRO_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z0-9_ ]//g' | sed -re 's/([[:space:]])+/_/g') +DISTRO_NAME_L=$(echo "$DISTRO_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z0-9_ ]//g' | sed -Ee 's/([[:space:]])+/_/g') # Simplify version naming on functions if [ "$DISTRO_VERSION" = "" ] || [ ${_SIMPLIFY_VERSION} -eq $BS_FALSE ]; then @@ -2507,7 +2507,7 @@ __activate_virtualenv() { __install_pip_pkgs() { _pip_pkgs="$1" _py_exe="$2" - _py_pkg=$(echo "$_py_exe" | sed -r "s/\\.//g") + _py_pkg=$(echo "$_py_exe" | sed -E "s/\\.//g") _pip_cmd="${_py_exe} -m pip" if [ "${_py_exe}" = "" ]; then