netblue30 / fdns

Firejail DNS-over-HTTPS Proxy Server
GNU General Public License v3.0
115 stars 29 forks source link

make fedora patches superfluous #48

Closed rusty-snake closed 3 years ago

rusty-snake commented 3 years ago

ATM I've two patches for fedora in https://github.com/netblue30/fdns/tree/master/platform/fedora.

disable-apparmor.patch

This one removes the install command from the Makefile which installs the AA profiles. This could simply make superfluous by a ./configure --disable-apparmor (but I lack the autotools skills :sob: ).

install-units-to-unitdir.patch

(on x86_64) Fedora uses /usr/lib for architecture independent stuff (e.g. internal config-files) and /usr/lib64 for architecture specific stuff (e.g. shared-objects). So libdir is /usr/lib64, but unitdir (the place where systemd-units are expected) is /usr/lib/systemd

netblue30 commented 3 years ago

The first one is in, I'll look at the second one.

netblue30 commented 3 years ago

What if we install the unit file in /etc/systemd/system directory? This should work on any distro.

rusty-snake commented 3 years ago

Technically it would work, but it wouldn't follow the guidelines.

https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Unit%20File%20Load%20Path

netblue30 commented 3 years ago

Yes, is not such a good idea to mess up /etc/systemd/system. Let's go with this:

$ cat configure.ac
[...]
# Config options for various distros:
#    - Debian: ./configure --prefix=/usr --enable-apparmor --with-systemd=/lib/systemd/system
#    - Fedora: ./configure --prefix=/usr --with-systemd=/usr/lib/systemd
#    - Arch:./configure --prefix=/usr --enable-apparmor --with-systemd=/usr/lib/systemd/system
#
# Run "pkg-config systemd --variable=systemdsystemunitdir" to find out where systemd unit
# files are stored on your system.
[...]
rusty-snake commented 3 years ago

Great. One correction: With "unitdir (the place where systemd-units are expected) is /usr/lib/systemd" my focus was on that it is not $(libdir)/systemd and I stripped the last part because there are units on other subdirs too. But Fedora uses /usr/lib/systemd/system for system service units too.

Run "pkg-config systemd --variable=systemdsystemunitdir" to find out where systemd unit files are stored on your system.

Wouldn't it make sense to query pkg-config in the Makefile or in configure?

netblue30 commented 3 years ago

Fixed:

- Fedora: ./configure --prefix=/usr --with-systemd=/usr/lib/systemd/system

in configure.ac

pkg-config works only for the case when you ./configure --prefix=/usr.