forked from LiuYunPlayer/TuneLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed CI executable find scripts for multi platforms
- Loading branch information
1 parent
e106b8f
commit afb8e72
Showing
3 changed files
with
71 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Check if a directory is provided as an argument | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <directory>" | ||
exit 1 | ||
fi | ||
|
||
# Directory to search | ||
directory=$1 | ||
|
||
# Find ELF files in the specified directory | ||
files=$(find "$directory" -type f -exec sh -c 'file -b "$1" | grep -q "ELF" && echo "$1"' _ {} \;) | ||
|
||
# Initialize an empty string for the output | ||
output="" | ||
|
||
# Loop through each file and format it | ||
for file in $files; do | ||
if [ -z "$output" ]; then | ||
output="\"$file\"" | ||
else | ||
output="$output,\"$file\"" | ||
fi | ||
done | ||
|
||
# Print the formatted output | ||
echo $output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,18 @@ | ||
#!/bin/bash | ||
|
||
# Check if a directory is provided as an argument | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <directory>" | ||
exit 1 | ||
fi | ||
# Detect the operating system | ||
os_type=$(uname) | ||
|
||
# Directory to search | ||
directory=$1 | ||
|
||
# Find ELF, Mach-O and Universal Binary files in the specified directory | ||
files=$(find "$directory" -type f -exec sh -c 'file -b "$1" | grep -q "ELF|Mach-O|universal binary" && echo "$1"' _ {} \;) | ||
|
||
# Initialize an empty string for the output | ||
output="" | ||
|
||
# Loop through each file and format it | ||
for file in $files; do | ||
if [ -z "$output" ]; then | ||
output="\"$file\"" | ||
else | ||
output="$output,\"$file\"" | ||
fi | ||
done | ||
|
||
# Print the formatted output | ||
echo $output | ||
# Execute the corresponding script based on the operating system | ||
case "$os_type" in | ||
Linux) | ||
echo $(./find-elf.sh "$1") | ||
;; | ||
Darwin) | ||
echo $(./find-macho.sh "$1") | ||
;; | ||
*) | ||
echo "Unsupported OS: $os_type" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Check if a directory is provided as an argument | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <directory>" | ||
exit 1 | ||
fi | ||
|
||
# Directory to search | ||
directory=$1 | ||
|
||
# Find Mach-O and Universal Binary files in the specified directory | ||
files=$(find "$directory" -type f -exec sh -c 'file -b "$1" | grep -q "Mach-O|universal binary" && echo "$1"' _ {} \;) | ||
|
||
# Initialize an empty string for the output | ||
output="" | ||
|
||
# Loop through each file and format it | ||
for file in $files; do | ||
if [ -z "$output" ]; then | ||
output="\"$file\"" | ||
else | ||
output="$output,\"$file\"" | ||
fi | ||
done | ||
|
||
# Print the formatted output | ||
echo $output |