Blame SOURCES/rear-bz2119501.patch

2f081d
diff --git a/usr/share/rear/build/default/490_fix_broken_links.sh b/usr/share/rear/build/default/490_fix_broken_links.sh
2f081d
index 5bace664..cf960be8 100644
2f081d
--- a/usr/share/rear/build/default/490_fix_broken_links.sh
2f081d
+++ b/usr/share/rear/build/default/490_fix_broken_links.sh
2f081d
@@ -7,6 +7,23 @@
2f081d
 # see https://github.com/rear/rear/issues/1638
2f081d
 # and https://github.com/rear/rear/pull/1734
2f081d
 
2f081d
+# Some broken symlinks are expected. The 'build' and 'source' symlinks in kernel modules point to kernel sources
2f081d
+# and are broken untol one installs the kernel-debug-devel or kernel-devel packages (on Fedora) and even then
2f081d
+# the targets are jot included in the rescue system by default.
2f081d
+# Do not warn about those, it is just noise.
2f081d
+local irrelevant_symlinks=( '*/lib/modules/*/build' '*/lib/modules/*/source' )
2f081d
+function symlink_is_irrelevant () {
2f081d
+    for i in "${irrelevant_symlinks[@]}"; do
2f081d
+        # do not quote $i, it is a glob pattern, matching will be performed by [[ ... == ... ]]
2f081d
+        # quoting inside [[ ]] prevents pattern matching
2f081d
+        if [[ "$1" == $i ]]; then
2f081d
+            return 0
2f081d
+        fi
2f081d
+    done
2f081d
+    return 1
2f081d
+}
2f081d
+
2f081d
+
2f081d
 # FIXME: The following code fails if symlinks or their targets contain characters from IFS (e.g. blanks),
2f081d
 # cf. the same kind of comments in build/default/990_verify_rootfs.sh
2f081d
 # and layout/prepare/GNU/Linux/130_include_mount_subvolumes_code.sh
2f081d
@@ -38,6 +55,10 @@ pushd $ROOTFS_DIR
2f081d
     local broken_symlink=''
2f081d
     local link_target=''
2f081d
     for broken_symlink in $broken_symlinks ; do
2f081d
+        if symlink_is_irrelevant "$broken_symlink" ; then
2f081d
+            DebugPrint "Ignoring irrelevant broken symlink $broken_symlink"
2f081d
+            continue
2f081d
+        fi
2f081d
         # For each broken symlink absolute path inside ROOTFS_DIR
2f081d
         # we call "readlink -e" in the original system to get its link target there.
2f081d
         # If in the original system there was a chain of symbolic links like