Merge pull request #7510 fix get-distro.sh for windows

chore: fix get-distro.sh for windows
This commit is contained in:
Zaiming (Stone) Shi 2022-04-04 15:03:21 +01:00 committed by GitHub
commit 5b36ec8cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 13 deletions

View File

@ -99,7 +99,7 @@ $(PROFILES:%=clean-%):
.PHONY: clean-all .PHONY: clean-all
clean-all: clean-all:
@rm -rf _build @rm -rf _build
@rm rebar.lock @rm -f rebar.lock
.PHONY: deps-all .PHONY: deps-all
deps-all: $(REBAR) $(PROFILES:%=deps-%) deps-all: $(REBAR) $(PROFILES:%=deps-%)

View File

@ -5,15 +5,24 @@
set -euo pipefail set -euo pipefail
if [ "$(uname -s)" = 'Darwin' ]; then UNAME="$(uname -s)"
echo 'macos'
elif [ "$(uname -s)" = 'Linux' ]; then case "$UNAME" in
if grep -q -i 'centos' /etc/*-release; then Darwin)
SYSTEM='macos'
;;
Linux)
if grep -q -i 'rhel' /etc/*-release; then
DIST='centos' DIST='centos'
VERSION_ID="$(rpm --eval '%{centos_ver}')" VERSION_ID="$(rpm --eval '%{rhel}')"
else else
DIST="$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g')" DIST="$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g')"
VERSION_ID="$(sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')" VERSION_ID="$(sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')"
fi fi
echo "${DIST}${VERSION_ID}" | sed -r 's/([a-zA-Z]*)-.*/\1/g' SYSTEM="$(echo "${DIST}${VERSION_ID}" | sed -r 's/([a-zA-Z]*)-.*/\1/g')"
fi ;;
CYGWIN*|MSYS*|MINGW*)
SYSTEM="windows"
;;
esac
echo "$SYSTEM"