Skip to content

Commit

Permalink
Refactor windows to make use of file
Browse files Browse the repository at this point in the history
  • Loading branch information
diemogebhardt committed Nov 26, 2024
1 parent 4e327e4 commit 4730555
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bin/verify-binary-architecture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ TARGET_TRIPLE="$1"
BINARY_PATH="$2"

# Extract target architecture and OS
TARGET_ARCHITECTURE=$(echo "${TARGET_TRIPLE}" | grep -o 'x86_64\|aarch64' || echo "unknown")
TARGET_OS=$(echo "${TARGET_TRIPLE}" | grep -o 'darwin\|linux\|windows' || echo "unknown")
TARGET_ARCHITECTURE=$(echo "${TARGET_TRIPLE}" | grep -o 'x86_64\|aarch64' || echo "unknown")

# Validate inputs
if [ "$TARGET_ARCHITECTURE" = "unknown" ]; then
echo "Unknown target architecture in '${TARGET_TRIPLE}'"
exit 1
fi
if [ "$TARGET_OS" = "unknown" ]; then
echo "Unknown target OS in '${TARGET_TRIPLE}'"
exit 1
fi
if [ "$TARGET_ARCHITECTURE" = "unknown" ]; then
echo "Unknown target architecture in '${TARGET_TRIPLE}'"
exit 1
fi

# Get expected binary architecture based on target architecture and OS
get_expected_binary_architecture() {
local target_architecture="$1"
local target_os="$2"
local target_os="$1"
local target_architecture="$2"

case "${target_os}" in
"darwin")
Expand All @@ -49,7 +49,7 @@ get_expected_binary_architecture() {
;;
esac
}
EXPECTED_BINARY_ARCHITECTURE=$(get_expected_binary_architecture "$TARGET_ARCHITECTURE" "$TARGET_OS")
EXPECTED_BINARY_ARCHITECTURE=$(get_expected_binary_architecture "$TARGET_OS" "$TARGET_ARCHITECTURE")

# Parse binary architecture
file_output=$(file -b "${BINARY_PATH}")
Expand Down

0 comments on commit 4730555

Please sign in to comment.