-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·71 lines (59 loc) · 1.87 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
71
#!/bin/bash
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Detect OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
platform="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
platform="macos"
else
echo "Unsupported OS"
exit 1
fi
# Detect architecture
arch=$(uname -m)
# Check if the platform and architecture are supported
if [ "$platform" == "linux" ]; then
if [ "$arch" == "x86_64" ]; then
target_musl="x86_64-unknown-linux-musl"
target_gnu="x86_64-unknown-linux-gnu"
elif [ "$arch" == "aarch64" ]; then
target_musl="aarch64-unknown-linux-musl"
target_gnu="aarch64-unknown-linux-gnu"
else
echo "Unsupported architecture for Linux"
exit 1
fi
# Check if GNU libc is available on the system
if ldd --version >/dev/null 2>&1; then
target=$target_gnu
else
target=$target_musl
fi
elif [ "$platform" == "macos" ]; then
if [ "$arch" == "x86_64" ]; then
target="x86_64-apple-darwin"
elif [ "$arch" == "arm64" ]; then
target="aarch64-apple-darwin"
else
echo "Unsupported architecture for macOS"
exit 1
fi
fi
version=$(get_latest_release EduardoRodriguesF/quartz)
dir="quartz-$version-$target"
url="https://github.com/EduardoRodriguesF/quartz/releases/latest/download/$dir.tar.gz"
# Download and extract the tarball
echo "Downloading quartz $version for $platform ($target)..."
curl -L -o quartz.tar.gz $url
tar -xzf quartz.tar.gz
# Add the binary to a directory in $PATH
sudo mv $dir/quartz /usr/local/bin/
sudo cp $dir/doc/quartz.1 /usr/share/man/man1/
# Cleanup
rm quartz.tar.gz
rm -rf $dir
echo "quartz $version was installed"