-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
executable file
·68 lines (60 loc) · 1.22 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
#!/bin/bash
version="1.6.10"
releasedate="2024-01-31"
main() {
archive="6d6-compat-${releasedate}-${version}-$(os)"
url="https://github.com/KUM-Kiel/6d6-compat/releases/download/v${version}/${archive}.tar.gz"
# Save current directory.
current_dir=$(pwd)
# Create a temporary directory.
dir=$(tempdir)
if [ "x" = "x${dir}" ]; then
echo "Error: Could not create temporary directory!"
exit 1
fi
cd "${dir}"
# Download
download "$url" | tar xz
if [ $? -ne 0 ]; then
echo "Error unpacking the archive!"
cd "${current_dir}"
rm -rf "${dir}"
exit 1
fi
cd "${archive}"
# Install
echo "Ready to install. Please enter your sudo password!"
sudo ./install
cd "${current_dir}"
rm -rf "${dir}"
}
os() {
if [ "$(uname)" = "Darwin" ]; then
echo "mac"
else
echo "linux"
fi
}
tempdir() {
dir=$(mktemp -d 2>/dev/null || mkdtemp -d -t 6d6update)
if [ -d "$dir" ]; then
echo "$dir"
fi
}
find-dl() {
if [ $(which curl) ]; then
echo "curl -fsSL"
elif [ $(which wget) ]; then
echo "wget -qO-"
fi
}
dl=$(find-dl)
if [ "x" = "x${dl}" ]; then
echo "No download program is installed."
echo "Try \"sudo apt install curl\"."
exit 1
fi
download() {
$dl "$1"
}
main