Revert "always regenerate /etc/rear/os.conf in %post"

It is better to generate the file statically. Do not mark it as
configuration file though, it is not intended to be modified. This
allows to update it when the package is updated.

This reverts commit f02d557bbc.

Resolves: RHEL-26827
This commit is contained in:
Pavel Cahyna 2024-08-06 18:45:39 +02:00
parent 5f676f072f
commit dc29def991

View File

@ -183,8 +183,6 @@ Requires: xorriso
Requires: util-linux
%endif
Requires(post): /etc/os-release
%description
Relax-and-Recover is the leading Open Source disaster recovery and system
migration solution. It comprises of a modular
@ -209,6 +207,10 @@ Professional services and support are available.
%prep
%autosetup -p1 -S git
### Add a specific os.conf so we do not depend on LSB dependencies
%{?fedora:echo -e "OS_VENDOR=Fedora\nOS_VERSION=%{?fedora}" >etc/rear/os.conf}
%{?rhel:echo -e "OS_VENDOR=RedHatEnterpriseServer\nOS_VERSION=%{?rhel}" >etc/rear/os.conf}
# Change /lib to /usr/lib for COPY_AS_IS
sed -E -e "s:([\"' ])/lib:\1/usr/lib:g" \
-i usr/share/rear/prep/GNU/Linux/*include*.sh
@ -236,20 +238,11 @@ install -m 0644 %{SOURCE1} %{buildroot}%{_docdir}/%{name}/
install -m 0644 %{SOURCE2} %{buildroot}%{_docdir}/%{name}/
install -m 0644 %{SOURCE3} %{buildroot}%{_docdir}/%{name}/
%post
# Regenerate /etc/rear/os.conf file after install. Otherwise, it will
# contain stale information after system upgrade.
cat > %{_sysconfdir}/rear/os.conf <<EOF
OS_VENDOR=%{?fedora:Fedora}%{?rhel:RedHatEnterpriseServer}
OS_VERSION=$(. /etc/os-release; echo $VERSION_ID)
EOF
#-- FILES ---------------------------------------------------------------------#
%files
%license COPYING
%doc MAINTAINERS README.adoc doc/*.txt doc/user-guide/*.html
%config(noreplace) %{_sysconfdir}/rear/local.conf
%ghost %{_sysconfdir}/rear/os.conf
%{_datadir}/rear/
%{_docdir}/%{name}/rear.*
%{_mandir}/man8/rear.8*