You are not logged in.

#1 2020-12-11 14:56:25

ryan_greenblatt
Member
Registered: 2020-09-22
Posts: 5

Ensure package "owns" file

What can I add to the PKGBUILD to assume ownership of a file which is installed by the package after the install process?

Specifically, the openpyn (https://aur.archlinux.org/packages/openpyn-nordvpn/) package will install /etc/systemd/system/openpyn.service, but not as part of the normal installation process.
It does so when the end user runs openpyn --init. However, I think the package should still own the file and the package should remove the file on uninstall.

Last edited by ryan_greenblatt (2020-12-11 14:57:06)

Offline

#2 2020-12-11 15:04:50

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,170

Re: Ensure package "owns" file

There's no way to adopt a file, afaik. If it's packaged, it should also be in /usr/lib/systemd/, not /etc/systemd/, so the whole situation is no good. sad

Online

#3 2020-12-11 15:54:50

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

Re: Ensure package "owns" file

ryan_greenblatt wrote:

Specifically, the openpyn (https://aur.archlinux.org/packages/openpyn-nordvpn/) package will install /etc/systemd/system/openpyn.service, but not as part of the normal installation process.
It does so when the end user runs openpyn --init. However, I think the package should still own the file and the package should remove the file on uninstall.

Create the file in package() and if the user needs to edit it, it should be edited as a drop-in file (e.g. systemctl edit).

Consider submitting a pull request to upstream to do this properly.


Consider also fixing stupidities like WorkingDirectory= being the directory in which the python module is installed to site-packages.


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

Offline

#4 2020-12-11 16:12:00

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

Re: Ensure package "owns" file

eschwartz, have you looked at upstream's code?  Perhaps they could patch it to write only to a drop-in file, but it seems that a vast majority (if not all) of that python code is just an elaborate script for generating and editing a service file.

It seems the premise is the edits the user would need to make (to a drop-in) are complex enough that this tool exists to generate the content.  So user's of this tool would not be using `systemctl edit` to modify the drop-in anyways.  Unless of course they did that and just copy-pastaed the content this tool generates.


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

Offline

#5 2020-12-11 16:42:56

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

Re: Ensure package "owns" file

Well, the nice thing about systemctl edit is it tells you how the drop-in works. big_smile The tool would be better suited to generating override.conf itself.

Based on https://github.com/jotyGill/openpyn-nor … emd.py#L35 I presume the only actually complex bit is the ExecStart... which is invoking the openpyn program itself. This could likely even be handled via an EnvironmentFile with OPTIONS=... and requiring no modification to the service file (which merely invokes `ExecStart=/usr/bin/openpyn $OPTIONS`)


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

Offline

Board footer

Powered by FluxBB