Skip to content

Commit d9f815f

Browse files
Merge pull request #58 from fledge-iot/2.0.0RC
2.0.0RC
2 parents 74d5a8c + 6658c6c commit d9f815f

File tree

34 files changed

+795
-250
lines changed

34 files changed

+795
-250
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ packages/Debian/build/
1313
packages/RPM/build/
1414
others/paho.mqtt.c/
1515
others/jansson
16+
others/lib60870
17+
others/libiec61850
18+
others/S2OPC
19+
others/check-0.15.2.tar.gz
20+
others/check-0.15.2
21+
others/libexpat
1622

1723
# Archived packages
1824
plugins/archive

docker/Dockerfile.centos7

Lines changed: 0 additions & 56 deletions
This file was deleted.

docker/latest/Dockerfile.centos7

Lines changed: 0 additions & 54 deletions
This file was deleted.

docker/latest/Dockerfile.ubuntu1804

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LABEL maintainer="[email protected]"
55
ENV ARCHITECTURE="x86_64"
66
ENV OS="ubuntu1804"
77

8+
# v1.9.2 onwards only
89
ARG PKG_VERSION="latest"
910

1011
ENV FLEDGE_PKGS_ARCHIVES_LINK="http://archives.fledge-iot.org/${PKG_VERSION}/${OS}/${ARCHITECTURE}/"
@@ -25,11 +26,8 @@ add-apt-repository "deb ${FLEDGE_PKGS_ARCHIVES_LINK} / "
2526
# Install fledge
2627
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y fledge
2728

28-
# Fix and install fledge-gui
29-
RUN apt-get download fledge-gui && \
30-
dpkg --unpack fledge-gui*.deb && \
31-
sed -i 's/grep/echo/g' /var/lib/dpkg/info/fledge-gui.postinst && \
32-
dpkg --configure fledge-gui
29+
# Install fledge-gui
30+
RUN apt-get install -y fledge-gui
3331

3432
# Build the Start Script
3533
RUN echo "service rsyslog start" > start.sh && \
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM ubuntu:18.04
2+
3+
LABEL maintainer="[email protected]"
4+
5+
ENV ARCHITECTURE="aarch64"
6+
ENV OS="ubuntu1804"
7+
8+
# v1.9.2 onwards only
9+
ARG PKG_VERSION="latest"
10+
11+
ENV FLEDGE_PKGS_ARCHIVES_LINK="http://archives.fledge-iot.org/${PKG_VERSION}/${OS}/${ARCHITECTURE}/"
12+
13+
# Install pre-requisites
14+
RUN apt-get update && \
15+
apt-get install -y rsyslog curl wget jq nginx-light software-properties-common
16+
17+
18+
# Fake service control as docker container doesn't use it
19+
RUN printf '#!/bin/bash \nexit 0' > /usr/bin/systemctl
20+
RUN chmod 755 /usr/bin/systemctl
21+
22+
# Install Fledge repo within container
23+
RUN wget -q -O - http://archives.fledge-iot.org/KEY.gpg | apt-key add - && \
24+
add-apt-repository "deb ${FLEDGE_PKGS_ARCHIVES_LINK} / "
25+
26+
# Install fledge
27+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y fledge
28+
29+
# Install fledge-gui
30+
RUN apt-get install -y fledge-gui
31+
32+
# Build the Start Script
33+
RUN echo "service rsyslog start" > start.sh && \
34+
echo "service nginx start" >> start.sh && \
35+
echo "/usr/local/fledge/bin/fledge start" >> start.sh && \
36+
echo "tail -f /var/log/syslog" >> start.sh && \
37+
chmod +x start.sh
38+
39+
RUN usermod -aG www-data root
40+
41+
ENV FLEDGE_ROOT=/usr/local/fledge
42+
43+
# VOLUME /usr/local/fledge/data
44+
45+
# Fledge API and Fledge GUI ports
46+
EXPOSE 8081 1995 80
47+
48+
CMD ["bash", "./start.sh"]

docker/latest/Dockerfile.ubuntu2004

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LABEL maintainer="[email protected]"
55
ENV ARCHITECTURE="x86_64"
66
ENV OS="ubuntu2004"
77

8+
# v1.9.2 onwards only
89
ARG PKG_VERSION="latest"
910

1011
ENV FLEDGE_PKGS_ARCHIVES_LINK="http://archives.fledge-iot.org/${PKG_VERSION}/${OS}/${ARCHITECTURE}/"
@@ -25,11 +26,8 @@ add-apt-repository "deb ${FLEDGE_PKGS_ARCHIVES_LINK} / "
2526
# Install fledge
2627
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y fledge
2728

28-
# Fix and install fledge-gui
29-
RUN apt-get download fledge-gui && \
30-
dpkg --unpack fledge-gui*.deb && \
31-
sed -i 's/grep/echo/g' /var/lib/dpkg/info/fledge-gui.postinst && \
32-
dpkg --configure fledge-gui
29+
# Install fledge-gui
30+
RUN apt-get install -y fledge-gui
3331

3432
# Build the Start Script
3533
RUN echo "service rsyslog start" > start.sh && \

make_deb

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,40 @@ Arguments:
2929
clean - Remove all the old versions saved in format .XXXX
3030
cleanall - Remove all the versions, including the last one"
3131

32-
GIT_ROOT=`pwd`
32+
PKG_ROOT=`pwd`
3333
architecture=`arch`
34+
ARCH_NAME=$(dpkg --print-architecture)
35+
repo_name=fledge
36+
skip_build=0
3437

35-
for i in "$@"
36-
do
37-
case "$i" in
38+
while getopts ":hcasb:" opt; do
39+
case "$opt" in
3840
clean)
39-
if [ -d "${GIT_ROOT}/packages/Debian/build" ]; then
41+
if [ -d "${PKG_ROOT}/packages/Debian/build" ]; then
4042
echo -n "Cleaning the build folder from older versions..."
41-
find "${GIT_ROOT}/packages/Debian/build/${architecture}" -maxdepth 2 | grep '.*\.[0-9][0-9][0-9][0-9]' | xargs rm -rf
43+
find "${PKG_ROOT}/packages/Debian/build/${architecture}" -maxdepth 2 | grep '.*\.[0-9][0-9][0-9][0-9]' | xargs rm -rf
4244
echo "Done."
4345
else
4446
echo "No build folder, skipping clean"
4547
fi
4648
exit 0
4749
;;
4850
cleanall)
49-
if [ -d "${GIT_ROOT}/packages/Debian/build" ]; then
51+
if [ -d "${PKG_ROOT}/packages/Debian/build" ]; then
5052
echo -n "Cleaning the build folder..."
51-
rm -rf ${GIT_ROOT}/packages/Debian/build
53+
rm -rf ${PKG_ROOT}/packages/Debian/build
5254
echo "Done."
5355
else
5456
echo "No build folder, skipping cleanall"
5557
fi
5658
exit 0
5759
;;
60+
s)
61+
skip_build=1
62+
;;
63+
b)
64+
branch=$OPTARG
65+
;;
5866
help)
5967
echo "${usage}"
6068
exit 1
@@ -66,6 +74,46 @@ do
6674
esac
6775
done
6876

77+
#
78+
# Clones/updates Git repository
79+
#
80+
if [[ $skip_build == 0 ]]; then
81+
cd /tmp
82+
if [ -d "${repo_name}" ]; then
83+
echo WARNING: Repository ${repo_name} already exists, using the existing copy
84+
(cd ${repo_name}; git fetch --all; git pull ; git checkout "$branch")
85+
else
86+
git clone -b "$branch" https://github.com/fledge-iot/${repo_name}.git
87+
fi
88+
89+
GIT_ROOT=/tmp/"${repo_name}"
90+
cd ${GIT_ROOT}
91+
92+
git_tag_info=$(cd ${GIT_ROOT} && git describe --tags) && commit_count=$(echo ${git_tag_info} | cut -d- -f2)
93+
fi
94+
95+
#
96+
# Builds Fledge
97+
#
98+
if [[ $skip_build == 0 ]]; then
99+
cd ${GIT_ROOT}
100+
echo "Git log details for Fledge..."
101+
git --no-pager log -1
102+
103+
if [ "${ARCH_NAME}" = "armhf" ]; then
104+
sudo ./requirements.sh
105+
sed -i 's/python_build python_requirements_user/python_build # python_requirements_user/g' Makefile
106+
sed -i '/python_requirements \\/d' Makefile
107+
fi
108+
echo "install fledge"
109+
if [ "${ARCH_NAME}" = "armhf" ]; then
110+
cd ${GIT_ROOT} && sudo make install USE_PIP_CACHE=yes && export FLEDGE_ROOT=/usr/local/fledge
111+
else
112+
sudo ./requirements.sh
113+
cd ${GIT_ROOT} && sudo make install && export FLEDGE_ROOT=/usr/local/fledge
114+
fi
115+
fi
116+
69117
# Check FLEDGE_ROOT
70118
if [ -z ${FLEDGE_ROOT+x} ]; then
71119
# Set FLEDGE_ROOT as the default directory
@@ -79,13 +127,12 @@ if [ -z ${FLEDGE_ROOT+x} ]; then
79127
fi
80128

81129
version=`cat ${FLEDGE_ROOT}/VERSION | tr -d ' ' | grep 'fledge_version=' | head -1 | sed -e 's/\(.*\)=\(.*\)/\2/g'`
82-
BUILD_ROOT="${GIT_ROOT}/packages/Debian/build/${architecture}"
83-
130+
BUILD_ROOT="${PKG_ROOT}/packages/Debian/build/${architecture}"
84131
# Final package name
85-
package_name="fledge-${version}-${architecture}"
132+
if [[ $skip_build == 0 ]] && ([[ ${branch} != "main" ]] && [[ ! ${branch} =~ ^[0-9]+\.[0-9]+\.[0-9]+RC ]] && [[ ! ${branch} =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]); then package_name="fledge_${version}-${commit_count}_${architecture}"; version=${git_tag_info:1}; else package_name="fledge_${version}_${architecture}"; fi
86133

87134
# Print the summary of findings
88-
echo "The package root directory is : ${GIT_ROOT}"
135+
echo "The package root directory is : ${PKG_ROOT}"
89136
echo "The Fledge directory is : ${FLEDGE_ROOT}"
90137
echo "The Fledge version is : ${version}"
91138
echo "The package will be built in : ${BUILD_ROOT}"
@@ -115,9 +162,10 @@ mkdir "${package_name}"
115162
# First with files common to all pla
116163
echo -n "Populating the package and updating version in control file..."
117164
cd "${package_name}"
118-
cp -R ${GIT_ROOT}/packages/Debian/common/* .
119-
cp -R ${GIT_ROOT}/packages/Debian/${architecture}/* .
165+
cp -R ${PKG_ROOT}/packages/Debian/common/* .
166+
cp -R ${PKG_ROOT}/packages/Debian/${architecture}/* .
120167
sed -i "s/Version: 1.0.0/Version: ${version}/g" DEBIAN/control
168+
if [[ $skip_build == 0 ]] && ([[ ${branch} = "main" ]] || [[ ${branch} =~ ^[0-9]+\.[0-9]+\.[0-9]+RC ]] || [[ ${branch} =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]); then echo "Build: ${git_tag_info:1}" >> DEBIAN/control; fi
121169
mkdir -p usr/local/fledge
122170
cd usr/local/fledge
123171
cp -R ${FLEDGE_ROOT}/* .
@@ -139,10 +187,10 @@ rm -rf var
139187
# Add customised files
140188
#echo -n "Adding Fledge customization..."
141189

142-
#cp -R ${GIT_ROOT}/share/* share/postgresql/.
190+
#cp -R ${PKG_ROOT}/share/* share/postgresql/.
143191
#cd ${BUILD_ROOT}/${package_name}/usr/local/fledge/plugins/storage/postgres
144192
#mkdir bin
145-
#cp ${GIT_ROOT}/scripts/* bin/.
193+
#cp ${PKG_ROOT}/scripts/* bin/.
146194
#echo "Done."
147195

148196
# Build the package

0 commit comments

Comments
 (0)