Add macOS support under environment/util.sh:operating_system (#1098)

* Fix release/package ubuntu-22.04 amd64 Dockerfile
This commit is contained in:
Marko Budiselić
2023-07-22 19:20:10 +02:00
committed by GitHub
parent ca1e98ad94
commit 919f07fae1
2 changed files with 10 additions and 3 deletions

View File

@@ -1,8 +1,15 @@
#!/bin/bash
function operating_system() {
grep -E '^(VERSION_)?ID=' /etc/os-release | \
sort | cut -d '=' -f 2- | sed 's/"//g' | paste -s -d '-'
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
grep -E '^(VERSION_)?ID=' /etc/os-release | \
sort | cut -d '=' -f 2- | sed 's/"//g' | paste -s -d '-'
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "$(sw_vers -productName)-$(sw_vers -productVersion | cut -d '.' -f 1)"
else
echo "operating_system called on an unknown OS"
exit 1
fi
}
function check_operating_system() {