This repository was archived by the owner on Nov 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·78 lines (61 loc) · 2.08 KB
/
install.sh
File metadata and controls
executable file
·78 lines (61 loc) · 2.08 KB
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
#!/bin/env sh
set -u
c_reset='\033[0m'
c_red='\033[1;31m'
c_white='\033[1;37m'
_echo() {
printf "$1\n"
}
log_error() {
_echo "${c_red}[!]${c_reset} $1"
}
log_info() {
_echo "${c_white}[*]${c_reset} $1"
}
arch=$(uname -m)
os=$(uname -s)
url="https://github.com/truemedian/luvit-bin/releases/latest/download/luvit-bin-${os}-${arch}.tar.gz"
if command -v curl &>/dev/null; then
log_info "Downloading release from github.com..."
status=$(curl -sfL -o .luvit.tar.gz -w "%{http_code}" $url)
if [ "$status" -eq 404 ]; then
log_error "Could not find release for your platform ($os-$arch)"
log_error "You can use the information in the README to build from source."
exit 1
elif [ "$status" -ne 200 ]; then
log_error "Could not download release from github.com"
log_error "Check your internet connection or try again later."
exit 1
fi
elif command -v wget &>/dev/null; then
log_info "Downloading release from github.com..."
wget -qNO .luvit.tar.gz $url
status=$?
if [ "$status" -eq 8 ]; then # This technically doesn't check for 404, but it's close enough
log_error "Could not find release for your platform ($os-$arch)"
log_error "You can use the information in the README to build from source."
exit 1
elif [ "$status" -ne 0 ]; then
log_error "Could not download release from github.com"
log_error "Check your internet connection or try again later."
exit 1
fi
else
log_error "'curl' or 'wget' is required to download the release"
fi
if command -v tar &>/dev/null; then
log_info "Extracting release..."
tar -xzf .luvit.tar.gz
elif command -v gtar &>/dev/null; then
log_info "Extracting release..."
gtar -xzf .luvit.tar.gz
elif command -v bsdtar &>/dev/null; then
log_info "Extracting release..."
bsdtar -xzf .luvit.tar.gz
else
log_error "tar' or 'gtar' or 'bsdtar' is required to download the release"
log_error "leaving 'luvit.tar.gz' in the current directory"
exit 1
fi
rm .luvit.tar.gz
log_info "Extracted release to $PWD"