You are not logged in.

#1 2018-09-07 09:11:10

ericdestefano
Member
Registered: 2018-09-07
Posts: 2

PKGBUILD and sysctl

Greetings,

I am currently working on an AUR package, and after the package is installed correctly, I need to execute sysctl to modify a setting on the system.

My first question is, is this even a good idea?  Or ask the user with an echo to run the sysctl command themselves?

If it is cool with AUR, what would be the approved method to drop a file in /etc/sysctl.d/99-namehere.conf and activate it after the package is installed?

Thanks in advance

Offline

#2 2018-09-07 13:24:42

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: PKGBUILD and sysctl

ericdestefano wrote:

My first question is, is this even a good idea?  Or ask the user with an echo to run the sysctl command themselves?

No to the first, yes to the second as a reasonable option, but ...

ericdestefano wrote:

what would be the approved method to drop a file in /etc/sysctl.d/99-namehere.conf

You don't.  You install it to /usr/lib/sysctl.d/ and use a post install message to instruct the user to copy/link that to /etc/sysctl.d/.

EDIT: perhaps not.  I suspected /usr/lib/sysctl.d was a staging place for bits that could be 'activated' by placing them in /etc/, but it seems they are read too.  So my suggestion would be to just echo a message telling a user to create such a file.  Though this may depend to a degree on exactly what the setting is.  If the setting is absolutely essential for your packaged software to work at all and it will not have *any* other side effects, then perhaps you could just package the file for the setting.

Last edited by Trilby (2018-09-07 14:27:00)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2018-09-08 17:40:23

ericdestefano
Member
Registered: 2018-09-07
Posts: 2

Re: PKGBUILD and sysctl

Sounds good.  Thank you so much for the prompt reply, it was a big a help.

Offline

#4 2018-09-09 08:19:09

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD and sysctl

Note also, that the systemd package provides a pacman hook /usr/share/libalpm/hooks/systemd-sysctl.hook

So sysctl settings will be automatically updated, by default.

Note that I make no claims to the advisability (or not) of setting any sysctl in the first place. I merely point out that if you do use one, there's no need to do anything or message the user in the post-install, in order to apply it.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB