From: Remi Gacogne Date: Mon, 22 Apr 2024 09:28:52 +0000 (+0200) Subject: rec: Change home directory to /var/lib/pdns-recursor on EL-based OSs X-Git-Tag: rec-5.1.0-alpha1~35^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a90ab135bcf7bd134d38374c50f36fa256d6f5b6;p=thirdparty%2Fpdns.git rec: Change home directory to /var/lib/pdns-recursor on EL-based OSs --- diff --git a/builder-support/specs/pdns-recursor.spec b/builder-support/specs/pdns-recursor.spec index df4b6b9682..227121ab26 100644 --- a/builder-support/specs/pdns-recursor.spec +++ b/builder-support/specs/pdns-recursor.spec @@ -91,6 +91,8 @@ sed -i \ -e 's!# include-dir=.*!&\ninclude-dir=%{_sysconfdir}/%{name}/recursor.d!' \ %{buildroot}%{_sysconfdir}/%{name}/recursor.conf +%{__install } -d %{buildroot}/%{_sharedstatedir}/%{name} + # The EL7 and 8 systemd actually supports %t, but its version number is older than that, so we do use seperate runtime dirs, but don't rely on RUNTIME_DIRECTORY %if 0%{?rhel} < 9 sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor!' -i %{buildroot}/%{_unitdir}/pdns-recursor.service @@ -102,8 +104,12 @@ sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor-%i!' -e 's!RuntimeDirec %pre getent group pdns-recursor > /dev/null || groupadd -r pdns-recursor getent passwd pdns-recursor > /dev/null || \ - useradd -r -g pdns-recursor -d / -s /sbin/nologin \ + useradd -r -g pdns-recursor -d /var/lib/pdns-recursor -s /sbin/nologin \ -c "PowerDNS Recursor user" pdns-recursor +# Change home directory to /var/lib/pdns +if [[ $(getent passwd pdns-recursor | cut -d: -f6) == "/" ]]; then + usermod -d /var/lib/pdns-recursor pdns-recursor +fi exit 0 %post @@ -127,4 +133,5 @@ systemctl daemon-reload ||: %dir %{_sysconfdir}/%{name}/recursor.d %config(noreplace) %{_sysconfdir}/%{name}/recursor.conf %config %{_sysconfdir}/%{name}/recursor.yml-dist +%dir %attr(-,pdns-recursor,pdns-recursor) %{_sharedstatedir}/%{name} %doc README