diff --git a/.goreleaser.yml b/.goreleaser.yml index 04538f9..d70ac62 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -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 diff --git a/install.sh b/install.sh index 93b4976..202f4d6 100755 --- a/install.sh +++ b/install.sh @@ -4,9 +4,8 @@ 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 @@ -14,13 +13,21 @@ if [ "Linux" = "$OS_NAME" -o "Darwin" = "$OS_NAME" ]; 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."