aboutsummaryrefslogtreecommitdiffstats
path: root/shlib/os.sh
blob: 4fb798994656a0193639531b73f827eb1742ee78 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# shellcheck shell=sh
[ -n "${DOTFILES_OS_LOADED}" ] && return
readonly DOTFILES_OS_LOADED=1

os_print() {
  uname
}

os_is_macos() {
  [ "$(os_print)" = "Darwin" ]
}

os_is_openbsd() {
  [ "$(os_print)" = "OpenBSD" ]
}

os_is_linux() {
  [ "$(os_print)" = "Linux" ]
}

os_is_linux_debian() {
  _linux_debian_id=$(. /etc/os-release && echo $ID)
  [ os_is_linux ] && [ "$_linux_debian_id" = "debian" ]
}