From: Morten Stevens Date: Thu, 8 Feb 2024 15:02:40 +0000 (+0100) Subject: Change home directory to /var/lib/pdns X-Git-Tag: rec-5.1.0-alpha1~39^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fac31e7640c8bfe1df9138ea71c72a4b7d152cd3;p=thirdparty%2Fpdns.git Change home directory to /var/lib/pdns Check: https://bugzilla.redhat.com/show_bug.cgi?id=2262487 --- diff --git a/builder-support/specs/pdns.spec b/builder-support/specs/pdns.spec index 9f265eda1d..8d69fec37b 100644 --- a/builder-support/specs/pdns.spec +++ b/builder-support/specs/pdns.spec @@ -242,6 +242,8 @@ chmod 600 %{buildroot}%{_sysconfdir}/%{name}/pdns.conf %{__mv} %{buildroot}/%{_bindir}/zone2ldap %{buildroot}/%{_bindir}/pdns-zone2ldap %{__mv} %{buildroot}/%{_mandir}/man1/zone2ldap.1 %{buildroot}/%{_mandir}/man1/pdns-zone2ldap.1 +%{__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_server!& --socket-dir=%t/pdns!' -i %{buildroot}/%{_unitdir}/pdns.service @@ -252,12 +254,16 @@ sed -e 's!/pdns_server!& --socket-dir=%t/pdns-%i!' -e 's!RuntimeDirectory=pdns!& %check PDNS_TEST_NO_IPV6=1 make %{?_smp_mflags} -C pdns check || (cat pdns/test-suite.log && false) - + %pre getent group pdns >/dev/null || groupadd -r pdns getent passwd pdns >/dev/null || \ - useradd -r -g pdns -d / -s /sbin/nologin \ - -c "PowerDNS user" pdns + useradd -r -g pdns -d /var/lib/pdns -s /sbin/nologin \ + -c "PowerDNS Authoritative Server" pdns +# Change home directory to /var/lib/pdns +if [[ $(getent passwd pdns | cut -d: -f6) == "/" ]]; then + usermod -d /var/lib/pdns pdns +fi exit 0 %if 0%{?rhel} >= 7 @@ -284,6 +290,7 @@ systemctl daemon-reload ||: %doc pdns/bind-dnssec.4.2.0_to_4.3.0_schema.sqlite3.sql pdns/bind-dnssec.schema.sqlite3.sql %config(noreplace) %{_sysconfdir}/%{name}/pdns.conf %dir %{_libdir}/%{name}/ +%dir %attr(-,pdns,pdns) %{_sharedstatedir}/%{name} %{_bindir}/pdns-zone2ldap %{_bindir}/pdns_control %{_bindir}/pdnsutil