diff --git a/automation_tools/libman.sh b/automation_tools/libman.sh index 342154a3..ed395fee 100644 --- a/automation_tools/libman.sh +++ b/automation_tools/libman.sh @@ -44,15 +44,10 @@ is_excluded() { copied_files=() failed_files=() -for file in $(find "$1" -type f -name "*.so*"); do +# First, copy all regular files +for file in $(find "$1" -type f -name "*.so*" ! -type l); do # Define destination file path dest_file="$target_dir/$(basename "$file")" - - # Skip if the destination file already exists - if [ -e "$dest_file" ]; then - echo "Skipped $file as $dest_file already exists" - continue - fi # Skip if the file is in the list of excluded libraries if is_excluded "$(basename "$file")"; then @@ -61,6 +56,13 @@ for file in $(find "$1" -type f -name "*.so*"); do failed_files+=("$file, $reason") continue fi + + # Skip if the destination file already exists + if [ -e "$dest_file" ]; then + echo "Skipped $file as $dest_file already exists" + continue + fi + # Attempt to copy the file if install -D "$file" "$dest_file" 2>error_log; then echo "Copied $file to $dest_file" @@ -72,6 +74,40 @@ for file in $(find "$1" -type f -name "*.so*"); do fi done +# Then, copy all symlinks +for file in $(find "$1" -type l -name "*.so*"); do + # Define destination file path + dest_file="$target_dir/$(basename "$file")" + + # Get the target of the symlink + symlink_target=$(readlink "$file") + # Define the destination for the symlink target + dest_symlink_target="$target_dir/$(basename "$symlink_target")" + + # Copy the symlink target if it doesn't already exist + if [ ! -e "$dest_symlink_target" ]; then + if install -D "$symlink_target" "$dest_symlink_target" 2>error_log; then + echo "Copied symlink target $symlink_target to $dest_symlink_target" + copied_files+=("$symlink_target") + else + error_message=$(error_log; then + echo "Created symlink $dest_file -> $dest_symlink_target" + copied_files+=("$file") + else + error_message=$(