-
Notifications
You must be signed in to change notification settings - Fork 5
/
opengl.sh
executable file
·56 lines (48 loc) · 1012 Bytes
/
opengl.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
#!/bin/bash
set -u
set -e
packages_file=$(spack location -r)/etc/spack/packages.yaml
echo "Packages file: $packages_file"
stat "$packages_file" || true
if ! command -v sudo &> /dev/null
then
SUDO=""
else
SUDO="sudo"
fi
os=$(spack arch --family)
echo "OS: $os"
if [[ "$os" == *ubuntu* ]]; then
${SUDO} apt-get update
${SUDO} apt-get install -y libgl1-mesa-dev
if [[ "$os" == *ubuntu24* ]]; then
version="4.6"
elif [[ "$os" == *ubuntu20* ]]; then
version="4.5"
else
echo "Unknown OS version, default OpenGL version"
version="4.5"
fi
cat <<EOF > "$packages_file"
packages:
opengl:
buildable: false
externals:
- prefix: /usr/
spec: opengl@${version}
EOF
cat "$packages_file"
elif [[ "$os" == *almalinux* ]]; then
${SUDO} dnf install -y mesa-libGLU
cat <<EOF > "$packages_file"
packages:
opengl:
buildable: false
externals:
- prefix: /usr/
spec: [email protected]
EOF
cat "$packages_file"
else [[ "$os" == *darwin* ]]
echo "Nothing to do on Darwin"
fi