Skip to content

Commit 4237221

Browse files
Mohit04tomarcentos Cloud User
andauthored
FOGL-7084 CentOS Stream 9 support (#71)
* Added check to install rh-python36 package only if OS_VERSION is 7 Signed-off-by: Mohit Tomar <[email protected]> * Added check to use scl only if the OS_VERSION is 7 Signed-off-by: Mohit Tomar <[email protected]> * Fixed to check os version Signed-off-by: Mohit Tomar <[email protected]> * Added Check for copying service file to specific location based on OS VERSION Signed-off-by: centos Cloud User <[email protected]> * Feedback changes Signed-off-by: Mohit Tomar <[email protected]> Signed-off-by: Mohit Tomar <[email protected]> Signed-off-by: centos Cloud User <[email protected]> Co-authored-by: centos Cloud User <[email protected]>
1 parent 0982785 commit 4237221

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

packages/RPM/SPECS/fledge.spec

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ VCS: __VCS__
1515
%define install_path /usr/local
1616

1717
Prefix: /usr/local
18+
%if 0%{?centos} < 9 || 0%{?rhel} < 9
1819
Requires: dbus-devel, glib2-devel, boost, openssl, rh-python36, yum-utils, gcc, autoconf, curl, libtool, rsyslog, wget, zlib, libuuid, avahi, sudo, krb5-workstation, curl-devel
20+
%else
21+
Requires: dbus-devel, glib2-devel, boost, openssl, python3, yum-utils, gcc, autoconf, curl, libtool, rsyslog, wget, zlib, libuuid, avahi, sudo, krb5-workstation, curl-devel
22+
%endif
1923
AutoReqProv: no
2024

2125
%description
@@ -211,6 +215,7 @@ fi
211215
set -e
212216

213217
PKG_NAME="fledge"
218+
OS_VERSION=$(cat /etc/os-release | grep 'VERSION_ID=' | cut -f2 -d= | sed 's/"//g')
214219

215220
get_fledge_script () {
216221
fledge_script=$(rpm -ql ${PKG_NAME} | grep 'fledge/bin/fledge$')
@@ -324,7 +329,12 @@ copy_fledge_sudoer_file() {
324329
}
325330

326331
copy_service_file() {
327-
cp /usr/local/fledge/extras/scripts/fledge.service /etc/init.d/fledge
332+
if [[ ${OS_VERSION} == *"7"* ]]
333+
then
334+
cp /usr/local/fledge/extras/scripts/fledge.service /etc/init.d/fledge
335+
else
336+
cp /usr/local/fledge/extras/scripts/fledge.service /etc/rc.d/init.d/fledge
337+
fi
328338
}
329339

330340
enable_fledge_service() {
@@ -400,14 +410,24 @@ install_pip3_packages () {
400410
then
401411
echo "# " >> /home/${SUDO_USER}/.bashrc
402412
echo "# ${foglam_test}" >> /home/${SUDO_USER}/.bashrc
403-
echo "source scl_source enable rh-python36" >> /home/${SUDO_USER}/.bashrc
413+
if [[ ${OS_VERSION} == *"7"* ]]
414+
then
415+
echo "source scl_source enable rh-python36" >> /home/${SUDO_USER}/.bashrc
416+
fi
417+
fi
418+
if [[ ${OS_VERSION} == *"7"* ]]
419+
then
420+
source scl_source enable rh-python36
404421
fi
405-
source scl_source enable rh-python36
406422

407423
# TODO: we may need with --no-cache-dir
408424
python3 -m pip install -Ir /usr/local/fledge/python/requirements.txt
409-
410-
sudo bash -c 'source scl_source enable rh-python36; python3 -m pip install dbus-python numpy==1.19.5'
425+
if [[ ${OS_VERSION} == *"7"* ]]
426+
then
427+
sudo bash -c 'source scl_source enable rh-python36; python3 -m pip install dbus-python numpy==1.19.5'
428+
else
429+
sudo bash -c 'python3 -m pip install dbus-python numpy==1.19.5'
430+
fi
411431
set -e
412432
}
413433

0 commit comments

Comments
 (0)