Misthios/fedora intune defender os version #5

Merged
Misthios merged 2 commits from misthios/fedora-intune-defender-os-version into main 2026-10-20 12:49:34 +00:00
Showing only changes of commit e8cfa8d4cf - Show all commits
@@ -5,16 +5,23 @@
# "44". Himmelblau reports VERSION_ID as the device's OS version and has no # "44". Himmelblau reports VERSION_ID as the device's OS version and has no
# setting for it. The rest of the system keeps the stock VERSION_ID, which # setting for it. The rest of the system keeps the stock VERSION_ID, which
# toolbox, flatpak and dnf expect to be the plain release. # toolbox, flatpak and dnf expect to be the plain release.
#
# PRETTY_NAME becomes just NAME: libhimmelblau reports "PRETTY_NAME VERSION_ID"
# as the OS version string, and Fedora's PRETTY_NAME already contains the
# version ("Fedora Linux 44.20261020.0 (Forty Four) 44.20261020.0"). Nothing
# else in Himmelblau reads PRETTY_NAME.
set -euo pipefail set -euo pipefail
SRC=/usr/lib/os-release SRC=/usr/lib/os-release
DEST=/run/himmelblau-os-release DEST=/run/himmelblau-os-release
version="$(. "${SRC}" && echo "${OSTREE_VERSION:-${IMAGE_VERSION:-}}")" version="$(. "${SRC}" && echo "${OSTREE_VERSION:-${IMAGE_VERSION:-}}")"
name="$(. "${SRC}" && echo "${NAME:-Linux}")"
tmp="$(mktemp "${DEST}.XXXXXX")" tmp="$(mktemp "${DEST}.XXXXXX")"
if [[ -n "${version}" ]]; then if [[ -n "${version}" ]]; then
sed "s/^VERSION_ID=.*/VERSION_ID=${version}/" "${SRC}" > "${tmp}" sed -e "s/^VERSION_ID=.*/VERSION_ID=${version}/" \
-e "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${name}\"/" "${SRC}" > "${tmp}"
else else
# No image version (not an ostree/bootc deployment): pass it through as-is. # No image version (not an ostree/bootc deployment): pass it through as-is.
cat "${SRC}" > "${tmp}" cat "${SRC}" > "${tmp}"