mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-11-04 03:29:55 +00:00 
			
		
		
		
	packaging/shim-v2: Install the target depending on the arch/libc
In the `install_go_rust.sh` file we're adding a x86_64-unknown-linux-musl target unconditionally. That should be, instead, based in the ARCH of the host and the appropriate LIBC to be used with that host. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
		@@ -50,12 +50,37 @@ EOF
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
trap finish EXIT
 | 
					trap finish EXIT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					go_version=${1:-}
 | 
				
			||||||
rust_version=${2:-}
 | 
					rust_version=${2:-}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ARCH=${ARCH:-$(uname -m)}
 | 
					ARCH=${ARCH:-$(uname -m)}
 | 
				
			||||||
LIBC=${LIBC:-musl}
 | 
					case "${ARCH}" in
 | 
				
			||||||
 | 
						aarch64)
 | 
				
			||||||
 | 
							goarch=arm64
 | 
				
			||||||
 | 
							LIBC=musl
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						ppc64le) 
 | 
				
			||||||
 | 
							goarch=${ARCH}
 | 
				
			||||||
 | 
							ARCH=powerpc64le
 | 
				
			||||||
 | 
							LIBC=gnu
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						s390x)
 | 
				
			||||||
 | 
							goarch=${ARCH}
 | 
				
			||||||
 | 
							LIBC=gnu
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						x86_64)
 | 
				
			||||||
 | 
							goarch=amd64
 | 
				
			||||||
 | 
							LIBC=musl
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						*)
 | 
				
			||||||
 | 
							echo "unsupported architecture $(uname -m)"
 | 
				
			||||||
 | 
							exit 1
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | sh -s -- -y --default-toolchain ${rust_version} -t ${ARCH}-unknown-linux-${LIBC}
 | 
					curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | sh -s -- -y --default-toolchain ${rust_version} -t ${ARCH}-unknown-linux-${LIBC}
 | 
				
			||||||
source /root/.cargo/env
 | 
					source /root/.cargo/env
 | 
				
			||||||
rustup target add x86_64-unknown-linux-musl
 | 
					rustup target add ${ARCH}-unknown-linux-${LIBC}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pushd "${tmp_dir}"
 | 
					pushd "${tmp_dir}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -70,9 +95,6 @@ done
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
shift $(( $OPTIND - 1 ))
 | 
					shift $(( $OPTIND - 1 ))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
go_version=${1:-}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [ -z "$go_version" ];then
 | 
					if [ -z "$go_version" ];then
 | 
				
			||||||
	echo "Missing go"
 | 
						echo "Missing go"
 | 
				
			||||||
	usage 1
 | 
						usage 1
 | 
				
			||||||
@@ -90,14 +112,6 @@ if command -v go; then
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$(uname -m)" in
 | 
					 | 
				
			||||||
	aarch64) goarch="arm64";;
 | 
					 | 
				
			||||||
	ppc64le) goarch="ppc64le";;
 | 
					 | 
				
			||||||
	x86_64) goarch="amd64";;
 | 
					 | 
				
			||||||
	s390x) goarch="s390x";;
 | 
					 | 
				
			||||||
	*) echo "unsupported architecture: $(uname -m)"; exit 1;;
 | 
					 | 
				
			||||||
esac
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
info "Download go version ${go_version}"
 | 
					info "Download go version ${go_version}"
 | 
				
			||||||
kernel_name=$(uname -s)
 | 
					kernel_name=$(uname -s)
 | 
				
			||||||
curl -OL "https://storage.googleapis.com/golang/go${go_version}.${kernel_name,,}-${goarch}.tar.gz"
 | 
					curl -OL "https://storage.googleapis.com/golang/go${go_version}.${kernel_name,,}-${goarch}.tar.gz"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user