1
0
mirror of https://github.com/alexellis/arkade.git synced 2022-05-07 18:22:49 +03:00

Add Apple M1 binary

This commit takes the changes from #600 and makes them
work. Thanks @TomTucka

Tested with "make dist"

Closes: #600

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2022-01-15 18:16:38 +00:00
parent d3892378be
commit c6588f3311
2 changed files with 23 additions and 11 deletions

View File

@@ -25,6 +25,7 @@ dist:
mkdir -p bin
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/arkade
CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/arkade-darwin
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/arkade-darwin-arm64
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/arkade-armhf
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/arkade-arm64
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/arkade.exe

33
get.sh
View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Copyright OpenFaaS Author(s) 2019
# Copyright OpenFaaS Author(s) 2022
#########################
# Repo specific content #
#########################
@@ -52,12 +52,12 @@ checkHash(){
targetFileDir=${targetFile%/*}
(cd "$targetFileDir" && curl -sSL $url.sha256|$sha_cmd -c >/dev/null)
if [ "$?" != "0" ]; then
rm "$targetFile"
echo "Binary checksum didn't match. Exiting"
exit 1
fi
fi
fi
}
@@ -68,8 +68,19 @@ getPackage() {
suffix=""
case $uname in
"Darwin")
suffix="-darwin"
arch=$(uname -m)
case $arch in
"x86_64")
suffix="-darwin"
;;
esac
case $arch in
"arm64")
suffix="-darwin-arm64"
;;
esac
;;
"MINGW"*)
suffix=".exe"
BINLOCATION="$HOME/bin"
@@ -93,7 +104,7 @@ getPackage() {
esac
targetFile="/tmp/$REPO$suffix"
if [ "$userid" != "0" ]; then
targetFile="$(pwd)/$REPO$suffix"
fi
@@ -116,7 +127,7 @@ getPackage() {
chmod +x "$targetFile"
echo "Download complete."
if [ ! -w "$BINLOCATION" ]; then
echo
@@ -127,11 +138,11 @@ getPackage() {
echo "============================================================"
echo
echo " sudo cp $REPO$suffix $BINLOCATION/$REPO"
if [ -n "$ALIAS_NAME" ]; then
echo " sudo ln -sf $BINLOCATION/$REPO $BINLOCATION/$ALIAS_NAME"
fi
echo
else
@@ -145,7 +156,7 @@ getPackage() {
echo "================================================================"
echo " $BINLOCATION/$REPO already exists and is not writeable"
echo " by the current user. Please adjust the binary ownership"
echo " or run sh/bash with sudo."
echo " or run sh/bash with sudo."
echo "================================================================"
echo
exit 1
@@ -153,7 +164,7 @@ getPackage() {
fi
mv "$targetFile" $BINLOCATION/$REPO
if [ "$?" = "0" ]; then
echo "New version of $REPO installed to $BINLOCATION"
fi
@@ -179,4 +190,4 @@ getPackage() {
}
hasCli
getPackage
getPackage