You are not logged in.

#1 2024-06-07 03:31:44

spacekobold
Member
Registered: 2022-11-19
Posts: 14

PKGBUILD for program that expects config files under user $HOME

I'm trying to write a PKGBUILD for https://github.com/mckset/KD100, however this program expects its default config file to live in the user's $HOME directory, specifically $HOME/.config/KD100/default.cfg. Trying to research how to install the provided config file into a user's home directory only turned up results explaining how bad of an idea it is to touch anything in $HOME from a PKGBUILD, not to mention that it's not really accessible. How should this be handled? Storing config files in $HOME doesn't seem to be that big of a sin, and plenty of configuration files already live there. Presumably if other programs do it there is a sanctioned way of getting configuration files into a user's $HOME directory after an install?

Offline

#2 2024-06-07 03:41:21

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

Re: PKGBUILD for program that expects config files under user $HOME

User config files do belong under ~/.config/ but this location is never packaged.  If the program can use a system config it can be installed to /etc, or you can install the config under /usr/share/KD100/ and individual users can move it if they want to use it.

Does the program not actually work at all if there is no config under ~/.config/KD100? That'd be really bad practice for the upstream code - so much so that I highly doubt that this is the case.

EDIT: if no config file is present, the program will exit with a warning instructing the user to put the config file in ~/.config/KD100/ so you're all set.  Just include the default config somewhere in the package, I'd recommend /usr/share/KD100/default.cfg.

Last edited by Trilby (2024-06-07 03:47:49)


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

Offline

#3 2024-06-07 03:41:31

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

Re: PKGBUILD for program that expects config files under user $HOME

When programs need a config in a user's home dir, they need to do it themselves at runtime. There is absolutely no way for a package to do this. If the program really requires that, your only real option would be a wrapper script that checks for it and copies it if missing before launching the program.

Offline

#4 2024-06-07 04:52:39

Awebb
Member
Registered: 2010-05-06
Posts: 6,598

Re: PKGBUILD for program that expects config files under user $HOME

It's on Github and the project has zero open issues. How about a bug report requesting proper config handling? Fork and fix it yourself and request a merge?

You could also output a note regarding the config file at the end of the installation.

Offline

#5 2024-06-07 12:06:59

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

Re: PKGBUILD for program that expects config files under user $HOME

That could be good, though if you take even a momentary glance at the code, there are far more important things to fix.  It's only around 500 lines of code so it's not so complex to be hard to fix up - but it's doing the work of about 20 lines of code, so the best fix would be to start completely from scratch.

Last edited by Trilby (2024-06-07 12:09:05)


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

Offline

Board footer

Powered by FluxBB