Browse Source

dracut: Don't fail at copying files when including directories

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/
master
Erwan Velu 10 years ago committed by Harald Hoyer
parent
commit
332ecaa900
  1. 7
      dracut.sh

7
dracut.sh

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

Loading…
Cancel
Save