-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
51 lines (43 loc) · 1.35 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
set -e
OS_NAME=$(uname -s)
ARCH_NAME=$(uname -m)
OS=""
ARCH=""
INSTALL_DIR="/usr/local/bin"
NO_RELEASE_ASSET=""
echo "Installing envfetch to $INSTALL_DIR"
echo "This script will activate sudo to install to $INSTALL_DIR"
sudo echo "Sudo activated"
if [ "$OS_NAME" = "Linux" ]; then
OS="Linux"
if [ "$ARCH_NAME" = "x86_64" ]; then
BUILD_TARGET="linux-amd64"
elif [ "$ARCH_NAME" = "arm" || "$ARCH_NAME" = "arm64" ]; then
BUILD_TARGET="linux-arm64"
else
NO_RELEASE_ASSET="true"
echo "There is no release for this architecture: $ARCH_NAME" >&2
fi
elif [ "$OS_NAME" = "Darwin" ]; then
OS="macOS"
if [ "$ARCH_NAME" = "x86_64" ]; then
BUILD_TARGET="darwin-amd64"
elif [ "$ARCH_NAME" = "arm" || "$ARCH_NAME" = "arm64" ]; then
BUILD_TARGET="darwin-arm64"
else
NO_RELEASE_ASSET="true"
echo "There is no release for this architecture: $ARCH_NAME" >&2
fi
else
NO_RELEASE_ASSET="true"
echo "There is no Unix release for this OS: $OS_NAME" >&2
fi
if [ "$NO_RELEASE_ASSET" ]; then
exit 1
fi
# Download file directly to install directory
sudo curl -sSL "https://github.com/ankddev/envfetch/releases/latest/download/envfetch-$BUILD_TARGET" --output "$INSTALL_DIR/envfetch"
# Give permissions for executable
sudo chmod +x "$INSTALL_DIR/envfetch"
echo "Successfully installed envfetch"