From eef65961330c8fb68493d9a3eab55171482984c1 Mon Sep 17 00:00:00 2001 From: Philipp Rudo Date: Tue, 30 Jul 2024 13:44:32 +0200 Subject: [PATCH 20/32] fix(squash): use 99busybox instead of installing it manually Make use of 99busybox in 99squash rather than installing it manually. This not only removes duplicate code but allows mixing of busybox with tools from coreutils. This requires a small change in 99busybox to remove the hard coded use of $initdir. Suggested-by: Laszlo Gombos Signed-off-by: Philipp Rudo (cherry picked from commit 395366278f473038badba239f76cac391428b149) Related: RHEL-43460 --- modules.d/05busybox/module-setup.sh | 5 +++++ modules.d/99squash/module-setup.sh | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh index 86b3761a..857145c9 100755 --- a/modules.d/05busybox/module-setup.sh +++ b/modules.d/05busybox/module-setup.sh @@ -15,6 +15,7 @@ depends() { # called by dracut install() { local _i _path _busybox + local _dstdir="${dstdir:-"$initdir"}" local _progs=() _busybox=$(find_binary busybox) inst "$_busybox" /usr/bin/busybox @@ -26,6 +27,10 @@ install() { for _i in "${_progs[@]}"; do _path=$(find_binary "$_i") [ -z "$_path" ] && continue + + # do not remove existing destination files + [ -e "${_dstdir}/$_path" ] && continue + ln_r /usr/bin/busybox "$_path" done } diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh index 6aa649b7..56f70774 100755 --- a/modules.d/99squash/module-setup.sh +++ b/modules.d/99squash/module-setup.sh @@ -52,10 +52,7 @@ squash_install() { # Install required modules and binaries for the squash image init script. if [[ $_busybox ]]; then - inst "$_busybox" /usr/bin/busybox - for _i in sh echo mount modprobe mkdir switch_root grep umount; do - ln_r /usr/bin/busybox /usr/bin/$_i - done + module_install "busybox" else DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep umount -- 2.42.0