Adding a group to /etc/group during package installation

I have a package that needs to add a group to /etc/group during installation (and remove the line when the package is uninstalled).

Similarly, it needs to add an option to sysctl.conf and remove it when the package is uninstalled.

Is there a set of functions to facilitate this in the build system?

Is there a better way of accomplishing this other than manually grepping the file for existence of the line and catting the data into it?

For sysctl it is simple: Add a file in /etc/sysctl.d/ with <name>.conf

The group can be defined by adding a "USERID" in your package (use git grep to find examples). The rest should be handled automatically already.

1 Like