summaryrefslogtreecommitdiffstats
path: root/.github/os_detect.sh
diff options
context:
space:
mode:
authorwaja <waja@users.noreply.github.com>2024-02-23 14:25:44 +0100
committerGitHub <noreply@github.com>2024-02-23 14:25:44 +0100
commit0c01f2946ed21f5e7977b5503f9c9f00e72fd708 (patch)
tree12970968285d666e22d7d06644804edd2bf7d7e7 /.github/os_detect.sh
parentf6d7bf86563e53aeca1f764a4c61e6025049406a (diff)
downloadmonitoring-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.sh18
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:
3if [ -x "$(command -v pacman)" ]; then
4 pacman --noconfirm -Sy
5 pacman --noconfirm -S grep gawk sed
6fi
7
8os_release_file=
9if [ -s "/etc/os-release" ]; then
10 os_release_file="/etc/os-release"
11elif [ -s "/usr/lib/os-release" ]; then
12 os_release_file="/usr/lib/os-release"
13else
14 echo >&2 "Cannot find an os-release file ..."
15 return 1
16fi
17export distro_id=$(grep '^ID=' $os_release_file|awk -F = '{print $2}'|sed 's/\"//g')
18export platform_id=$(grep '^PLATFORM_ID=' /etc/os-release|awk -F = '{print $2}'|sed 's/\"//g'| cut -d":" -f2)