DanielOgorchock / joycond

userspace daemon to combine joy-cons from the hid-nintendo kernel driver
GNU General Public License v3.0
338 stars 68 forks source link

Install joycond.service to /usr/lib/systemd/system instead of /etc/systemd/system #97

Closed ghost closed 2 years ago

ghost commented 2 years ago

This is the standard location for systemd service files. I initially posted a comment about this on the AUR package but the maintainer told me to get it fixed upstream instead.

Fixes #96

Tatsh commented 2 years ago

This should be /lib/systemd/system.

ghost commented 2 years ago

This should be /lib/systemd/system.

/lib is almost always a symlink to /usr/lib, so installing to /usr/lib/systemd/system is correct.

ghost commented 2 years ago

I also modified this PR to install the udev rule and the modules-load file to the correct locations in /usr/lib as well.

chewi commented 2 years ago

Almost always. That's not the default in Gentoo and some other distributions. I would go with /lib. I can see from my system that practically everything installs there.

Tatsh commented 2 years ago

I can see why you say so @Ta180m . It is true that /lib is considered to be a legacy symlink according to to file-hierarchy(7). For right now, Gentoo does not fully follow this standard.

Tatsh commented 2 years ago

Would you consider making this PR query for the path instead of hard-coding? You can call systemd-path systemd-system-unit to get the path for the unit with execute_process(COMMAND systemd-path systemd-system-unit OUTPUT_VARIABLE SYSTEMD_SYSTEM_UNIT_PATH) then use ${SYSTEMD_SYSTEM_UNIT_PATH}.

Tatsh commented 2 years ago

You can do the same for modules-load.d with systemd-path modules-load.

Tatsh commented 2 years ago

For udev this should work: pkg-config --variable=udevdir udev then add rules.d/ to the end. If this command fails, fallback to /usr/lib/udev.

infirit commented 2 years ago

Here is what we use in blueman https://github.com/blueman-project/blueman/blob/main/configure.ac#L213 (I know this is cmake but you get what is intended)

Tatsh commented 2 years ago

One last thing: you should fallback if execute_process() fails. You can check the RESULT_VARIABLE <name> value (integer).

chewi commented 2 years ago

Thanks for making this dynamic, but there's a much better way. pkg_get_variable! I think this will respect the PKG_CONFIG environment variable too, which is good for Gentoo.