]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
feat(dracut): disable xattr when creating cpios
authorJo Zzsi <jozzsicsataban@gmail.com>
Sun, 28 Dec 2025 14:11:45 +0000 (09:11 -0500)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Tue, 6 Jan 2026 13:20:42 +0000 (08:20 -0500)
Disable xattr when creating cpio, but do not change
the default for squashfs/erofs.

Move setting the default for DRACUT_CP later in the code to
account for the newly set defaults.

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1561
dracut.sh

index d8dbcc5c818c06a438a6216e375837dbde1bdc02..f8a8954fa1e7dae4b8562eb00aa79d0daf5b92b8 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1477,12 +1477,6 @@ fi
 
 export LC_MESSAGES=C kernel
 
-if [[ $EUID == "0" ]] && ! [[ ${DRACUT_NO_XATTR-} ]]; then
-    export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,xattr,links -dfr"
-else
-    export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,links -dfr"
-fi
-
 if ! [[ ${dracutbasedir-} ]]; then
     dracutbasedir=${BASH_SOURCE[0]%/*}
     [[ $dracutbasedir == dracut-functions* ]] && dracutbasedir="."
@@ -2784,6 +2778,17 @@ fi
 
 dracut_module_included "squash-lib" && mkdir -p "$squashdir"
 
+# disable xattr when creating cpio, but do not change the default for squashfs/erofs
+if ! dracut_module_included "squash-lib"; then
+    export DRACUT_NO_XATTR="${DRACUT_NO_XATTR:=1}"
+fi
+
+if [[ $EUID == "0" ]] && ! [[ ${DRACUT_NO_XATTR-} ]]; then
+    export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,xattr,links -dfr"
+else
+    export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,links -dfr"
+fi
+
 _isize=0 #initramfs size
 modules_loaded=" "
 # Allow all modules to update the config. Do this before installing anything.