mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-07-31 10:09:40 +00:00
fix(xCAT-genesis-base): collapse usr-merged dirs in the netboot image
Building the genesis netboot image on a usr-merged host (openSUSE Leap 15, and increasingly EL) leaves the extracted root with /bin, /sbin, /lib and /lib64 as real directories holding the same files that already live under /usr/*. rpm then sees each binary twice (e.g. fs/bin/bash and fs/usr/bin/bash) and aborts the install of xCAT-genesis-base with dozens of file conflicts, so the package cannot be installed. After unpacking the dracut image, fold those top-level directories into /usr and replace them with relative symlinks, matching a normal usr-merged layout. The loop is a no-op when the image already ships them as symlinks, so EL builds are unaffected. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -131,6 +131,19 @@ dracut --compress gzip -m "xcat base" --no-early-microcode -N -f "$DRACUT_IMAGE"
|
||||
zcat "$DRACUT_IMAGE" | cpio -dumi
|
||||
)
|
||||
|
||||
# usrmerge collapse: on a usr-merged build host the extracted genesis fs can
|
||||
# contain /bin,/sbin,/lib,/lib64 as real directories that duplicate the files
|
||||
# already under /usr/*, which makes rpm reject the package with file conflicts.
|
||||
# Fold the top-level dirs into /usr and replace them with symlinks (a no-op on
|
||||
# hosts where the image already ships them as symlinks).
|
||||
for _d in bin sbin lib lib64; do
|
||||
if [ -d "$GENESIS_FS/$_d" ] && [ ! -L "$GENESIS_FS/$_d" ] && [ -d "$GENESIS_FS/usr/$_d" ]; then
|
||||
cp -a "$GENESIS_FS/$_d/." "$GENESIS_FS/usr/$_d/" 2>/dev/null || true
|
||||
rm -rf "$GENESIS_FS/$_d"
|
||||
ln -s "usr/$_d" "$GENESIS_FS/$_d"
|
||||
fi
|
||||
done
|
||||
|
||||
# xCAT 2.14.5 genesis payloads shipped usr/lib/dracut/hooks as a real directory.
|
||||
# Newer dracut (EL8+) makes it a symlink to ../../../var/lib/dracut/hooks. RPM
|
||||
# cannot replace a directory with a symlink across an upgrade, so a 2.17 -> 2.18
|
||||
|
||||
Reference in New Issue
Block a user