chore: make get-distro.sh aware of windows
This commit is contained in:
parent
84651d5b07
commit
d6d232a7dd
|
@ -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)
|
||||||
DIST='centos'
|
SYSTEM='macos'
|
||||||
VERSION_ID="$(rpm --eval '%{centos_ver}')"
|
;;
|
||||||
else
|
Linux)
|
||||||
DIST="$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g')"
|
if grep -q -i 'rhel' /etc/*-release; then
|
||||||
VERSION_ID="$(sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')"
|
DIST='centos'
|
||||||
fi
|
VERSION_ID="$(rpm --eval '%{rhel}')"
|
||||||
echo "${DIST}${VERSION_ID}" | sed -r 's/([a-zA-Z]*)-.*/\1/g'
|
else
|
||||||
fi
|
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')"
|
||||||
|
fi
|
||||||
|
SYSTEM="$(echo "${DIST}${VERSION_ID}" | sed -r 's/([a-zA-Z]*)-.*/\1/g')"
|
||||||
|
;;
|
||||||
|
CYGWIN*|MSYS*|MINGW*)
|
||||||
|
SYSTEM="windows"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo "$SYSTEM"
|
||||||
|
|
Loading…
Reference in New Issue