-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
70 lines (59 loc) · 1.22 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/zsh
# base
base_url="https://envman.devh.in/install"
detect_arch() {
case "$(uname -m)" in
x86_64)
echo "linux/amd64"
;;
armv7l)
echo "linux/arm"
;;
aarch64)
echo "linux/arm64"
;;
i386)
echo "linux/386"
;;
ppc64le)
echo "linux/ppc64le"
;;
mips64)
echo "linux/mips64"
;;
mips64le)
echo "linux/mips64le"
;;
*)
echo "unsupported"
;;
esac
}
# download and install
install_binary() {
local arch=$1
local url="${base_url}/${arch}"
local output_file="envman"
echo "Downloading binary for architecture: $arch from $url..."
curl -L -o $output_file $url
if [ $? -ne 0 ]; then
echo "Failed to download binary for architecture: $arch"
return 1
fi
chmod +x $output_file
sudo mv $output_file /usr/local/bin/envman
if [ $? -ne 0 ]; then
echo "Failed to install binary for architecture: $arch"
return 1
fi
echo "Successfully installed envman for architecture: $arch \n Initialize with: envman init"
envman init
return 0
}
# detect
arch=$(detect_arch)
if [ "$arch" = "unsupported" ]; then
echo "Unsupported architecture: $(uname -m)"
exit 1
fi
install_binary $arch