diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-11-02 13:37:39 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-11-02 13:37:39 +0100 |
| commit | 3faeed07c4825d5c3ceb323e814e703d9262cd82 (patch) | |
| tree | b6a61e24ffa0fbb4af5f145c137f1f584aaba1bc /.github/os_detect.sh | |
| parent | 735b04eff721a28e791714c0da4c8ac5726bfbcf (diff) | |
| parent | 6d1d1dac32841d5ca6ee51bb09b30a6c604b17e2 (diff) | |
| download | monitoring-plugins-3faeed07c4825d5c3ceb323e814e703d9262cd82.tar.gz | |
Merge branch 'master' into check_swap_again
Diffstat (limited to '.github/os_detect.sh')
| -rw-r--r-- | .github/os_detect.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/.github/os_detect.sh b/.github/os_detect.sh new file mode 100644 index 00000000..ee9c145d --- /dev/null +++ b/.github/os_detect.sh | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #!/bin/sh -e | ||
| 2 | # workaround for really bare-bones Archlinux containers: | ||
| 3 | if [ -x "$(command -v pacman)" ]; then | ||
| 4 | pacman --noconfirm -Sy | ||
| 5 | pacman --noconfirm -S grep gawk sed | ||
| 6 | fi | ||
| 7 | |||
| 8 | os_release_file= | ||
| 9 | if [ -s "/etc/os-release" ]; then | ||
| 10 | os_release_file="/etc/os-release" | ||
| 11 | elif [ -s "/usr/lib/os-release" ]; then | ||
| 12 | os_release_file="/usr/lib/os-release" | ||
| 13 | else | ||
| 14 | echo >&2 "Cannot find an os-release file ..." | ||
| 15 | return 1 | ||
| 16 | fi | ||
| 17 | export distro_id=$(grep '^ID=' $os_release_file|awk -F = '{print $2}'|sed 's/\"//g') | ||
| 18 | export platform_id=$(grep '^PLATFORM_ID=' /etc/os-release|awk -F = '{print $2}'|sed 's/\"//g'| cut -d":" -f2) | ||
