diff options
author | Mattias Andrée <maandree@kth.se> | 2023-12-03 19:23:35 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-12-03 19:23:35 +0100 |
commit | c131f122778c62f920a99bbf854ced4a37ee8b03 (patch) | |
tree | 14c933f98f4d64dffb0a594bc40dd5121c6c5a8e /linux/what-architecture-am-i-using | |
download | libsyscalls-c131f122778c62f920a99bbf854ced4a37ee8b03.tar.gz libsyscalls-c131f122778c62f920a99bbf854ced4a37ee8b03.tar.bz2 libsyscalls-c131f122778c62f920a99bbf854ced4a37ee8b03.tar.xz |
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'linux/what-architecture-am-i-using')
-rwxr-xr-x | linux/what-architecture-am-i-using | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/linux/what-architecture-am-i-using b/linux/what-architecture-am-i-using new file mode 100755 index 0000000..1c7a9ba --- /dev/null +++ b/linux/what-architecture-am-i-using @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +# TODO complete this list + +if uname -s | grep -i linux > /dev/null; then + arch="$(uname -m)" + if test "$arch" = x86_64; then + printf '%s\n' AMD64 + if test $# = 0 || "$@"; then + if test $# = 0 || gunzip < /proc/config.gz | grep '^CONFIG_X86_X32_ABI=y$' > /dev/null; then + printf '%s\n' AMD64_X32 + fi + if test $# = 0 || gunzip < /proc/config.gz | grep '^CONFIG_X86=y$' > /dev/null; then + printf '%s\n' I386 + fi + fi + elif test "$arch" = i686 || test "$arch" = i386; then + printf '%s\n' I386 + else + exit 1 + fi +else + exit 2 +fi |