dracut: Drop disable-xattr dracut patch, introduce config to optionally enable it (#10070)

Signed-off-by: Chris Co <chrco@microsoft.com>
Co-authored-by: Chris Co <chrco@microsoft.com>
This commit is contained in:
Cameron E Baird 2024-08-23 17:39:34 -07:00 коммит произвёл GitHub
Родитель db9a27ce48
Коммит 3c01c0a79f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 21 добавлений и 33 удалений

Просмотреть файл

@ -1,31 +0,0 @@
diff --git a/dracut-init.sh b/dracut-init.sh
index 40b66f5..f72de3d 100755
--- a/dracut-init.sh
+++ b/dracut-init.sh
@@ -19,11 +19,7 @@
#
export LC_MESSAGES=C
-if [[ $EUID == "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
- export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
-else
- export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
-fi
+export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
# is_func <command>
# Check whether $1 is a function.
diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c
index 96b20e9..433ebf7 100644
--- a/src/install/dracut-install.c
+++ b/src/install/dracut-install.c
@@ -329,8 +329,7 @@ static int cp(const char *src, const char *dst)
normal_copy:
pid = fork();
- const char *preservation = (geteuid() == 0
- && no_xattr == false) ? "--preserve=mode,xattr,timestamps,ownership" : "--preserve=mode,timestamps,ownership";
+ const char *preservation = "--preserve=mode,timestamps";
if (pid == 0) {
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", preservation, "-fL", src, dst, NULL);
_exit(errno == ENOENT ? 127 : 126);

Просмотреть файл

@ -0,0 +1,2 @@
# disable xattr
DRACUT_NO_XATTR=1

Просмотреть файл

@ -5,6 +5,7 @@
"00-virtio.conf": "173e93feea30f328d4cda7d07f756446fe45830ad9a5ee99b007bed0579b9a64",
"00-vrf.conf": "e2885a4b090d8ca3771e60ce6dcd8b849e28ce5002a5c7b71ff796a92deb2810",
"00-xen.conf": "8b7a89b7716cb40a9c0d681caed6994d81ff4dfad4fe50cea15cd47b885dc5a6",
"50-noxattr.conf": "61d95f05890ac6ee3355d0a386dd5645d82b7a4202d90305d997fd18c6d139dd",
"dracut-102.tar.gz": "601b175cbf4d2ee902bb7bda3af8826ae2ca060c1af880f6da5a833413f4ec70",
"lgpl-2.1.txt": "dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551",
"megaraid.conf": "914824cdbe0c525b71efa05a75e453335b0068beb8bc28bef2a5866d74bf7dd4",

Просмотреть файл

@ -4,7 +4,7 @@
Summary: dracut to create initramfs
Name: dracut
Version: 102
Release: 3%{?dist}
Release: 4%{?dist}
# The entire source code is GPLv2+
# except install/* which is LGPLv2+
License: GPLv2+ AND LGPLv2+
@ -23,13 +23,13 @@ Source7: 00-hyperv.conf
Source8: 00-virtio.conf
Source9: 00-vrf.conf
Source10: 00-xen.conf
Source11: 50-noxattr.conf
# allow-liveos-overlay-no-user-confirmation-prompt.patch has been introduced by
# the Mariner team to allow skipping the user confirmation prompt during boot
# when the overlay of the liveos is backed by ram. This allows the machine to
# boot without being blocked on user input in such a scenario.
Patch: allow-liveos-overlay-no-user-confirmation-prompt.patch
Patch: 0002-disable-xattr.patch
Patch: 0006-dracut.sh-validate-instmods-calls.patch
Patch: 0011-Remove-reference-to-kernel-module-zlib-in-fips-module.patch
Patch: 0012-fix-dracut-functions-avoid-awk-in-get_maj_min.patch
@ -96,6 +96,13 @@ Requires: %{name} = %{version}-%{release}
%description megaraid
This package contains dracut configuration needed to build an initramfs with MegaRAID driver support.
%package noxattr
Summary: dracut configuration needed to disable preserving of xattr file metadata
Requires: %{name} = %{version}-%{release}
%description noxattr
This package contains dracut configuration needed to disable preserving of xattr file metadata.
%package tools
Summary: dracut tools to build the local initramfs
Requires: %{name} = %{version}-%{release}
@ -174,6 +181,7 @@ install -m 0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/dracut.conf.d/00-hyperv.co
install -m 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/dracut.conf.d/00-virtio.conf
install -m 0644 %{SOURCE9} %{buildroot}%{_sysconfdir}/dracut.conf.d/00-vrf.conf
install -m 0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/dracut.conf.d/00-xen.conf
install -m 0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/dracut.conf.d/50-noxattr.conf
mkdir -p %{buildroot}%{dracutlibdir}/modules.d/20overlayfs/
install -p -m 0755 %{SOURCE4} %{buildroot}%{dracutlibdir}/modules.d/20overlayfs/
@ -251,6 +259,10 @@ ln -srv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_sbindir}/%{name}
%defattr(-,root,root,0755)
%{_sysconfdir}/dracut.conf.d/50-megaraid.conf
%files noxattr
%defattr(-,root,root,0755)
%{_sysconfdir}/dracut.conf.d/50-noxattr.conf
%files tools
%defattr(-,root,root,0755)
@ -276,6 +288,10 @@ ln -srv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_sbindir}/%{name}
%dir %{_sharedstatedir}/%{name}/overlay
%changelog
* Mon Aug 19 2024 Cameron Baird <cameronbaird@microsoft.com> - 102-4
- Drop 0002-disable-xattr.patch
- Introduce dracut-noxattr subpackage to expose this behavior as an option
* Thu Aug 08 2024 Cameron Baird <cameronbaird@microsoft.com> - 102-3
- Drop 0007-feat-dracut.sh-support-multiple-config-dirs.patch