mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
scripts/cpictl: Detect RHCOS using VARIANT_ID
CoreOS uses VARIANT_ID instead of a unique ID in /etc/os-release. Extend distro detection to identify RHCOS, other CoreOS variants may be added later if needed. RHCOS is showing in HMC as RHEL, because `system_level' is: ``` [core@cosa-devsh ~]$ cat /sys/firmware/cpi/system_level 0x010906023a050e00 ``` But should be: ``` [core@cosa-devsh ~]$ cat /sys/firmware/cpi/system_level 0x070906023a050e00 ``` Issue: https://jsw.ibm.com/browse/OCPVIP-1471 Closes: https://github.com/ibm-s390-linux/s390-tools/pull/199 Signed-off-by: Nikita Dubrovskii <nikita@linux.ibm.com> Reviewed-by: Marc Hartmayer <marc@linux.ibm.com> Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
eb881c2a39
commit
3123f56765
@@ -346,12 +346,17 @@ get_distro()
|
||||
{
|
||||
local line ID="linux" VERSION_ID="0" VERSION="" update
|
||||
|
||||
# CoreOS variants don’t have a unique ID in /etc/os-release, so use VARIANT_ID instead.
|
||||
# https://github.com/coreos/rhel-coreos-config/blob/main/common.yaml#L85
|
||||
# https://github.com/coreos/fedora-coreos-config/blob/testing-devel/tests/kola/data/commonlib.sh#L43
|
||||
local VARIANT_ID=""
|
||||
|
||||
[[ ! -e "$OS_RELEASE" ]] && return
|
||||
|
||||
# Only import required variables
|
||||
while read -r line ; do
|
||||
if [[ "$line" =~ ^ID= ]] || [[ "$line" =~ ^VERSION_ID= ]] ||
|
||||
[[ "$line" =~ ^VERSION= ]] ; then
|
||||
[[ "$line" =~ ^VERSION= ]] || [[ "$line" =~ ^VARIANT_ID= ]] ; then
|
||||
eval "$line"
|
||||
fi
|
||||
done <"$OS_RELEASE"
|
||||
@@ -364,6 +369,12 @@ get_distro()
|
||||
VERSION_ID="$VERSION_ID$update"
|
||||
fi
|
||||
|
||||
if [[ "$ID" == "rhel" ]] && [[ "$VARIANT_ID" == "coreos" ]] ; then
|
||||
# CoreOS detection via VARIANT_ID (RHCOS only for now)
|
||||
# FCOS and SCOS may be added in the future.
|
||||
ID="rhcos"
|
||||
fi
|
||||
|
||||
echo "$ID:$VERSION_ID"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user