diff options
author | waja <waja@users.noreply.github.com> | 2024-02-23 13:25:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-23 13:25:44 (GMT) |
commit | 0c01f2946ed21f5e7977b5503f9c9f00e72fd708 (patch) | |
tree | 12970968285d666e22d7d06644804edd2bf7d7e7 /.github/os_detect.sh | |
parent | f6d7bf86563e53aeca1f764a4c61e6025049406a (diff) | |
download | monitoring-plugins-0c01f2946ed21f5e7977b5503f9c9f00e72fd708.tar.gz |
CI specfile (#1894)
* Adding spec file and github pipeline for testing
* Restructure github pipelines for more clarity
* Add build tests for several RPM based distributions
---------
Co-authored-by: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>
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 0000000..ee9c145 --- /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) | ||