arch: Remove calls to arch command

The `arch(1)` command is not available on some systems so use the
`uname(1)` command for the equivalent functionality.

Fixes #150.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2019-02-05 10:55:55 +00:00
parent 56f1044e12
commit f38c67da0c
4 changed files with 6 additions and 8 deletions

View File

@ -51,7 +51,7 @@ MAX_IMG_SIZE_MB=2048
FS_TYPE=${FS_TYPE:-"ext4"} FS_TYPE=${FS_TYPE:-"ext4"}
# In order to support memory hotplug, image must be aligned to memory section(size in MB) according to different architecture. # In order to support memory hotplug, image must be aligned to memory section(size in MB) according to different architecture.
ARCH=$(arch) ARCH=$(uname -m)
case "$ARCH" in case "$ARCH" in
aarch64) MEM_BOUNDARY_MB=1024 ;; aarch64) MEM_BOUNDARY_MB=1024 ;;
*) MEM_BOUNDARY_MB=128 ;; *) MEM_BOUNDARY_MB=128 ;;

View File

@ -5,6 +5,4 @@
From golang:@GO_VERSION@-alpine3.7 From golang:@GO_VERSION@-alpine3.7
# The "coreutils" package on alpine for reasons unknown does not provide arch(1), so simulate it. RUN apk update && apk add git make bash gcc musl-dev linux-headers apk-tools-static libseccomp libseccomp-dev
RUN apk update && apk add git make bash gcc musl-dev linux-headers apk-tools-static libseccomp libseccomp-dev && \
echo -e '#!/bin/sh\nuname -m' > /usr/bin/arch && chmod +x /usr/bin/arch

View File

@ -22,7 +22,7 @@ lib_file="${script_dir}/../scripts/lib.sh"
source "$lib_file" source "$lib_file"
# Default architecture # Default architecture
ARCH=$(arch) ARCH=$(uname -m)
# Load default versions for golang and other componets # Load default versions for golang and other componets
source "${script_dir}/versions.txt" source "${script_dir}/versions.txt"
@ -162,7 +162,7 @@ generate_dockerfile()
{ {
dir="$1" dir="$1"
case "$(arch)" in case "$(uname -m)" in
"ppc64le") "ppc64le")
goarch=ppc64le goarch=ppc64le
;; ;;

View File

@ -16,12 +16,12 @@ PACKAGES="systemd iptables init"
DEBOOTSTRAP=${PACKAGE_MANAGER:-"debootstrap"} DEBOOTSTRAP=${PACKAGE_MANAGER:-"debootstrap"}
case $(arch) in case $(uname -m) in
x86_64) ARCHITECTURE="amd64";; x86_64) ARCHITECTURE="amd64";;
ppc64le) ARCHITECTURE="ppc64el";; ppc64le) ARCHITECTURE="ppc64el";;
aarch64) ARCHITECTURE="arm64";; aarch64) ARCHITECTURE="arm64";;
s390x) ARCHITECTURE="s390x";; s390x) ARCHITECTURE="s390x";;
(*) die "$(arch) not supported " (*) die "$(uname -m) not supported "
esac esac
# Init process must be one of {systemd,kata-agent} # Init process must be one of {systemd,kata-agent}