From 951cfa0863f5c10abec2282b36262c4c3669be28 Mon Sep 17 00:00:00 2001 From: rafael Date: Tue, 19 Sep 2023 11:56:15 +0200 Subject: [PATCH] 11830 finish builder for rpm and deb --- extras/pandora_gotty/.gitignore | 3 ++- extras/pandora_gotty/Dockerfile-deb | 6 ++++++ extras/pandora_gotty/README.md | 1 + extras/pandora_gotty/build_all_docker.sh | 12 ++++++++++-- extras/pandora_gotty/build_deb.sh | 15 +++++++++++++++ extras/pandora_gotty/build_rpm.sh | 3 +-- extras/pandora_gotty/deb/.gitignore | 3 +++ .../deb/pandora_gotty/DEBIAN/changelog | 5 +++++ .../deb/pandora_gotty/DEBIAN/control | 9 +++++++++ 9 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 extras/pandora_gotty/Dockerfile-deb create mode 100644 extras/pandora_gotty/README.md create mode 100755 extras/pandora_gotty/build_deb.sh create mode 100644 extras/pandora_gotty/deb/.gitignore create mode 100644 extras/pandora_gotty/deb/pandora_gotty/DEBIAN/changelog create mode 100644 extras/pandora_gotty/deb/pandora_gotty/DEBIAN/control diff --git a/extras/pandora_gotty/.gitignore b/extras/pandora_gotty/.gitignore index 8d5bedc36a..db388678f7 100644 --- a/extras/pandora_gotty/.gitignore +++ b/extras/pandora_gotty/.gitignore @@ -1 +1,2 @@ -*.rpm \ No newline at end of file +*.rpm +*.deb \ No newline at end of file diff --git a/extras/pandora_gotty/Dockerfile-deb b/extras/pandora_gotty/Dockerfile-deb new file mode 100644 index 0000000000..02a30a43d3 --- /dev/null +++ b/extras/pandora_gotty/Dockerfile-deb @@ -0,0 +1,6 @@ +FROM ubuntu:22.04 + +RUN apt-get update +RUN apt-get install -y dh-make debhelper build-essential +RUN mkdir /root/pandora_gotty +WORKDIR /root/pandora_gotty \ No newline at end of file diff --git a/extras/pandora_gotty/README.md b/extras/pandora_gotty/README.md new file mode 100644 index 0000000000..2e261c2e53 --- /dev/null +++ b/extras/pandora_gotty/README.md @@ -0,0 +1 @@ +To create the .deb and .rpm package need to hace docker installed on main system and execit `build_all_docker.sh` \ No newline at end of file diff --git a/extras/pandora_gotty/build_all_docker.sh b/extras/pandora_gotty/build_all_docker.sh index e4da1a7558..cb280999ba 100755 --- a/extras/pandora_gotty/build_all_docker.sh +++ b/extras/pandora_gotty/build_all_docker.sh @@ -1,3 +1,11 @@ #Build RPM -docker build -t pandora_gotty_builder -f Dockerfile-RPM . -docker run --rm -it -v `pwd`:/root/pandora_gotty pandora_gotty_builder /root/pandora_gotty/build_rpm.sh \ No newline at end of file +docker build -t pandora_gotty_builder_rpm -f Dockerfile-RPM . || exit 1 +docker run --rm -it -v `pwd`:/root/pandora_gotty pandora_gotty_builder_rpm /root/pandora_gotty/build_rpm.sh || exit 1 + +#Buikd DEB +docker build -t pandora_gotty_builder_deb -f Dockerfile-deb . || exit 1 +docker run --rm -it -v `pwd`:/root/pandora_gotty pandora_gotty_builder_deb /root/pandora_gotty/build_deb.sh || exit 1 + +echo " - Done" +pwd +ls -l | grep -E "(\.deb|\.rpm)" \ No newline at end of file diff --git a/extras/pandora_gotty/build_deb.sh b/extras/pandora_gotty/build_deb.sh new file mode 100755 index 0000000000..483ab35076 --- /dev/null +++ b/extras/pandora_gotty/build_deb.sh @@ -0,0 +1,15 @@ +#!/bin/bash +#DEB +cd deb +VERSION=$(grep 'Version:' pandora_gotty/DEBIAN/control | awk '{print $2}') +mkdir -p pandora_gotty/usr/bin +mkdir -p pandora_gotty/etc/pandora_gotty +cp -a ../src/pandora_gotty pandora_gotty/usr/bin +cp -a ../src/pandora_gotty.conf pandora_gotty/etc/pandora_gotty +dpkg-deb --build pandora_gotty +mv pandora_gotty.deb ../ +rm -rf pandora_gotty/usr/ +rm -rf pandora_gotty/etc/ +cd .. +mv pandora_gotty.deb pandora_gotty_${VERSION}.deb +chmod 777 pandora_gotty_${VERSION}.deb diff --git a/extras/pandora_gotty/build_rpm.sh b/extras/pandora_gotty/build_rpm.sh index f257f6ae57..64a43fa099 100755 --- a/extras/pandora_gotty/build_rpm.sh +++ b/extras/pandora_gotty/build_rpm.sh @@ -9,5 +9,4 @@ rm -rf ${HOME}/rpmbuild/RPMS/x86_64/pandora_gotty* rpmbuild -ba pandora_gotty.spec rm -rf pandora_gotty-${VERSION} mv ${HOME}/rpmbuild/RPMS/x86_64/pandora_gotty* . - -#DEB \ No newline at end of file +chmod 777 *.rpm \ No newline at end of file diff --git a/extras/pandora_gotty/deb/.gitignore b/extras/pandora_gotty/deb/.gitignore new file mode 100644 index 0000000000..92a9f94179 --- /dev/null +++ b/extras/pandora_gotty/deb/.gitignore @@ -0,0 +1,3 @@ +*.deb +**/usr +**/etc diff --git a/extras/pandora_gotty/deb/pandora_gotty/DEBIAN/changelog b/extras/pandora_gotty/deb/pandora_gotty/DEBIAN/changelog new file mode 100644 index 0000000000..5d7e7f2ab6 --- /dev/null +++ b/extras/pandora_gotty/deb/pandora_gotty/DEBIAN/changelog @@ -0,0 +1,5 @@ +pandora_gotty (1.0-1) stable; urgency=low + + * Initial release. + + -- PandoraFMS Mon, 18 Sep 2023 00:00:00 +0000 \ No newline at end of file diff --git a/extras/pandora_gotty/deb/pandora_gotty/DEBIAN/control b/extras/pandora_gotty/deb/pandora_gotty/DEBIAN/control new file mode 100644 index 0000000000..f715ee1b49 --- /dev/null +++ b/extras/pandora_gotty/deb/pandora_gotty/DEBIAN/control @@ -0,0 +1,9 @@ +Source: pandora_gotty +Section: utils +Version: 1.0.0 +Priority: optional +Maintainer: PandoraFMS +Build-Depends: debhelper (>= 12) +Package: pandora-gotty +Architecture: amd64 +Description: pandora_gotty for Pandora FMS.