This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Script: collect_so_files.sh
BINARY="AppImage/usr/bin/r"
LIB_DIR="AppImage/usr/lib"
mkdir -p "$LIB_DIR"
# Function to copy a library and its dependencies
copy_with_deps() {
local lib="$1"
if [ -f "$lib" ] && [ ! -f "$LIB_DIR/$(basename "$lib")" ]; then
cp "$lib" "$LIB_DIR/"
echo "Copied: $lib"
# Recursively check dependencies of this library
ldd "$lib" | grep -o '/[^ ]\+' | while read -r dep; do
if [ -f "$dep" ]; then
copy_with_deps "$dep"
fi
done
fi
}
# Start with the binarys dependencies
ldd "$BINARY" | grep -o '/[^ ]\+' | while read -r lib; do
copy_with_deps "$lib"
done