]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
fix command_version on Darwin/macOS 11
authorJoao Morais <jcmoraisjr@gmail.com>
Sun, 17 Oct 2021 12:26:46 +0000 (09:26 -0300)
committerLukas Schauer <lukas@schauer.dev>
Sun, 31 Oct 2021 18:08:52 +0000 (19:08 +0100)
Current output of `uname` on Darwin/macOS 11 is only `Darwin`, which
breaks the premisse used in `command_version()`. This update adds
`Darwin` alongside `BSD`.

dehydrated

index d61807e993ec0ac07a7757ad56245a8bec773d6b..9c1de44c9064ee66e5e28845c06bc276834d1e81 100755 (executable)
@@ -1440,7 +1440,7 @@ command_version() {
   revision="$(cd "${SCRIPTDIR}"; git rev-parse HEAD 2>/dev/null || echo "unknown")"
   echo "GIT-Revision: ${revision}"
   echo ""
-  if [[ "${OSTYPE}" =~ "BSD" ]]; then
+  if [[ "${OSTYPE}" =~ (BSD|Darwin) ]]; then
     echo "OS: $(uname -sr)"
   elif [[ -e /etc/os-release ]]; then
     ( . /etc/os-release && echo "OS: $PRETTY_NAME" )
@@ -1453,7 +1453,7 @@ command_version() {
   [[ -n "${BASH_VERSION:-}" ]] && echo " bash: ${BASH_VERSION}"
   [[ -n "${ZSH_VERSION:-}" ]] && echo " zsh: ${ZSH_VERSION}"
   echo " curl: ${CURL_VERSION}"
-  if [[ "${OSTYPE}" =~ "BSD" ]]; then
+  if [[ "${OSTYPE}" =~ (BSD|Darwin) ]]; then
     echo " awk, sed, mktemp, grep, diff: BSD base system versions"
   else
     echo " awk: $(awk -W version 2>&1 | head -n1)"