-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall
71 lines (61 loc) · 1.58 KB
/
install
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
71
#!/bin/sh
{
set -e
install_dir='/usr/local/bin'
install_path='/usr/local/bin/foundry'
OS=$(uname | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m | tr '[:upper:]' '[:lower:]')
cmd_exists() {
command -v "$@" > /dev/null 2>&1
}
latestURL=https://github.com/FoundryApp/foundry-cli/releases/latest/download
case "$OS" in
darwin)
URL=${latestURL}/foundry-macos-x86_64
;;
linux)
case "$ARCH" in
x86_64)
URL=${latestURL}/foundry-linux-x86_64
;;
amd64)
URL=${latestURL}/foundry-linux-x86_64
;;
armv8*)
URL=${latestURL}/foundry-linux-arm64
;;
aarch64)
URL=${latestURL}/foundry-linux-arm64
;;
*)
printf "$red> The architecture (${ARCH}) is not supported.$reset\n"
exit 1
;;
esac
;;
*)
printf "$red> The OS (${OS}) is not supported.$reset\n"
exit 1
;;
esac
sh_c='sh -c'
if [ ! -w "$install_dir" ]; then
if [ "$user" != 'root' ]; then
if cmd_exists sudo; then
sh_c='sudo -E sh -c'
elif cmd_exists su; then
sh_c='su -c'
else
echo 'This script requires to run command as sudo. We are unable to find either "sudo" or "su".'
exit 1
fi
fi
fi
printf "> Downloading $URL\n"
download_path=$(mktemp)
curl -fSL "$URL" -o "$download_path"
chmod +x "$download_path"
printf "> Installing $install_path\n"
$sh_c "mv -f $download_path $install_path"
printf "$green> Foundry successfully installed!\n$reset"
}