File tree Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
-
3
- set -euo pipefail
2
+ #
4
3
# allow specifying different destination directory
5
4
DIR=" ${DIR:- " $HOME /.local/bin" } "
6
5
7
- RELEASE=" ${1:- " latest" } "
6
+ # map different architecture variations to the available binaries
7
+ ARCH=$( uname | tr [:upper:] [:lower:])
8
8
9
9
# prepare the download URL
10
- TAG=$( curl -L -s -H ' Accept: application/json' https://github.com/denetpro/node/releases/$RELEASE | sed -e ' s/.*"tag_name":"\([^"]*\)".*/\1/' )
11
-
12
- ARCH=$( uname -m)
13
- case " $ARCH " in
14
- x86_64) ARCH=" amd64" ;;
15
- aarch64|arm64) ARCH=" arm64" ;;
16
- * ) error " Unsupported architecture: $ARCH " ;;
17
- esac
18
-
19
-
20
- GITHUB_FILE=$( echo " denode-$( uname -s) -$ARCH " | tr ' [:upper:]' ' [:lower:]' )
21
- GITHUB_URL=" https://github.com/denetpro/node/releases/download/${TAG} /${GITHUB_FILE} "
10
+ GITHUB_LATEST_VERSION=$( curl -L -s -H ' Accept: application/json' https://github.com/denetpro/node/releases/latest | sed -e ' s/.*"tag_name":"\([^"]*\)".*/\1/' )
11
+ GITHUB_FILE=" denode-$ARCH .zip"
12
+ GITHUB_URL=" https://github.com/denetpro/node/releases/download/${GITHUB_LATEST_VERSION} /${GITHUB_FILE} "
22
13
23
14
# install/update the local binary
24
- curl -L -o denode $GITHUB_URL
15
+ curl -L -o denode.zip $GITHUB_URL
16
+ unzip -a denode.zip && rm -rf denode.zip
17
+ mkdir -p $DIR
25
18
install -m 555 denode -t " $DIR "
26
- rm -f denode
27
19
echo " ` denode -v` successfully installed"
You can’t perform that action at this time.
0 commit comments