summaryrefslogtreecommitdiff
path: root/mac/.local/bin/whereami
blob: 68c9ffe22affca257a33d0f624c5a41b8668c29f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

arch=$(uname -m)
os_type=$(uname | tr '[:upper:]' '[:lower:]')

case "${os_type},${arch}" in
"linux,arm" | "linux,arm64" | "linux,x86_64")
  [ -f /etc/os-release ] &&
    grep PRETTY_NAME /etc/os-release | cut -d'=' -f2- | sed 's/"//g' | awk -F' ' '{print $1}' | tr '[:upper:]' '[:lower:]' | sed 's/\(arch\|artix\)/ar/g'
  ;;
"darwin,arm64")
  echo "mac"
  ;;
"darwin,x86_64")
  echo "intel mac"
  ;;
"msys,"* | "cygwin,"* | "windows,"*)
  echo "windows"
  ;;
*)
  echo "Unsupported OS"
  exit
  ;;
esac