mirror of
https://github.com/optim-enterprises-bv/nDPId.git
synced 2025-11-01 18:57:48 +00:00
CMake/RPM integration
* CI integration * RPM (un)install scripts Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
45
.github/workflows/build-rpm.yml
vendored
Normal file
45
.github/workflows/build-rpm.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
name: RPM Build
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# At the end of every day
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- tmp
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Ubuntu Prerequisites
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install fakeroot alien autoconf automake cmake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev zlib1g-dev libcurl4-openssl-dev libdbus-1-dev
|
||||||
|
|
||||||
|
- name: Build RPM package
|
||||||
|
run: |
|
||||||
|
cmake -S . -B build-rpm -DBUILD_EXAMPLES=ON -DBUILD_NDPI=ON -DCMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build build-rpm --parallel
|
||||||
|
cd build-rpm
|
||||||
|
cpack -G RPM
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Convert/Install RPM package
|
||||||
|
run: |
|
||||||
|
fakeroot alien --scripts --to-deb --verbose ./build-rpm/nDPId-*.rpm
|
||||||
|
sudo dpkg -i ./ndpid_*.deb
|
||||||
|
|
||||||
|
- name: Upload RPM
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: nDPId-rpm-packages
|
||||||
|
path: build-rpm/*.rpm
|
||||||
@@ -29,6 +29,13 @@ set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/packages/debian/prei
|
|||||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
|
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
|
||||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||||
set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON)
|
set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON)
|
||||||
|
set(CPACK_RPM_PACKAGE_LICENSE "GPL-3")
|
||||||
|
set(CPACK_RPM_PACKAGE_VENDOR "Toni Uhlig")
|
||||||
|
set(CPACK_RPM_PACKAGE_URL "https://www.github.com/utoni/nDPId.git")
|
||||||
|
set(CPACK_RPM_PACKAGE_DESCRIPTION "nDPId is a set of daemons and tools to capture, process and classify network traffic.")
|
||||||
|
set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/packages/redhat/pre_install")
|
||||||
|
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/packages/redhat/pre_uninstall")
|
||||||
|
set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/packages/redhat/post_uninstall")
|
||||||
set(CPACK_STRIP_FILES ON)
|
set(CPACK_STRIP_FILES ON)
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR 1)
|
set(CPACK_PACKAGE_VERSION_MAJOR 1)
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR 7)
|
set(CPACK_PACKAGE_VERSION_MINOR 7)
|
||||||
|
|||||||
8
packages/redhat/post_uninstall
Normal file
8
packages/redhat/post_uninstall
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ $1 == 0 ]; then
|
||||||
|
rm -rf /run/nDPId /run/nDPIsrvd
|
||||||
|
userdel ndpid || true
|
||||||
|
userdel ndpisrvd || true
|
||||||
|
groupdel ndpisrvd-distributor || true
|
||||||
|
fi
|
||||||
19
packages/redhat/pre_install
Normal file
19
packages/redhat/pre_install
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ $1 == 1 ]; then
|
||||||
|
groupadd --system ndpisrvd-distributor
|
||||||
|
adduser --system --no-create-home --shell=/bin/false --user-group ndpisrvd
|
||||||
|
adduser --system --no-create-home --shell=/bin/false --user-group ndpid
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
****************************************************************************
|
||||||
|
* The user whom may want to access DPI data needs access to: *
|
||||||
|
* /run/nDPIsrvd/distributor *
|
||||||
|
* *
|
||||||
|
* To make it accessible to [USER], type: *
|
||||||
|
* sudo usermod --append --groups ndpisrvd-distributor [USER] *
|
||||||
|
* *
|
||||||
|
* Please note that you might need to re-login to make changes take effect. *
|
||||||
|
****************************************************************************
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
5
packages/redhat/pre_uninstall
Normal file
5
packages/redhat/pre_uninstall
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ $1 == 0 ]; then
|
||||||
|
systemctl stop ndpisrvd.service
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user