72 lines
2.5 KiB
Diff
72 lines
2.5 KiB
Diff
From b6d52b504fc7eefc3f405f75463d9e818471ee99 Mon Sep 17 00:00:00 2001
|
|
From: Kairui Song <kasong@redhat.com>
|
|
Date: Mon, 11 Mar 2019 19:46:19 +0800
|
|
Subject: [PATCH] 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>
|
|
(cherry picked from commit 11ce69e4bd9172cf54251ea62bb4a5ead1700fd6)
|
|
|
|
Resolves: #1691705
|
|
---
|
|
dracut.sh | 42 +++++++++++++++++++-----------------------
|
|
1 file changed, 19 insertions(+), 23 deletions(-)
|
|
|
|
diff --git a/dracut.sh b/dracut.sh
|
|
index a0158f22..6de88b3e 100755
|
|
--- a/dracut.sh
|
|
+++ b/dracut.sh
|
|
@@ -1811,30 +1811,26 @@ if dracut_module_included "squash"; then
|
|
required_in_root $(dirname $file)
|
|
fi
|
|
|
|
- if [[ -d $_sqsh_file ]]; then
|
|
- if [[ -L $_sqsh_file ]]; then
|
|
- cp --preserve=all -P $_sqsh_file $_init_file
|
|
- else
|
|
- mkdir $_init_file
|
|
- fi
|
|
+ if [[ -L $_sqsh_file ]]; then
|
|
+ cp --preserve=all -P $_sqsh_file $_init_file
|
|
+ _sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
|
|
+ if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
|
|
+ # Relative symlink
|
|
+ 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
|
|
- if [[ -L $_sqsh_file ]]; then
|
|
- cp --preserve=all -P $_sqsh_file $_init_file
|
|
- _sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
|
|
- if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
|
|
- # Relative symlink
|
|
- 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
|
|
+ if [[ -d $_sqsh_file ]]; then
|
|
+ mkdir $_init_file
|
|
+ else
|
|
+ mv $_sqsh_file $_init_file
|
|
+ fi
|
|
fi
|
|
}
|
|
|
|
|