fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

CPACK: add auto generated dbhelper maintainer scripts

Open shaerpour opened this issue 1 year ago • 11 comments

Description

This PR is completed version of #8330 that is closed. In Debian packages, we have maintainer scripts with (prerm, preinst, postrm and postinst) extensions that will run before or after extracting and installing package. They will do important tasks like adding user or creating directories for main app to run correctly.

Issues

The issue with fluent-bit deb packages is that it does not have this scripts so if someone activates and enables fluent-bit, after purging or removing package the OS still shows package is running and it can make issues during boot, etc.

Solution

In this branch, I added prerm, postinst and postrm scripts for resolving issue. Scripts are built with debhelper collection and customized some parts for better performance.

I already built and installed packages for ubuntu/20.04, debian/bullseye and debian/bookworm and they work totally fine.

Troubles

As mentioned, debhelper is a collection of tools for building deb packages. It creates different parts like maintainer scripts, systemd services and etc. But the main problem was to match CPACK with it! They are different platforms for making deb packages and doing their own work so I couldn't connect them. I used CPackDebHelper inside fluent-bit codes but it just conflicts in many parts. At the end, I just built scripts with it and added statically in cpack/debian directory to be copied and used by systemd.

shaerpour avatar Jan 02 '24 08:01 shaerpour

CI has failed:

NMAKE : fatal error U1052: file 'Makefile' not found
Stop.
Test project C:/projects/fluent-bit-2e87g/build
No tests were found!!!

aminvakil avatar Jan 02 '24 09:01 aminvakil

Is there any impact on the RPM packages and/or should we be doing the same? It sounds like some kind of dirty state is left so it probably needs fixing for RPMs as well, which have an identical mechanism.

patrick-stephens avatar Jan 08 '24 11:01 patrick-stephens

Is there any impact on the RPM packages and/or should we be doing the same? It sounds like some kind of dirty state is left so it probably needs fixing for RPMs as well, which have an identical mechanism.

I'm working on that but it needs more research, so it can take some time for building and deploying scripts. I will send another PR for them in the close future but it would be great if we fix debian packages sooner. @patrick-stephens

shaerpour avatar Jan 09 '24 05:01 shaerpour

I'd suggest merging this PR if it fixes the package for deb users and let another rpm users send another PR, as we (me and @ahspw) do not have that much experience in rpm-based distros and it would be much better if someone with expertise and motivation in that scope creates a new PR about that.

aminvakil avatar Jan 09 '24 09:01 aminvakil

I think the commits have gone a bit wonky rather than be rebased

patrick-stephens avatar Jan 16 '24 11:01 patrick-stephens

I think the commits have gone a bit wonky rather than be rebased

Yes that was a mistake, I just fixed them

shaerpour avatar Jan 16 '24 14:01 shaerpour

Should I do anything for windows build action issue?

shaerpour avatar Jan 16 '24 14:01 shaerpour

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar May 21 '24 01:05 github-actions[bot]

@shaerpour Please tell me if you do not have time for this and want me to take over this PR.

Although this PR is good to go AFAICS and needs a maintainer attention.

aminvakil avatar May 21 '24 12:05 aminvakil