Skip to content

Commit f19a8ef

Browse files
committed
123
1 parent 7fdd036 commit f19a8ef

1 file changed

Lines changed: 21 additions & 23 deletions

File tree

.github/workflows/build.yml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,32 +49,30 @@ jobs:
4949
# 提前收集所有 .so 文件路径(一次性)
5050
mapfile -t all_libs < <(find /lib /usr/lib /usr/local/lib -type f -name "lib*.so*" 2>/dev/null)
5151
52-
while true; do
53-
tmp_output=$(mktemp)
54-
LD_DEBUG=libs "$QEMU_BIN" --version > /dev/null 2> "$tmp_output"
55-
status=$?
56-
rm -f "$tmp_output"
52+
tmp_output=$(mktemp)
53+
LD_DEBUG=libs "$QEMU_BIN" --version > /dev/null 2> "$tmp_output"
54+
status=$?
55+
rm -f "$tmp_output"
5756
58-
[ "$status" -eq 0 ] && echo "✅ QEMU 可成功运行。" && exit 0
57+
[ "$status" -eq 0 ] && echo "✅ QEMU 可成功运行。" && exit 0
5958
60-
# 提取缺失库
61-
missing_libs=$(grep -oE "lib[^ ]+\.so[^ ]*" "$tmp_output" | sort -u)
62-
[ -z "$missing_libs" ] && echo "❌ 无法解析缺失库,退出。" && exit 1
59+
# 提取缺失库
60+
missing_libs=$(grep -oE "lib[^ ]+\.so[^ ]*" "$tmp_output" | sort -u)
61+
[ -z "$missing_libs" ] && echo "❌ 无法解析缺失库,退出。" && exit 1
6362
64-
for lib in $missing_libs; do
65-
lib_prefix=$(echo "$lib" | sed 's/[0-9.]*$//') # 例如 libbrlapi.so.0.7 -> libbrlapi.so
66-
found=""
67-
for candidate in "${all_libs[@]}"; do
68-
[[ $(basename "$candidate") == $lib_prefix* ]] && found="$candidate" && break
69-
done
70-
71-
if [ -n "$found" ]; then
72-
link_path="$(dirname "$found")/$lib"
73-
[ -f "$link_path" ] || ln -s "$(basename "$found")" "$link_path" && echo "Linked: $lib"
74-
else
75-
echo "MISSING: $lib -> not found in system."
76-
exit 1
77-
fi
63+
for lib in $missing_libs; do
64+
lib_prefix=$(echo "$lib" | sed 's/[0-9.]*$//') # 例如 libbrlapi.so.0.7 -> libbrlapi.so
65+
found=""
66+
for candidate in "${all_libs[@]}"; do
67+
[[ $(basename "$candidate") == $lib_prefix* ]] && found="$candidate" && break
7868
done
69+
70+
if [ -n "$found" ]; then
71+
link_path="$(dirname "$found")/$lib"
72+
[ -f "$link_path" ] || ln -s "$(basename "$found")" "$link_path" && echo "Linked: $lib"
73+
else
74+
echo "MISSING: $lib -> not found in system."
75+
exit 1
76+
fi
7977
done
8078

0 commit comments

Comments
 (0)