mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-04-10 19:15:12 +00:00
LIBMAN: added symlinked libaries support
This commit is contained in:
parent
8bf12280ff
commit
c5e0938d0a
|
@ -44,15 +44,10 @@ is_excluded() {
|
||||||
copied_files=()
|
copied_files=()
|
||||||
failed_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
|
# Define destination file path
|
||||||
dest_file="$target_dir/$(basename "$file")"
|
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
|
# Skip if the file is in the list of excluded libraries
|
||||||
if is_excluded "$(basename "$file")"; then
|
if is_excluded "$(basename "$file")"; then
|
||||||
|
@ -61,6 +56,13 @@ for file in $(find "$1" -type f -name "*.so*"); do
|
||||||
failed_files+=("$file, $reason")
|
failed_files+=("$file, $reason")
|
||||||
continue
|
continue
|
||||||
fi
|
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
|
# Attempt to copy the file
|
||||||
if install -D "$file" "$dest_file" 2>error_log; then
|
if install -D "$file" "$dest_file" 2>error_log; then
|
||||||
echo "Copied $file to $dest_file"
|
echo "Copied $file to $dest_file"
|
||||||
|
@ -72,6 +74,40 @@ for file in $(find "$1" -type f -name "*.so*"); do
|
||||||
fi
|
fi
|
||||||
done
|
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)
|
||||||
|
echo "Warning: Failed to copy symlink target $symlink_target. Skipping. Error: $error_message"
|
||||||
|
failed_files+=("$symlink_target, $error_message")
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create the symlink in the target directory
|
||||||
|
if ln -s "$dest_symlink_target" "$dest_file" 2>error_log; then
|
||||||
|
echo "Created symlink $dest_file -> $dest_symlink_target"
|
||||||
|
copied_files+=("$file")
|
||||||
|
else
|
||||||
|
error_message=$(<error_log)
|
||||||
|
echo "Warning: Failed to create symlink $dest_file. Skipping. Error: $error_message"
|
||||||
|
failed_files+=("$file, $error_message")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Output the lists of copied and failed files
|
# Output the lists of copied and failed files
|
||||||
if [ ${#copied_files[@]} -ne 0 ]; then
|
if [ ${#copied_files[@]} -ne 0 ]; then
|
||||||
echo "Imported libraries:"
|
echo "Imported libraries:"
|
||||||
|
|
Loading…
Reference in a new issue