Merge branch 'fix/remove-sudo-in-test-script' of https://github.com/dpronin/fio
[fio.git] / ci / common.sh
CommitLineData
ce1b5612
SW
1# shellcheck shell=bash
2
3function set_ci_target_os {
4 # Function that exports CI_TARGET_OS to the current OS if it is not already
5 # set.
6
7 # Don't override CI_TARGET_OS if already set
8 CI_TARGET_OS=${CI_TARGET_OS:-}
9 if [[ -z ${CI_TARGET_OS} ]]; then
10 # Detect operating system
11 case "${OSTYPE}" in
12 linux*)
13 CI_TARGET_OS="linux"
14 ;;
15 darwin*)
16 CI_TARGET_OS="macos"
17 ;;
18 msys*)
19 CI_TARGET_OS="windows"
20 ;;
21 bsd*)
22 CI_TARGET_OS="bsd"
23 ;;
24 *)
25 CI_TARGET_OS=""
26 esac
27 fi
28
29 # Don't override CI_TARGET_ARCH if already set
30 CI_TARGET_ARCH=${CI_TARGET_ARCH:-}
31 if [[ -z ${CI_TARGET_ARCH} ]]; then
32 CI_TARGET_ARCH="$(uname -m)"
33 fi
34}