You are not logged in.

#1 2021-09-30 16:31:53

Registered: 2009-11-28
Posts: 27

Patching /etc/somefile from another package, best practices?

I writing now a package for a custom engine for openssl.
Say it is named like openssl-coolengine-git
During installation I need to patch openssl.cnf to make that engine to work.
And I see, that the simplest way for user is to patch /etc/ssl/openssl.cnf just during installation.

I consider to use one of those three options:

1. Copying /etc/ssl/openssl.cnf to package dir and patch it
2. Patching /etc/ssl/openssl.cnf during call of the package() function
3. Just echoing warning to user and placing example into /usr/lib/coolengine/

What you think, which is the better?


#2 2021-09-30 16:38:19

Inspector Parrot
Registered: 2011-11-29
Posts: 26,895

Re: Patching /etc/somefile from another package, best practices?

You most definitely should not modify files owned by other packages during the installation of your package.  That should be grounds for removal from the AUR ... if not that, at least grounds for flaming bags full of dog poop to show up on your doorstep.  Don't do it.

You also definitely shouldn't try to do numbers #1 or #2 as they would fail anyways when the package is build in a clean chroot - and if they don't fail, they'll get / modify the file from the build machine which is not necessarily the same as the machine the package is to be installed on.

Option #3 is reasonable.

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman


#3 2021-09-30 21:28:55

Registered: 2014-03-06
Posts: 14,904

Re: Patching /etc/somefile from another package, best practices?

You missed options 4 and 5 which are equally as horrible as 1 and 2 but do actually work

4 Patch it in the install file or in the horrible example just overwrite the file … ils-git#n5
5 Use a hook ensuring your changes will be rewritten whenever the package providing the config is updated … s-git#n223
ssl.conf supports an include directive that can be used to include all ".cnf" or ".conf" files in a specified directory.  You could ask for such an entry to be added to /etc/ssl/openssl.cnf

Last edited by loqs (2021-09-30 22:14:55)


Board footer

Powered by FluxBB