diff options
-rw-r--r-- | src/opkbuild.sh | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/opkbuild.sh b/src/opkbuild.sh index 9397fb3..caa342d 100644 --- a/src/opkbuild.sh +++ b/src/opkbuild.sh @@ -121,6 +121,20 @@ if [ "$(cat format)" != '1.0' ]; then exit 1 fi +# If a host architecture is not specified ... +if [ -z "${arch}" ]; then + # Attempt to detect the host architecture tuple. + arch=$(opkg print-architecture | sed -n \ + 's/^arch \([^ -][^ -]*-[^ -][^ -]*-[^ -][^ -]*\) [0-9][0-9]*$/\1/p') + if [ -z "${arch}" ]; then + printf 'opkbuild: Error: No installable architecture found\n' >&2 + exit 1 + elif [ $(echo "${arch}" | wc -l) -gt 1 ]; then + printf 'opkbuild: Error: Multiple installable architectures found\n' >&2 + exit 1 + fi +fi + # Attempt to detect the host platform. # If there no config files to copy, build platform-independent packages. if [ ! -f config ]; then @@ -145,20 +159,6 @@ elif [ -z "${platform}" ]; then # ... and there are config files and one installable platform, build for it. fi -# If a host architecture is not specified ... -if [ -z "${arch}" ]; then - # Attempt to detect the host architecture tuple. - arch=$(opkg print-architecture | sed -n \ - 's/^arch \([^ -][^ -]*-[^ -][^ -]*-[^ -][^ -]*\) [0-9][0-9]*$/\1/p') - if [ -z "${arch}" ]; then - printf 'opkbuild: Error: No installable architecture found\n' >&2 - exit 1 - elif [ $(echo "${arch}" | wc -l) -gt 1 ]; then - printf 'opkbuild: Error: Multiple installable architectures found\n' >&2 - exit 1 - fi -fi - # Resolve status override file path. pkg_dir="${PWD}" cd "$(dirname "${status_override}")" |