Skip to content

Commit e49c393

Browse files
committed
Adding rhel support to the install.sh script ...
1 parent 6472657 commit e49c393

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

install.sh

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ libspdlog_dev_min_version=150
1616
libzmq3_dev_min_version=432
1717

1818
sysdeb_install_list="libssl-dev libfmt-dev"
19+
sysrpm_install_list="jsoncpp-devel libconfig-devel spdlog-devel cppzmq-devel openssl-devel"
1920

2021
# gRPC install parameters
2122
readonly grpc_url="https://github.com/grpc/grpc"
@@ -62,6 +63,7 @@ readonly err_missing_options=82
6263
readonly err_unknown_options=83
6364
readonly err_missing_options_arg=84
6465
readonly err_unimplemented_options=85
66+
readonly err_epel_failure=86
6567
readonly script_name="${0##*/}"
6668

6769
h_option_flag=0
@@ -162,7 +164,7 @@ os_release_detect() {
162164
;;
163165
flavor)
164166
# Supported distro
165-
set -- debian ubuntu pop centos OpenBSD
167+
set -- debian ubuntu pop centos rhel OpenBSD
166168
local linux_distribution="$(egrep '^ID=' /etc/os-release | awk -F "=" '{print $2}' | tr -d "\"")"
167169
local bsd_distribution="none"
168170

@@ -190,7 +192,7 @@ os_release_detect() {
190192
case "${_flavor}" in
191193
debian)
192194
# Supported debian releases
193-
set -- 11
195+
set -- 11 12
194196

195197
for item in "$@";
196198
do
@@ -204,7 +206,7 @@ os_release_detect() {
204206
;;
205207
ubuntu|pop)
206208
# Supported ubuntu/pop releases
207-
set -- 20.04 22.04 22.10
209+
set -- 20.04 22.04 22.10 23.04
208210

209211
for item in "$@";
210212
do
@@ -216,9 +218,9 @@ os_release_detect() {
216218

217219
os_release_helper
218220
;;
219-
centos|redhat)
221+
centos|rhel)
220222
# Supported centos releases
221-
set -- 8 9
223+
set -- 8 9 9.1 9.2
222224

223225
for item in "$@";
224226
do
@@ -530,7 +532,7 @@ grpc_collector_bin_install_deb() {
530532
grpc_collector_bin_install_rpm() {
531533
#echo "grpc_collector_bin_install_rpm()"
532534
local yum_install=1
533-
yum install -y jsoncpp-devel libconfig-devel spdlog-devel cppzmq-devel openssl-devel
535+
yum install -y $(echo "${sysrpm_install_list}")
534536
yum_install="$?"
535537

536538
sed -i '/SPDLOG_FMT_EXTERNAL/s/^\/\/ //g' /usr/include/spdlog/tweakme.h
@@ -648,7 +650,7 @@ grpc_collector_lib_install_rpm() {
648650
fi
649651

650652
local yum_install=1
651-
yum install -y jsoncpp-devel libconfig-devel spdlog-devel cppzmq-devel openssl-devel
653+
yum install -y $(echo "${sysrpm_install_list}")
652654
yum_install="$?"
653655

654656
sed -i '/SPDLOG_FMT_EXTERNAL/s/^\/\/ //g' /usr/include/spdlog/tweakme.h
@@ -706,6 +708,7 @@ grpc_collector_deploy() {
706708
command -v make >/dev/null 2>&1 || die "error - expected make command" "${err_cmd_notfound}"
707709
command -v cmake >/dev/null 2>&1 || die "error - expected cmake command" "${err_cmd_notfound}"
708710
command -v gcc >/dev/null 2>&1 || die "error - expected gcc command" "${err_cmd_notfound}"
711+
command -v g++ >/dev/null 2>&1 || die "error - expected g++ command" "${err_cmd_notfound}"
709712
command -v autoreconf >/dev/null 2>&1 || die "error - expected autoreconf (autoconf) command" "${err_cmd_notfound}"
710713
command -v libtoolize >/dev/null 2>&1 || die "error - expected libtoolize (libtool) command" "${err_cmd_notfound}"
711714
command -v cut >/dev/null 2>&1 || die "error - expected cut command" "${err_cmd_notfound}"
@@ -715,10 +718,10 @@ grpc_collector_deploy() {
715718
"Linux ubuntu 20.04" | \
716719
"Linux ubuntu 22.04" | \
717720
"Linux ubuntu 22.10" | \
721+
"Linux ubuntu 23.04" | \
718722
"Linux pop 22.04")
719723
#echo "grpc_collector_deploy_deb()"
720724
command -v apt-get >/dev/null 2>&1 || die "error - expected apt command" "${err_cmd_notfound}"
721-
command -v g++ >/dev/null 2>&1 || die "error - expected g++ command" "${err_cmd_notfound}"
722725
check_if_root
723726
detect_sysdeb_lib "libjsoncpp-dev"
724727
detect_sysdeb_lib "librdkafka-dev"
@@ -742,13 +745,25 @@ grpc_collector_deploy() {
742745
;;
743746
"Linux centos 8" | \
744747
"Linux centos 9" | \
745-
"Linux redhat 8" | \
746-
"Linux redhat 9")
748+
"Linux rhel 8" | \
749+
"Linux rhel 9" | \
750+
"Linux rhel 9.1" | \
751+
"Linux rhel 9.2")
747752
#echo "grpc_collector_deploy_rpm()"
748-
command -v yum >/dev/null 2>&1 || die "error - expected yum command" "${err_cmd_notfound}"
753+
if [ "${_os_info}" = "Linux centos 8" ] || [ "${_os_info}" = "Linux centos 9" ]; then
754+
command -v yum >/dev/null 2>&1 || die "error - expected yum command" "${err_cmd_notfound}"
755+
else
756+
command -v dnf >/dev/null 2>&1 || die "error - expected dnf command" "${err_cmd_notfound}"
757+
fi
758+
749759
check_if_root
750-
# Switch to a recent gcc version
751-
source /opt/rh/gcc-toolset-11/enable
760+
761+
yum install -y epel-release >/dev/null 2>&1 || die "error - epel-release install failure" "${err_epel_failure}"
762+
763+
# Switch to a recent gcc version (old centos/rhel release)
764+
if [ "${_os_info}" = "Linux centos 8" ] || [ "${_os_info}" = "Linux rhel 8" ]; then
765+
source /opt/rh/gcc-toolset-11/enable
766+
fi
752767
detect_sysrpm_lib
753768
if [ "${grpc_dev}" -eq 0 ]; then
754769
detect_installed_grpc

0 commit comments

Comments
 (0)