Blame 0077-dracut-Don-t-fail-at-copying-files-when-including-di.patch

Harald Hoyer b94732
From 332ecaa900a5af83ffae64f3e103270e49de88de Mon Sep 17 00:00:00 2001
Harald Hoyer b94732
From: Erwan Velu <erwan.velu@enovance.com>
Harald Hoyer b94732
Date: Wed, 17 Dec 2014 17:04:19 +0100
Harald Hoyer b94732
Subject: [PATCH] dracut: Don't fail at copying files when including
Harald Hoyer b94732
 directories
Harald Hoyer b94732
Harald Hoyer b94732
When including a directory, the files were considered in the directory
Harald Hoyer b94732
name which lead to messages like :
Harald Hoyer b94732
Harald Hoyer b94732
cp: failed to access '/var/tmp/initramfs.L9s2zO///init-func': No such file or directory
Harald Hoyer b94732
Harald Hoyer b94732
This patch does make the destdir more explicit and copy files into the
Harald Hoyer b94732
destination directory instead of destdir/filename/
Harald Hoyer b94732
---
Harald Hoyer b94732
 dracut.sh | 7 ++++---
Harald Hoyer b94732
 1 file changed, 4 insertions(+), 3 deletions(-)
Harald Hoyer b94732
Harald Hoyer b94732
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer b94732
index 2eba19b..07e4965 100755
Harald Hoyer b94732
--- a/dracut.sh
Harald Hoyer b94732
+++ b/dracut.sh
Harald Hoyer b94732
@@ -1493,12 +1493,13 @@ while pop include_src src && pop include_target tgt; do
Harald Hoyer b94732
             inst $src $tgt
Harald Hoyer b94732
         else
Harald Hoyer b94732
             ddebug "Including directory: $src"
Harald Hoyer b94732
-            mkdir -p "${initdir}/${tgt}"
Harald Hoyer b94732
+            destdir="${initdir}/${tgt}"
Harald Hoyer b94732
+            mkdir -p "$destdir"
Harald Hoyer b94732
             # check for preexisting symlinks, so we can cope with the
Harald Hoyer b94732
             # symlinks to $prefix
Harald Hoyer b94732
             for i in "$src"/*; do
Harald Hoyer b94732
                 [[ -e "$i" || -h "$i" ]] || continue
Harald Hoyer b94732
-                s=${initdir}/${tgt}/${i#$src/}
Harald Hoyer b94732
+                s=${destdir}/${i#$src/}
Harald Hoyer b94732
                 if [[ -d "$i" ]]; then
Harald Hoyer b94732
                     if ! [[ -e "$s" ]]; then
Harald Hoyer b94732
                         mkdir -m 0755 -p "$s"
Harald Hoyer b94732
@@ -1506,7 +1507,7 @@ while pop include_src src && pop include_target tgt; do
Harald Hoyer b94732
                     fi
Harald Hoyer b94732
                     cp --reflink=auto --sparse=auto -fa -t "$s" "$i"/*
Harald Hoyer b94732
                 else
Harald Hoyer b94732
-                    cp --reflink=auto --sparse=auto -fa -t "$s" "$i"
Harald Hoyer b94732
+                    cp --reflink=auto --sparse=auto -fa -t "$destdir" "$i"
Harald Hoyer b94732
                 fi
Harald Hoyer b94732
             done
Harald Hoyer b94732
         fi