-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetupDevEnvironment.sh
executable file
·147 lines (128 loc) · 3.05 KB
/
setupDevEnvironment.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/sh
#
# Copyright 2022 Vinícius Ferrão <[email protected]>
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of CloysterHPC
# https://github.com/viniciusferrao/cloysterhpc
#
# Script to ease development environment setup on Enterprise Linux (EL) systems
# Stop execution in case of any error (add x for debugging)
set -e
# Check if it's not running as root
if [ "$(id -u)" -ne 0 ]; then
# Check if sudo is available
if command -v sudo >/dev/null; then
# Override dnf to use sudo
dnf() {
sudo /usr/bin/dnf "$@"
}
else
echo \
"sudo is required but not installed. Please install sudo or run as root."
exit 1
fi
fi
# Grab EL version from RPM
os_version=$(rpm -E %rhel)
# Helper functions
add_epel() {
dnf -y install \
"https://dl.fedoraproject.org/pub/epel/epel-release-latest-${os_version}.noarch.rpm"
}
# OS relevant settings
redhat() {
if [ "$(id -u)" -eq 0 ]; then
subscription-manager refresh
else
sudo subscription-manager refresh
fi
if [ "$os_version" -eq 10 ]; then
dnf config-manager --set-enabled \
"codeready-builder-beta-for-rhel-${os_version}-x86_64-rpms"
else
dnf config-manager --set-enabled \
"codeready-builder-for-rhel-${os_version}-x86_64-rpms"
fi
add_epel;
}
rocky() {
case "$os_version" in
8)
repo_name="powertools"
;;
9|10)
repo_name="crb"
;;
esac
dnf config-manager --set-enabled "$repo_name"
dnf -y install epel-release
}
almalinux() {
case "$os_version" in
8)
repo_name="powertools"
;;
9|10)
repo_name="crb"
;;
esac
dnf config-manager --set-enabled "$repo_name"
dnf -y install epel-release
}
oracle() {
dnf config-manager --set-enabled "ol${os_version}_codeready_builder"
add_epel;
}
#
# Entrypoint
#
echo Setting up development environment for CloysterHPC
echo
case $(cut -f 3 -d : /etc/system-release-cpe) in
redhat)
redhat;
;;
rocky)
rocky;
;;
almalinux)
almalinux;
;;
oracle)
oracle;
;;
*)
echo Unable to properly identify the running OS. Aborting.
exit 2
;;
esac
# Build toolset, packages and utils
dnf -y install rsync git gcc-c++ gdb cmake ccache ninja-build llvm-toolset \
lldb compiler-rt
case "$os_version" in
8)
dnf -y install python3 python3-pip\* gcc-toolset-14 \
gcc-toolset-14-libubsan-devel gcc-toolset-14-libasan-devel cppcheck
;;
9)
dnf -y install python pip libasan libubsan gcc-toolset-14 \
gcc-toolset-14-libubsan-devel gcc-toolset-14-libasan-devel cppcheck
;;
10)
dnf -y install python pip libubsan libasan liblsan libtsan libhwasan
;;
esac
# Install Conan as user
pip3 install --user conan
# Required libraries
dnf -y install newt-devel
echo
echo Development tools, packages and libraries were installed on your system.
echo
echo If compiling or running on EL8 or EL9, please remember to source or
echo activate the environment file with the correct toolset compiler:
echo \"source rhel-gcc-toolset-14.sh\"
echo
echo To proceed with the compilation please refer to the README.md file.
echo