-
Notifications
You must be signed in to change notification settings - Fork 0
/
leadman_unix.sh
92 lines (68 loc) · 2.62 KB
/
leadman_unix.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
os=$(uname)
arch=$(uname -m)
BLUE="\e[34m"
RED="\e[31m"
GREEN="\e[32m"
ENDCOLOR="\e[0m"
info="${BLUE}[INFO]${ENDCOLOR}"
err="${RED}[ERRR]${ENDCOLOR}"
succ="${GREEN}[SUCC]${ENDCOLOR}"
download=""
echo -e $info Checking OS
tag_name=$(([[ $TAG_NAME != "" ]] && echo $TAG_NAME) || echo "latest")
echo -e $info Found Lead Language Version: $tag_name
if [[ $os == 'Linux' || $os == 'Darwin' || $os == 'FreeBSD' ]]; then
echo -e "$info $os detected"
case "$arch" in
x86_64)
if [[ $os == 'FreeBSD' ]]; then
echo -e "$info Lead Docs will fallback to using CLI on FreeBSD systems"
fi
target="${arch}-unknown-linux-gnu"
[[ $os == 'Darwin' ]] && target="${arch}-apple-darwin"
[[ $os == 'FreeBSD' ]] && target="${arch}-unknown-freebsd"
echo -e "$info Getting Leadman $target"
download="https://github.com/ahq-softwares/lead/releases/$([[ $tag_name == 'latest' ]] && echo 'latest/download' || echo "download/$tag_name")/leadman_$target"
;;
aarch64)
if [[ $os == 'FreeBSD' ]]; then
echo -e "$err aarch64 version of Lead Lang is not supported on FreeBSD"
exit 1
elif [[ $os == 'Linux' ]]; then
echo -e "$info Lead Docs will fallback to using CLI on Linux aarch64 systems"
fi
target="${arch}-apple-darwin"
[[ $os == 'Linux' ]] && target="${arch}-unknown-linux-gnu"
echo -e "$info Getting Leadman $target"
download="https://github.com/ahq-softwares/lead/releases/$([[ $tag_name == 'latest' ]] && echo 'latest/download' || echo "download/$tag_name")/leadman_$target"
;;
i386)
if [[ $os == 'FreeBSD' ]]; then
echo -e "$err Lead Docs will fallback to using CLI on FreeBSD 32 bit systems"
elif [[ $os == 'Linux' ]]; then
echo -e "$info Lead Docs will fallback to using CLI on FreeBSD 32 bit systems"
fi
target="${arch}-unknown-freeebsd"
[[ $os == 'Linux' ]] && target="${arch}-unknown-linux-gnu"
echo -e "$info Getting Leadman $target"
download="https://github.com/ahq-softwares/lead/releases/$([[ $tag_name == 'latest' ]] && echo 'latest/download' || echo "download/$tag_name")/leadman_$target"
;;
*)
echo -e "$err Unsupported architecture: $arch"
exit 1
;;
esac
else
echo -e "$err Unsupported OS: $os"
exit 1
fi
tmp=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
echo -e $info Downloading Leadman $download
curl -L $download -o $tmp/leadman_init
chmod +x $tmp/leadman_init
echo -e $info Starting leadman
$tmp/leadman_init create
rm $tmp/leadman_init
rmdir $tmp
echo -e $succ Successfully installed 🎉