Skip to content

Commit 5f0b879

Browse files
authored
Merge pull request #72 from fledge-iot/2.1.0RC
2.1.0RC
2 parents 82f7be9 + c0589e0 commit 5f0b879

File tree

9 files changed

+64
-34
lines changed

9 files changed

+64
-34
lines changed

make_rpm

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@
2121

2222
set -e
2323

24-
PKG_ROOT=`pwd` # The script must be executed from the root git directory
24+
PKG_ROOT=$(pwd) # The script must be executed from the root git directory
2525
repo_name="fledge" # Name of the Git repository
2626
branch="main" # Default Git branch to use
2727
pkg_name="fledge" # Name of the package to build
2828
architecture="x86_64" # The architecture for which the rpm should be created
29-
rhpg_pkg="rh-postgresql13" # Name of the Red Hat package for postgres
30-
rhgcc_pkg="devtoolset-7" # Name of the Red Hat package for the newer g++
3129
skip_build=0 # 1=skip Git repo extraction and Fledge build
3230

31+
# Check OS Name and OS Version
32+
os_name=$(grep -o '^NAME=.*' /etc/os-release | cut -f2 -d\" | sed 's/"//g')
33+
os_version=$(grep -o '^VERSION_ID=.*' /etc/os-release | cut -f2 -d\" | sed 's/"//g')
34+
3335
usage="$(basename "$0") [-h] [-c] [-a] [-s] [-b <branch>]
3436
This script is used to create the RPM package of Fledge
3537
@@ -121,27 +123,31 @@ if [[ $skip_build == 0 ]]; then
121123

122124
cd ${FLEDGE_ROOT}
123125
sudo ./requirements.sh
126+
# Use Red Hat packages and scl_source for postgres and newer g++ only if OS is RedHat/CentOS 7
127+
if [[ ( $os_name == *"Red Hat"* || $os_name == *"CentOS"* ) && $os_version == *"7"* ]]
128+
then
129+
rhpg_pkg="rh-postgresql13" # Name of the Red Hat package for postgres
130+
rhgcc_pkg="devtoolset-7" # Name of the Red Hat package for the newer g++
131+
132+
# Enables/verifies the environment for the build
133+
source scl_source enable ${rhpg_pkg}
134+
status_rh_postgresql=$?
135+
if [[ $status_rh_postgresql != 0 ]]; then
136+
echo "ERROR : it is not possible to enable the ${rhpg_pkg} environment"
137+
exit 1
138+
fi
124139

125-
# Enables/verifies the environment for the build
126-
source scl_source enable ${rhpg_pkg}
127-
status_rh_postgresql=$?
128-
129-
source scl_source enable ${rhgcc_pkg}
130-
status_devtoolset=$?
140+
source scl_source enable ${rhgcc_pkg}
141+
status_devtoolset=$?
142+
if [[ $status_devtoolset != 0 ]]; then
143+
echo "ERROR : it is not possible to enable the ${rhgcc_pkg} environment"
144+
exit 1
145+
fi
146+
fi
131147

132148
command -v pg_isready > /dev/null
133149
status_pg_isready=$?
134150

135-
if [[ $status_rh_postgresql != 0 ]]; then
136-
echo "ERROR : it is not possible to enable the ${rhpg_pkg} environment"
137-
exit 1
138-
fi
139-
140-
if [[ $status_devtoolset != 0 ]]; then
141-
echo "ERROR : it is not possible to enable the ${rhgcc_pkg} environment"
142-
exit 1
143-
fi
144-
145151
if [[ $status_pg_isready != 0 ]]; then
146152
echo "ERROR : the command pg_isready is not available"
147153
exit 1

others/scripts/gcp/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
fledge_gcp_version=2.0.1
2-
fledge_version>=2.0
1+
fledge_gcp_version=2.1.0
2+
fledge_version>=2.1

others/scripts/iec/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
fledge_iec_version=2.0.1
2-
fledge_version>=2.0
1+
fledge_iec_version=2.1.0
2+
fledge_version>=2.1

others/scripts/mqtt/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
fledge_mqtt_version=2.0.1
2-
fledge_version>=2.0
1+
fledge_mqtt_version=2.1.0
2+
fledge_version>=2.1

others/scripts/s2opcua/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
fledge_s2opcua_version=2.0.1
2-
fledge_version>=2.0
1+
fledge_s2opcua_version=2.1.0
2+
fledge_version>=2.1

packages/RPM/SPECS/fledge.spec

Lines changed: 26 additions & 6 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
408-
pip3 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'
424+
python3 -m pip install -Ir /usr/local/fledge/python/requirements.txt
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

plugins/make_deb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ EOF
244244
if [ -f requirements.sh ]; then
245245
./requirements.sh
246246
fi
247+
# version replaced in VERSION file
248+
echo ${version} > VERSION;
247249
mkdir -p build; cd build; cmake ..; make)
248250
mkdir -p "plugins/${plugin_type_install}/${plugin_install_dirname}"
249251
if [ -f "${GIT_ROOT}/extras_install.sh" ]; then

plugins/make_rpm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ EOF
253253
if [ -f requirements.sh ]; then
254254
./requirements.sh
255255
fi
256+
# version replaced in VERSION file
257+
echo ${version} > VERSION;
256258
if [ -f build.sh ]; then
257259
./build.sh
258260
else

plugins/packages/DEBIAN/postinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if [ -f /usr/local/fledge/python/extras_install___PLUGIN_NAME__.sh ]; then
4141
fi
4242
# Install Python pip dependencies; if any
4343
if [ -f /usr/local/fledge/__INSTALL_DIR__/requirements.txt ]; then
44-
pip3 install -Ir /usr/local/fledge/__INSTALL_DIR__/requirements.txt
44+
python3 -m pip install -Ir /usr/local/fledge/__INSTALL_DIR__/requirements.txt
4545
fi
4646

4747
# For C based plugins

0 commit comments

Comments
 (0)