Skip to content

Commit 71717d1

Browse files
authored
Update install.sh
1 parent 188582b commit 71717d1

File tree

1 file changed

+45
-6
lines changed

1 file changed

+45
-6
lines changed

β€Žinstall.sh

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,49 @@
11
#!/bin/bash
2-
set -ex
2+
set -e
33

4-
cat <<EOF
5-
----------------------------------------------
4+
ensure_apt_packages() (
5+
set -e
66

7-
YOU ARE AWESOME!
7+
export DEBIAN_FRONTEND=noninteractive
8+
if dpkg -s "$@" &>/dev/null; then
9+
echo "🟦 $@ is already installed"
10+
else
11+
if [[ $(find /var/lib/apt/lists/* | wc -l) == 0 ]]; then
12+
echo 'πŸŸͺ Updating local apt index...'
13+
apt-get update -y
14+
echo '🟩 Updated local apt index'
15+
fi
16+
echo "πŸŸͺ Installing $@..."
17+
apt-get install -y --no-install-recommends "$@"
18+
echo "🟩 Installed $@"
19+
fi
20+
)
821

9-
----------------------------------------------
10-
EOF
22+
clear_local_apt_index() (
23+
set -e
24+
25+
rm -rf /var/lib/apt/lists/*
26+
echo '🟩 Cleared local apt index'
27+
)
28+
29+
ensure_apt_packages curl ca-certificates jq
30+
31+
if [[ -z $VERSION || $VERSION == latest ]]; then
32+
echo "πŸŸͺ Fetching latest LLVM release..."
33+
curl -fsSLo latest-release.json https://api.github.com/repos/llvm/llvm-project/releases/latest
34+
version=$(jq -r .tag_name latest-release.json | sed 's/^llvmorg-//')
35+
echo "🟦 Using latest LLVM release: v$version"
36+
else
37+
version="$VERSION"
38+
echo "🟦 Using LLVM release: v$version"
39+
fi
40+
41+
ensure_apt_packages lsb-release wget software-properties-common gnupg
42+
43+
echo "πŸŸͺ Installing LLVM v$version..."
44+
wget https://apt.llvm.org/llvm.sh
45+
chmod +x llvm.sh
46+
./llvm.sh "$version"
47+
echo "🟩 Installed LLVM v$version"
48+
49+
clear_local_apt_index

0 commit comments

Comments
Β (0)