Skip to content

Commit

Permalink
Add support for Mac on Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
sibprogrammer committed Dec 4, 2022
1 parent 90ae2a6 commit 11dbe09
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
12 changes: 10 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ builds:
- darwin
goarch:
- amd64
- arm64
goamd64:
- ''
ignore:
- goos: linux
goarch: arm64
- goos: windows
goarch: arm64
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
archives:
- name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}"
- name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
replacements:
darwin: mac
linux: linux
windows: win
amd64: x86_64
format: tgz
format: tar.gz
format_overrides:
- goos: windows
format: zip
Expand Down
19 changes: 13 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@
PREFIX=/usr/local/bin/

BIN_URLS=$(curl -fsSL https://api.github.com/repos/plesk/pleskapp/releases/latest | grep browser_download_url | cut -d '"' -f 4)
LINUX_ARCHIVE=$(echo "$BIN_URLS" | grep linux.tgz)
MAC_ARCHIVE=$(echo "$BIN_URLS" | grep mac.tgz)
OS_NAME=$(uname -s)
OS_ARCH=$(uname -m)

if [ "Linux" = "$OS_NAME" -o "Darwin" = "$OS_NAME" ]; then
if [ "Linux" = "$OS_NAME" ]; then
if [ $EUID -ne 0 ]; then
echo "This script must be run as root user"
exit 1
fi
curl -fsSL "$LINUX_ARCHIVE" --output plesk-latest.tgz
LINUX_ARCHIVE=$(echo "$BIN_URLS" | grep linux-x86_64.tar.gz)
curl -fsSL "$LINUX_ARCHIVE" --output plesk-latest.tar.gz
fi

[ "Darwin" = "$OS_NAME" ] && curl -fsSL "$MAC_ARCHIVE" --output plesk-latest.tgz
if [ "Darwin" = "$OS_NAME" ]; then
if [ "arm64" = "$OS_ARCH" ]; then
MAC_ARCHIVE=$(echo "$BIN_URLS" | grep mac-arm64.tar.gz)
else
MAC_ARCHIVE=$(echo "$BIN_URLS" | grep mac-x86_64.tar.gz)
fi
curl -fsSL "$MAC_ARCHIVE" --output plesk-latest.tar.gz
fi

tar xzf plesk-latest.tgz --directory=$PREFIX
rm plesk-latest.tgz
tar xzf plesk-latest.tar.gz --directory=$PREFIX
rm plesk-latest.tar.gz
[ -f $PREFIX/plesk ] && echo "The utility 'plesk' has been successfully installed to $PREFIX"
else
echo "Unsupported OS."
Expand Down

0 comments on commit 11dbe09

Please sign in to comment.