3 if [ "$#" -ne 2 ]; then
4 echo "Usage: $0 <binary_path> <chroot_destination>"
11 if [ ! -f "$BINARY_PATH" ]; then
12 echo "Error: Binary '$BINARY_PATH' does not exist."
16 if [ ! -d "$CHROOT_PATH" ]; then
17 echo "Error: Destination path '$CHROOT_PATH' does not exist."
21 DEPS=$(ldd "$BINARY_PATH" | grep '^[[:space:]]' | grep -o '/[^ ]*')
24 if [ -f "$DEP" ]; then
25 DEP_DIR=$(dirname "$DEP")
26 mkdir -p "$CHROOT_PATH$DEP_DIR"
27 cp -f "$DEP" "$CHROOT_PATH$DEP"
29 echo "Warning: Dependency '$DEP' not found, skipping."
33 echo "Binary and dependencies copied to '$CHROOT_PATH'."