Преглед изворни кода

build(macos): do not depend on gsed

Zaiming (Stone) Shi пре 3 година
родитељ
комит
eb03e6ca9b
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      scripts/get-distro.sh

+ 2 - 2
scripts/get-distro.sh

@@ -10,8 +10,8 @@ UNAME="$(uname -s)"
 case "$UNAME" in
     Darwin)
         DIST='macos'
-        VERSION_ID=$(sw_vers | gsed -n '/^ProductVersion:/p' | gsed -r 's/ProductVersion:(.*)/\1/g' | gsed -r 's/([0-9]+).*/\1/g' | gsed 's/^[ \t]*//g')
-        SYSTEM="$(echo "${DIST}${VERSION_ID}" | gsed -r 's/([a-zA-Z]*)-.*/\1/g')"
+        VERSION_ID="$(sw_vers | grep 'ProductVersion' | cut -d':' -f 2 | cut -d'.' -f1 | tr -d ' \t')"
+        SYSTEM="${DIST}${VERSION_ID}"
         ;;
     Linux)
         if grep -q -i 'rhel' /etc/*-release; then