From b9613e0c558cfc6704545f90ba4836619db8a171 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Mar 11 2020 20:35:26 +0000 Subject: Install os-release(5) content to /usr/lib and have /etc/os-release be a symlink When trying to use CentOS to build "stateless" systems or building nspawn containers, the presence of os-release(5) data in /usr/lib/os-release is expected. Not having this file causes problems for tools that expect the data to be in /usr/lib/os-release and would regenerate the symlink in /etc/os-release. Reference: https://bugzilla.redhat.com/1766754 Signed-off-by: Neal Gompa --- diff --git a/SPECS/centos-release.spec b/SPECS/centos-release.spec index def7227..869b239 100644 --- a/SPECS/centos-release.spec +++ b/SPECS/centos-release.spec @@ -115,8 +115,9 @@ echo OK %install rm -rf %{buildroot} -# create /etc +# create skeleton mkdir -p %{buildroot}/etc +mkdir -p %{buildroot}%{_prefix}/lib # create /etc/system-release and /etc/redhat-release echo "%{product_family} release %{full_release_version}.%{centos_rel} (%{release_name}) " > %{buildroot}/etc/centos-release @@ -124,8 +125,8 @@ echo "Derived from Red Hat Enterprise Linux %{upstream_rel} (Source)" > %{buildr ln -s centos-release %{buildroot}/etc/system-release ln -s centos-release %{buildroot}/etc/redhat-release -# create /etc/os-release -cat << EOF >>%{buildroot}/etc/os-release +# Create the os-release file +cat << EOF >>%{buildroot}%{_prefix}/lib/os-release NAME="%{product_family}" VERSION="%{full_release_version} (%{release_name})" ID="centos" @@ -144,6 +145,9 @@ REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="%{base_release_version}" EOF +# Create the symlink for /etc/os-release +ln -s ../usr/lib/os-release %{buildroot}%{_sysconfdir}/os-release + # write cpe to /etc/system/release-cpe echo "cpe:/o:centos:centos:%{base_release_version}" > %{buildroot}/etc/system-release-cpe @@ -235,6 +239,7 @@ rm -rf %{buildroot} %{_docdir}/centos-release/* %{_datadir}/redhat-release %{_datadir}/centos-release/* +%{_prefix}/lib/os-release %{_prefix}/lib/systemd/system-preset/* %ifarch %{arm} %attr(0755,root,root) %{_bindir}/update-boot