Michal Suchanek 4cdfb2
#!/bin/bash
Michal Marek 411abb
Michal Marek 411abb
#############################################################################
Michal Marek 411abb
# Copyright (c) 2003-2005,2009 Novell, Inc.
174a64
# Copyright (c) 2010-2022 SUSE LLC
Michal Marek 411abb
#
Michal Marek 411abb
# This program is free software; you can redistribute it and/or
Michal Marek 411abb
# modify it under the terms of version 2 of the GNU General Public License as
Michal Marek 411abb
# published by the Free Software Foundation.
Michal Marek 411abb
#
Michal Marek 411abb
# This program is distributed in the hope that it will be useful,
Michal Marek 411abb
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Michal Marek 411abb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
Michal Marek 411abb
# GNU General Public License for more details.
Michal Marek 411abb
#
Michal Marek 411abb
# You should have received a copy of the GNU General Public License
174a64
# along with this program; if not, contact https://www.suse.com/source-code/
Michal Marek 411abb
#
Michal Marek 411abb
#############################################################################
Michal Marek 411abb
174a64
Michal Marek 411abb
# With --list, list all known architectures, otherwise print the generic
Michal Marek 411abb
# name for this architecture (or the one specified on command line).
Michal Marek 411abb
Michal Marek 411abb
if [ "$1" = "--list" ]; then
Michal Marek 411abb
    # List all known architectures
Andreas Schwab c2885e
    echo i386 mips{,64} sparc{,64} ppc{,64,64le} s390{,x} ia64 x86_64 alpha parisc armv6hl armv7hl arm64 riscv64
Michal Marek 411abb
    exit 0
Michal Marek 411abb
fi
Michal Marek 411abb
Michal Marek 411abb
if [ -n "$1" ]; then
Michal Marek 411abb
    ARCH="$1"
Michal Marek 411abb
else
Michal Suchanek f0d0e9
    ARCH="$(arch)"
Michal Marek 411abb
fi
Michal Marek 411abb
case "$ARCH" in
Michal Marek 411abb
    # from rpm --eval '%ix86'
Michal Marek 411abb
    i?86 | pentium3 | pentium4 | athlon | geode)
Michal Marek 411abb
        echo i386
Michal Marek 411abb
        ;;
Alexander Graf 09220e
    aarch64)
Alexander Graf 09220e
        echo arm64
Alexander Graf 09220e
        ;;
Michal Marek 411abb
    *)
Michal Marek 411abb
        echo "$ARCH"
Michal Marek 411abb
        ;;
Michal Marek 411abb
esac