squash: fix and simplify required_in_root
If required target is a symbol link, create the link then following the link. If it's a directory, create new directory, else just move it. Signed-off-by: Kairui Song <kasong@redhat.com>master
parent
ab703f44b4
commit
f6bbd024d9
42
dracut.sh
42
dracut.sh
|
|
@ -1811,30 +1811,26 @@ if dracut_module_included "squash"; then
|
||||||
required_in_root $(dirname $file)
|
required_in_root $(dirname $file)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d $_sqsh_file ]]; then
|
if [[ -L $_sqsh_file ]]; then
|
||||||
if [[ -L $_sqsh_file ]]; then
|
cp --preserve=all -P $_sqsh_file $_init_file
|
||||||
cp --preserve=all -P $_sqsh_file $_init_file
|
_sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
|
||||||
else
|
if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
|
||||||
mkdir $_init_file
|
# Relative symlink
|
||||||
fi
|
required_in_root ${_sqsh_file#$squash_dir/}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ -e $squash_dir$_sqsh_file ]]; then
|
||||||
|
# Absolute symlink
|
||||||
|
required_in_root ${_sqsh_file#/}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
required_in_root ${module_spec#$squash_dir/}
|
||||||
else
|
else
|
||||||
if [[ -L $_sqsh_file ]]; then
|
if [[ -d $_sqsh_file ]]; then
|
||||||
cp --preserve=all -P $_sqsh_file $_init_file
|
mkdir $_init_file
|
||||||
_sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
|
else
|
||||||
if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
|
mv $_sqsh_file $_init_file
|
||||||
# Relative symlink
|
fi
|
||||||
required_in_root ${_sqsh_file#$squash_dir/}
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [[ -e $squash_dir$_sqsh_file ]]; then
|
|
||||||
# Absolute symlink
|
|
||||||
required_in_root ${_sqsh_file#/}
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
required_in_root ${module_spec#$squash_dir/}
|
|
||||||
else
|
|
||||||
mv $_sqsh_file $_init_file
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue