mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-08 17:42:56 +01:00
24 lines
664 B
Bash
Executable file
24 lines
664 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -eo pipefail
|
|
|
|
# convert architecture of a system into
|
|
# - use `arch` to show current system architecture
|
|
# - do not use `uname -m` as this shows kernel architecture
|
|
# - the `arch != uname -m` will be different when doing cross-compilation using `qemu-user`
|
|
# x86_64 -> x86-64
|
|
# aarch64 -> aarch64
|
|
ARCH=$(arch | tr '_' '-')
|
|
|
|
# find all executables in $PATH
|
|
CMDs=$(compgen -c)
|
|
CMD_PATHs=$(which $CMDs || true) # some CMDs might be missing
|
|
|
|
if files=$(file $CMD_PATHs | grep "ELF " | grep -v "$ARCH")
|
|
then
|
|
echo "Found files of different architecture than $(ARCH):"
|
|
echo "$files"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Validated $(echo $CMD_PATHs | wc -w) binaries."
|