Skip to content

Commit

Permalink
Modified scripts (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
djesic authored May 19, 2021
1 parent 1b40f12 commit d6f0fe6
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 94 deletions.
13 changes: 8 additions & 5 deletions tools/deb-amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM ubuntu:bionic-20200403
FROM amd64/debian:buster

WORKDIR /build

RUN apt-get update \
&& apt-get install -y git gcc g++ cmake zlib1g-dev \
&& apt-get install -y mosquitto cmake libssl-dev \
&& apt-get install -y devscripts debhelper
ENV TZ=Europe/Belgrade
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt update
RUN apt install -y git gcc g++ cmake automake autotools-dev autoconf m4 zlib1g-dev \
cmake libtool libssl-dev devscripts debhelper

COPY make_deb.sh /build
COPY *.zip /build

#CMD ["bash", "make_deb.sh"]
6 changes: 1 addition & 5 deletions tools/deb-amd64/build-image-amd64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
# limitations under the License.
#

if [ "$EUID" -ne 0 ]; then
echo "Please run as sudo."
exit
fi

cp ../make_deb.sh .
cp ../*.zip .

docker build -t wolkabout:wg-amd64 .
rm make_deb.sh
11 changes: 6 additions & 5 deletions tools/deb-amd64/run-amd64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
# limitations under the License.
#

if [ "$EUID" -ne 0 ]; then
echo "Please run as sudo."
exit
fi

./build-image-amd64.sh

docker container stop debuilder
Expand All @@ -31,6 +26,7 @@ if [ $? -eq 1 ]; then
fi

docker run -dit --name debuilder --cpus $(nproc) wolkabout:wg-amd64 || exit
docker exec -it debuilder unzip /build/*.zip -d WolkGateway || exit
docker exec -it debuilder /build/make_deb.sh $branch || exit
docker cp debuilder:/build/ .

Expand All @@ -40,4 +36,9 @@ docker container rm debuilder
mv ./build/*.deb .
rm -rf ./build/

rm *dbgsym*

rm ./make_deb.sh
rm ./*.zip

chown "$USER:$USER" *.deb
4 changes: 3 additions & 1 deletion tools/deb-arm64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ ENV TZ=Europe/Belgrade
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt update
RUN apt install -y git gcc g++ cmake automake autotools-dev autoconf m4 zlib1g-dev cmake libtool libssl-dev libpoco-dev devscripts debhelper
RUN apt install -y git gcc g++ cmake automake autotools-dev autoconf m4 zlib1g-dev \
cmake libtool libssl-dev devscripts debhelper

COPY make_deb.sh /build
COPY *.zip /build

#CMD ["bash", "make_deb.sh"]
8 changes: 2 additions & 6 deletions tools/deb-arm64/build-image-arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@
# limitations under the License.
#

if [ "$EUID" -ne 0 ]; then
echo "Please run as sudo."
exit
fi

sudo apt-get install qemu binfmt-support qemu-user-static
echo "If something doesn\'t work, install the dependencies: 'apt-get install qemu qemu-user-static binfmt-support'"
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

cp ../make_deb.sh .
cp ../*.zip .

docker build -t wolkabout:wg-arm64 .
rm make_deb.sh
9 changes: 4 additions & 5 deletions tools/deb-arm64/run-arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
# limitations under the License.
#

if [ "$EUID" -ne 0 ]; then
echo "Please run as sudo."
exit
fi

./build-image-arm64.sh

docker container stop debuilder
Expand All @@ -31,6 +26,7 @@ if [ $? -eq 1 ]; then
fi

docker run -dit --name debuilder --cpus $(nproc) wolkabout:wg-arm64 || exit
docker exec -it debuilder unzip /build/*.zip -d WolkGateway || exit
docker exec -it debuilder /build/make_deb.sh $branch || exit
docker cp debuilder:/build/ .

Expand All @@ -42,4 +38,7 @@ rm -rf ./build/

rm *dbgsym*

rm ./make_deb.sh
rm ./*.zip

chown "$USER:$USER" *.deb
13 changes: 8 additions & 5 deletions tools/deb-armv7l/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM raspbian/stretch:latest
FROM arm32v7/debian:buster

WORKDIR /build

RUN apt-get update \
&& apt-get install -y git gcc g++ cmake \
&& apt-get install -y automake autotools-dev autoconf m4 zlib1g-dev cmake libtool libssl-dev \
&& apt-get install -y devscripts debhelper
ENV TZ=Europe/Belgrade
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt update
RUN apt install -y git gcc g++ cmake automake autotools-dev autoconf m4 zlib1g-dev \
cmake libtool libssl-dev devscripts debhelper

COPY make_deb.sh /build
COPY *.zip /build

#CMD ["bash", "make_deb.sh"]
8 changes: 2 additions & 6 deletions tools/deb-armv7l/build-image-armv7l.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@
# limitations under the License.
#

if [ "$EUID" -ne 0 ]; then
echo "Please run as sudo."
exit
fi

sudo apt-get install qemu binfmt-support qemu-user-static
echo "If something doesn\'t work, install the dependencies: 'apt-get install qemu qemu-user-static binfmt-support'"
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

cp ../make_deb.sh .
cp ../*.zip .

docker build -t wolkabout:wg-armv7l .
rm make_deb.sh
9 changes: 4 additions & 5 deletions tools/deb-armv7l/run-armv7l.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
# limitations under the License.
#

if [ "$EUID" -ne 0 ]; then
echo "Please run as sudo."
exit
fi

./build-image-armv7l.sh

docker container stop debuilder
Expand All @@ -31,6 +26,7 @@ if [ $? -eq 1 ]; then
fi

docker run -dit --name debuilder --cpus $(nproc) wolkabout:wg-armv7l || exit
docker exec -it debuilder unzip /build/*.zip -d WolkGateway || exit
docker exec -it debuilder /build/make_deb.sh $branch || exit
docker cp debuilder:/build/ .

Expand All @@ -42,4 +38,7 @@ rm -rf ./build/

rm *dbgsym*

rm ./make_deb.sh
rm ./*.zip

chown "$USER:$USER" *.deb
43 changes: 1 addition & 42 deletions tools/make_deb.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,4 @@
#!/bin/bash
#
# Copyright 2020 WolkAbout Technology s.r.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script is used to make a release .deb file for WolkGateway release

if [ $# -eq 1 ]; then
branch=$1
else
branch=$(git rev-parse --abbrev-ref HEAD)

if [ "$branch" == "" ]; then
echo "You must specify a branch as parameter to the script (if the script is not part of a repo)"
exit
fi
fi

if [ $(dpkg -l | grep -c devscripts) -lt 1 ]; then
if [ "$EUID" -ne 0 ]; then
Expand All @@ -45,20 +18,6 @@ if [ $(dpkg -l | grep -c debhelper) -lt 1 ]; then
apt install -y debhelper
fi

rm -rf ./tmp-wg-deb
mkdir -p ./tmp-wg-deb
cd ./tmp-wg-deb || exit
git clone https://github.com/Wolkabout/WolkGateway --recurse-submodules
cd ./WolkGateway || exit
git checkout "$branch"
if [ $? -ne 0 ]; then
echo "Can't checkout to branch named $branch"
exit
fi
git submodule update
ls

debuild -us -uc -b -j$(nproc)
cd ../
mv *.deb ..
cd ../
rm -rf ./tmp-wg-deb
9 changes: 1 addition & 8 deletions tools/make_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@
# limitations under the License.
#

if [ "$EUID" -ne 0 ]; then
echo "Please run as sudo."
exit
fi

filename="release-v$(cat ../RELEASE_NOTES.txt | grep "**Version" | head -1 | sed -e "s/**Version //" | sed -e "s/\*\*//")"
mkdir -p ./"$filename"

./make_zip.sh
mv *.zip "$filename"

cd ./deb-amd64 || exit
./run-amd64.sh
Expand All @@ -41,5 +35,4 @@ cd ./deb-arm64 || exit
mv *.deb ../"$filename"/
cd ..

cd "$filename" || exit
chown "$USER:$USER" *
mv *.zip "$filename"
7 changes: 6 additions & 1 deletion tools/make_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script is used to make a release .zip file for WolkGatewayModule-Modbus release
# This script is used to make a release .zip file for WolkGateway release

if [ $# -eq 1 ]; then
branch=$1
Expand Down Expand Up @@ -45,6 +45,11 @@ if [ $? -ne 0 ]; then
echo "Can't checkout to branch named $branch"
exit
fi
git submodule update --recursive
cd ./WolkSDK-Cpp || exit
git submodule init
git submodule update
cd .. || exit
filename="WolkGateway-v$(cat RELEASE_NOTES.txt | grep "**Version" | head -1 | sed -e "s/**Version //" | sed -e "s/\*\*//").zip"
echo "filename: $filename"
zip -qr $filename *
Expand Down

0 comments on commit d6f0fe6

Please sign in to comment.