]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut: Don't fail at copying files when including directories
authorErwan Velu <erwan.velu@enovance.com>
Wed, 17 Dec 2014 16:04:19 +0000 (17:04 +0100)
committerHarald Hoyer <harald@redhat.com>
Fri, 19 Dec 2014 12:42:57 +0000 (13:42 +0100)
When including a directory, the files were considered in the directory
name which lead to messages like :

cp: failed to access '/var/tmp/initramfs.L9s2zO///init-func': No such file or directory

This patch does make the destdir more explicit and copy files into the
destination directory instead of destdir/filename/

dracut.sh

index 2eba19ba7a2038307a38a9ae2bbd224423ee7eff..07e49658fbe1feeec147d51015b6dfc4e06c0706 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1493,12 +1493,13 @@ while pop include_src src && pop include_target tgt; do
             inst $src $tgt
         else
             ddebug "Including directory: $src"
-            mkdir -p "${initdir}/${tgt}"
+            destdir="${initdir}/${tgt}"
+            mkdir -p "$destdir"
             # check for preexisting symlinks, so we can cope with the
             # symlinks to $prefix
             for i in "$src"/*; do
                 [[ -e "$i" || -h "$i" ]] || continue
-                s=${initdir}/${tgt}/${i#$src/}
+                s=${destdir}/${i#$src/}
                 if [[ -d "$i" ]]; then
                     if ! [[ -e "$s" ]]; then
                         mkdir -m 0755 -p "$s"
@@ -1506,7 +1507,7 @@ while pop include_src src && pop include_target tgt; do
                     fi
                     cp --reflink=auto --sparse=auto -fa -t "$s" "$i"/*
                 else
-                    cp --reflink=auto --sparse=auto -fa -t "$s" "$i"
+                    cp --reflink=auto --sparse=auto -fa -t "$destdir" "$i"
                 fi
             done
         fi