From f0ea58e375ced839568409d0c2e1e17a42c52126 Mon Sep 17 00:00:00 2001 From: Martin Osvald Date: Tue, 27 Feb 2024 06:35:44 +0000 Subject: [PATCH] Convert to use tmpfiles.d to create initial /root directory Resolves: RHEL-76497 --- rootfiles.conf | 2 ++ rootfiles.spec | 25 ++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 rootfiles.conf diff --git a/rootfiles.conf b/rootfiles.conf new file mode 100644 index 0000000..c0ba135 --- /dev/null +++ b/rootfiles.conf @@ -0,0 +1,2 @@ +# create initial /root directories shell content +C+ /root/ 644 root root - /usr/share/rootfiles/ diff --git a/rootfiles.spec b/rootfiles.spec index 712917f..e9d269c 100644 --- a/rootfiles.spec +++ b/rootfiles.spec @@ -1,7 +1,7 @@ Summary: The basic required files for the root user's directory Name: rootfiles Version: 8.1 -Release: 38%{?dist} +Release: 39%{?dist} License: LicenseRef-Not-Copyrightable # This is a Red Hat maintained package which is specific to @@ -12,8 +12,12 @@ Source1: dot-bash_profile Source2: dot-bash_logout Source3: dot-tcshrc Source4: dot-cshrc +Source5: rootfiles.conf + +%define ROOTFILES_DIR %{_datadir}/rootfiles BuildArch: noarch +BuildRequires: systemd-rpm-macros %description The rootfiles package contains basic required files that are placed @@ -24,23 +28,34 @@ users' home directories. %prep %install -mkdir -p $RPM_BUILD_ROOT/root +mkdir -p $RPM_BUILD_ROOT/%{ROOTFILES_DIR} +install -D -p -m 644 %{SOURCE5} $RPM_BUILD_ROOT/%{_tmpfilesdir}/rootfiles.conf for file in %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} ; do f=`basename $file` - install -p -m 644 $file $RPM_BUILD_ROOT/root/${f/dot-/.} + install -p -m 644 $file $RPM_BUILD_ROOT/%{ROOTFILES_DIR}/${f/dot-/.} done %posttrans if [ $1 -eq 0 ] ; then #copy recursively the content, but do not overwrite the original files provided by rootfiles package - cp -ndr --preserve=ownership,timestamps /etc/skel/. /root/ || : + cp -ndr --preserve=ownership,timestamps /etc/skel/. %{ROOTFILES_DIR}/ || : fi %files -%config(noreplace) /root/.[A-Za-z]* +%dir %{ROOTFILES_DIR} +%{ROOTFILES_DIR}/.[A-Za-z]* +%{_tmpfilesdir}/rootfiles.conf +%ghost /root/.bash_logout +%ghost /root/.bash_profile +%ghost /root/.bashrc +%ghost /root/.cshrc +%ghost /root/.tcshrc %changelog +* Tue Jan 28 2025 David Tardon - 8.1-39 +- Use tmpfiles.d to create initial /root directory (RHEL-76497) + * Tue Oct 29 2024 Troy Dawson - 8.1-38 - Bump release for October 2024 mass rebuild: Resolves: RHEL-64018