From c0bd2334708d9bfc6fbeb1c63eae0037eb4157b6 Mon Sep 17 00:00:00 2001 From: Philipp Rudo Date: Tue, 30 Jul 2024 13:35:17 +0200 Subject: [PATCH 19/32] fix(squash): explicitly create required directories At the moment 99squash relies on dracut-install to create the required directories it later links to. This approach is error prone and will cause problems when switching to use 99busybox later on, which tries to add a link to /usr/sbin that hasn't been created. Thus explicitly create the expected directories before installing the minimal initrd. Signed-off-by: Philipp Rudo (cherry picked from commit dde95b10ff6b28330370fd697350f8bc5da422da) Related: RHEL-43460 --- modules.d/99squash/module-setup.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh index 5cbbec63..6aa649b7 100755 --- a/modules.d/99squash/module-setup.sh +++ b/modules.d/99squash/module-setup.sh @@ -40,12 +40,15 @@ squash_get_handler() { } squash_install() { - local _busybox + local _busybox _dir _busybox=$(find_binary busybox) - # Create mount points for squash loader - mkdir -p "$initdir"/squash/ - mkdir -p "$squashdir"/squash/ + # Create mount points for squash loader and basic directories + mkdir -p "$initdir"/squash + for _dir in squash usr/bin usr/sbin usr/lib; do + mkdir -p "$squashdir/$_dir" + [[ $_dir == usr/* ]] && ln_r "/$_dir" "${_dir#usr}" + done # Install required modules and binaries for the squash image init script. if [[ $_busybox ]]; then @@ -67,8 +70,6 @@ squash_install() { dracut_kernel_post # Install squash image init script. - ln_r /usr/bin /bin - ln_r /usr/sbin /sbin inst_simple "$moddir"/init-squash.sh /init # make sure that library links are correct and up to date for squash loader -- 2.42.0