diff --git a/.gitignore b/.gitignore index cae593d..421da28 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,2 @@ -ddclient-3.8.0.tar.bz2 /ddclient-3.8.1.tar.bz2 -/ddclient-3.8.2.tar.bz2 /ddclient-3.8.3.tar.bz2 -/ddclient-3.9.0.tar.gz -/ddclient-3.9.1.tar.gz -/ddclient-3.10.0.tar.gz -/ddclient-3.11.1.tar.gz -/ddclient-3.11.2.tar.gz -/ddclient-4.0.0.tar.gz diff --git a/ddclient-tmpfiles.conf b/ddclient-tmpfiles.conf index 6eed278..881d82f 100644 --- a/ddclient-tmpfiles.conf +++ b/ddclient-tmpfiles.conf @@ -1 +1 @@ -d /run/ddclient 0755 ddclient ddclient - +d /var/run/ddclient 0755 ddclient ddclient - diff --git a/ddclient.NetworkManager b/ddclient.NetworkManager index fe7c614..df7abf5 100644 --- a/ddclient.NetworkManager +++ b/ddclient.NetworkManager @@ -4,12 +4,12 @@ export LC_ALL=C if [ "$2" = "down" ]; then /sbin/ip route ls | grep -q '^default' || { - [ -f /run/ddclient/ddclient.pid ] && /usr/bin/systemctl stop ddclient.service || : + [ -f /var/lock/subsys/ddclient ] && /sbin/service ddclient stop || : } && { :; } fi if [ "$2" = "up" ]; then /sbin/ip -o route show dev "$1" | grep -q '^default' && { - /usr/bin/systemctl is-enabled ddclient >/dev/null && /usr/bin/systemctl start ddclient.service || : + /sbin/chkconfig ddclient && /sbin/service ddclient start || : } || { :; } fi diff --git a/ddclient.initscript b/ddclient.initscript new file mode 100755 index 0000000..1271d2c --- /dev/null +++ b/ddclient.initscript @@ -0,0 +1,92 @@ +#!/bin/bash +# +# ddclient Client to update dynamic DNS host entries +# +# chkconfig: - 65 35 +# description: ddclient is a Perl client used to update dynamic DNS \ +# entries for accounts on many dynamic DNS services. +# processname: /usr/sbin/ddclient +# config: /etc/ddclient.conf +# pidfile: /var/run/ddclient/ddclient.pid + +### BEGIN INIT INFO +# Provides: ddclient +# Required-Start: $local_fs $network $syslog +# Required-Stop: $local_fs $network $syslog +# Should-Start: $named +# Should-Stop: $named +# Short-Description: Client to update dynamic DNS host entries +# Description: ddclient is a Perl client used to update dynamic DNS +# entries for accounts on many dynamic DNS services. +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +if [ -f /etc/sysconfig/ddclient ]; then + . /etc/sysconfig/ddclient +fi + +exec=/usr/sbin/ddclient +prog=`basename $exec` +lockfile=/var/lock/subsys/$prog +cache=/var/cache/ddclient/ddclient.cache +pid=/var/run/ddclient/ddclient.pid +RETVAL=0 + +start() { + # Check that networking is up. + [ ! -f /var/lock/subsys/network -a ! -f /var/lock/subsys/NetworkManager ] && exit 0 + + echo -n $"Starting $prog: " + [ -f $cache ] || touch $cache + chown ddclient:ddclient $cache && chmod 600 $cache || exit $? + daemon --user=ddclient --pidfile=$pid $exec $DDCLIENT_OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $lockfile + + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + killproc -p $pid $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $lockfile + + return $RETVAL +} + +restart() { + stop + start +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p $pid $prog + ;; + restart|force-reload|reload) + restart + ;; + condrestart|try-restart) + if [ -f $lockfile ]; then + restart + fi + ;; + *) + echo $"Usage: $0 {start|stop|status|reload|restart|condrestart|force-reload|try-restart}" + RETVAL=1 + ;; +esac + +exit $RETVAL diff --git a/ddclient.service b/ddclient.service index 0ccec5a..3bdd806 100644 --- a/ddclient.service +++ b/ddclient.service @@ -1,14 +1,15 @@ [Unit] -Description=Dynamic DNS Update Client -After=syslog.target network-online.target nss-lookup.target +Description=A Perl Client Used To Update Dynamic DNS +After=syslog.target network.target nss-lookup.target [Service] User=ddclient Group=ddclient -Type=exec +Type=forking +PIDFile=/var/run/ddclient/ddclient.pid EnvironmentFile=-/etc/sysconfig/ddclient ExecStartPre=/bin/touch /var/cache/ddclient/ddclient.cache -ExecStart=/usr/sbin/ddclient $DDCLIENT_OPTIONS --foreground +ExecStart=/usr/sbin/ddclient $DDCLIENT_OPTIONS [Install] WantedBy=multi-user.target diff --git a/ddclient.spec b/ddclient.spec index e64e7d9..0a6e520 100644 --- a/ddclient.spec +++ b/ddclient.spec @@ -1,54 +1,34 @@ -%global cachedir %{_localstatedir}/cache/ddclient -%global rundir %{_rundir}/ddclient +# This macro only defined by default around Fedora 18 time +%{!?_tmpfilesdir:%global _tmpfilesdir %{_prefix}/lib/tmpfiles.d} Summary: Client to update dynamic DNS host entries Name: ddclient -Version: 4.0.0 -Release: 5%{?dist} -# Automatically converted from old format: GPLv2+ - review is highly recommended. -License: GPL-2.0-or-later -URL: https://ddclient.net/ -Source0: https://github.com/%{name}/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Version: 3.8.3 +Release: 1%{?dist} +License: GPLv2+ +Group: System Environment/Daemons +URL: http://ddclient.sourceforge.net/ +Source0: http://downloads.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.bz2 Source1: ddclient.rwtab Source2: ddclient.service Source3: ddclient.sysconfig Source4: ddclient.NetworkManager Source5: ddclient-tmpfiles.conf - +Source6: ddclient.initscript BuildArch: noarch - -BuildRequires: autoconf -BuildRequires: automake -BuildRequires: make -BuildRequires: perl-generators -BuildRequires: perl(Sys::Hostname) -BuildRequires: perl(version) -BuildRequires: systemd -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd - -# For tests -BuildRequires: iproute -BuildRequires: perl(HTTP::Daemon) -BuildRequires: perl(HTTP::Daemon::SSL) -BuildRequires: perl(HTTP::Message::PSGI) -BuildRequires: perl(HTTP::Request) -BuildRequires: perl(HTTP::Response) -BuildRequires: perl(IO::Socket::INET6) -BuildRequires: perl(Test::MockModule) -BuildRequires: perl(Test::TCP) -BuildRequires: perl(Test::Warnings) -BuildRequires: perl(Time::HiRes) - -Requires: perl(Data::Validate::IP) -Requires: perl(Digest::SHA1) -Requires: perl(IO::Socket::INET6) -Requires: perl(IO::Socket::SSL) -Requires: perl(JSON::PP) - -# Old NetworkManager expects the dispatcher scripts in a different place -Conflicts: NetworkManager < 1.20 +Requires(pre): shadow-utils +%if 0%{?fedora} > 14 || 0%{?rhel} > 6 +BuildRequires: systemd-units +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units +%else +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/service, /sbin/chkconfig +Requires(postun): /sbin/service +%endif +Requires: perl(Digest::SHA1), perl(IO::Socket::SSL) +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description ddclient is a Perl client used to update dynamic DNS entries for accounts @@ -58,206 +38,143 @@ updates for multiple addresses, MX, wildcards, abuse avoidance, retrying the failed updates and sending update status to syslog and through e-mail. %prep -%autosetup -p 1 +%setup -q +# Move pid file location for running as non-root. +sed -e 's|/var/run/ddclient.pid|%{_localstatedir}/run/%{name}/%{name}.pid|' -i sample-etc_ddclient.conf + # Send less mail by default, eg. not on every shutdown. -sed -e 's|^mail=|#mail=|' -i ddclient.conf.in -./autogen +sed -e 's|^mail=|#mail=|' -i sample-etc_ddclient.conf -# Create a sysusers.d config file -cat >ddclient.sysusers.conf < 14 || 0%{?rhel} > 6 +install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service +install -D -p -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_tmpfilesdir}/%{name}.conf +%else +install -D -p -m 755 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/%{name} +%endif +install -D -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} +%if 0%{?fedora}%{?rhel} > 4 +install -D -p -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/50-%{name} +%endif +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/{cache,run}/%{name} +touch $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name}/%{name}.cache # Correct permissions for later usage in %doc chmod 644 sample-* -install -m0644 -D ddclient.sysusers.conf %{buildroot}%{_sysusersdir}/ddclient.conf - - -%check -make VERBOSE=1 check - +%clean +rm -rf $RPM_BUILD_ROOT +%pre +getent group %{name} > /dev/null || %{_sbindir}/groupadd -r %{name} +getent passwd %{name} > /dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_localstatedir}/cache/%{name} -s /sbin/nologin -c "Dynamic DNS Client" %{name} +exit 0 %post -%systemd_post %{name}.service -if [ $1 == 1 ]; then - mkdir -p %{rundir} - chown %{name}:%{name} %{rundir} +%if 0%{?fedora} > 14 || 0%{?rhel} > 6 +%if 0%{?fedora} >= 18 + %systemd_post %{name}.service +%else +if [ $1 -eq 1 ]; then + # Package install, not upgrade + /bin/systemctl daemon-reload > /dev/null 2>&1 || : fi +%endif +%else +/sbin/chkconfig --add %{name} +%endif %preun -%systemd_preun %{name}.service +%if 0%{?fedora} > 14 || 0%{?rhel} > 6 +%if 0%{?fedora} >= 18 + %systemd_preun %{name}.service +%else +# Work around RHBZ #655116 +if [ $1 -eq 0 ]; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : + /bin/systemctl stop %{name}.service > /dev/null 2>&1 || : +fi +%endif +%else +if [ $1 -eq 0 ]; then + /sbin/service %{name} stop > /dev/null 2>&1 || : + /sbin/chkconfig --del %{name} +fi +%endif %postun -%systemd_postun_with_restart %{name}.service +%if 0%{?fedora} > 14 || 0%{?rhel} > 6 +%if 0%{?fedora} >= 18 + %systemd_postun_with_restart %{name}.service +%else +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ]; then + # Package upgrade, not uninstall + /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi +%endif +%else +if [ $1 -ne 0 ]; then + /sbin/service %{name} condrestart > /dev/null 2>&1 || : +fi +%endif +%if 0%{?fedora} > 14 || 0%{?rhel} > 6 +%triggerun -- ddclient < 3.8.1-1 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply ddclient +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save ddclient >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del %{name} > /dev/null 2>&1 || : +/bin/systemctl try-restart %{name}.service > /dev/null 2>&1 || : +%endif %files +%defattr(-,root,root,-) %license COPYING COPYRIGHT -%doc README* ChangeLog.md sample-etc_ppp_ip-up.local +%doc README* RELEASENOTE ChangeLog Changelog.old sample-etc_ppp_ip-up.local %doc sample-etc_dhclient-exit-hooks sample-etc_cron.d_ddclient %doc sample-ddclient-wrapper.sh sample-etc_dhcpc_dhcpcd-eth0.exe - -%{_sbindir}/%{name} -%{_tmpfilesdir}/%{name}.conf +%if 0%{?fedora} > 14 || 0%{?rhel} > 6 %{_unitdir}/%{name}.service - -# sysconfdir +%{_tmpfilesdir}/%{name}.conf +%ghost %attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name}/ +%else +%{_sysconfdir}/rc.d/init.d/%{name} +%attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name}/ +%endif +%if 0%{?fedora}%{?rhel} > 4 +%{_sysconfdir}/NetworkManager/dispatcher.d/50-%{name} +%endif +%attr(600,%{name},%{name}) %config(noreplace) %{_sysconfdir}/%{name}.conf %config(noreplace) %{_sysconfdir}/rwtab.d/%{name} %config(noreplace) %{_sysconfdir}/sysconfig/%{name} -%attr(600,%{name},%{name}) %config(noreplace) %{_sysconfdir}/%{name}.conf -%{_prefix}/lib/NetworkManager/dispatcher.d/50-%{name} - -# localstatedir -%attr(0700,%{name},%{name}) %dir %{cachedir} -%attr(0600,%{name},%{name}) %ghost %{cachedir}/%{name}.cache -%ghost %attr(0755,%{name},%{name}) %dir %{rundir} -%{_sysusersdir}/ddclient.conf - +%{_sbindir}/%{name} +%attr(0700,%{name},%{name}) %dir %{_localstatedir}/cache/%{name}/ +%attr(0600,%{name},%{name}) %ghost %{_localstatedir}/cache/%{name}/%{name}.cache %changelog -* Wed Jul 23 2025 Fedora Release Engineering - 4.0.0-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild +* Sun Oct 30 2016 Scott Talbert - 3.8.3-1 +- New upstream release 3.8.3 -* Tue Apr 01 2025 Scott Talbert - 4.0.0-4 -- Switch systemd service to use exec and remove pid file (#2355909) - -* Tue Mar 25 2025 Scott Talbert - 4.0.0-3 -- Restore expected ddclient.conf dir to pre-4.0 location (#2354194) - -* Tue Feb 11 2025 Zbigniew Jędrzejewski-Szmek - 4.0.0-2 -- Add sysusers.d config file to allow rpm to create users/groups automatically - -* Wed Jan 22 2025 Scott Talbert - 4.0.0-1 -- Update to new upstream release 4.0.0 (#2334061) - -* Wed Jan 22 2025 Scott Talbert - 3.11.2-7 -- Fix FTBFS with newer autoconf - -* Thu Jan 16 2025 Fedora Release Engineering - 3.11.2-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Thu Jul 25 2024 Miroslav Suchý - 3.11.2-5 -- convert license to SPDX - -* Wed Jul 17 2024 Fedora Release Engineering - 3.11.2-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Wed Jan 24 2024 Fedora Release Engineering - 3.11.2-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Fri Jan 19 2024 Fedora Release Engineering - 3.11.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Wed Nov 29 2023 Scott Talbert - 3.11.2-1 -- Update to new upstream release 3.11.2 (#2251294) - -* Sat Nov 18 2023 Scott Talbert - 3.11.1-1 -- Update to new upstream release 3.11.1 (#2244514) - -* Thu Sep 14 2023 kenneth topp - 3.10.0-1 -- Update to new upstream release 3.10.0 - -* Thu Jan 19 2023 Fedora Release Engineering - 3.9.1-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Thu Jul 21 2022 Fedora Release Engineering - 3.9.1-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Thu Jan 20 2022 Fedora Release Engineering - 3.9.1-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Wed Jul 21 2021 Fedora Release Engineering - 3.9.1-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 3.9.1-5 -- Rebuilt for updated systemd-rpm-macros - See https://pagure.io/fesco/issue/2583. - -* Tue Jan 26 2021 Fedora Release Engineering - 3.9.1-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Sat Sep 12 2020 Scott Talbert - 3.9.1-3 -- Move pidfile from /var/run to /run (#1876265) - -* Mon Jul 27 2020 Fedora Release Engineering - 3.9.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Fri Jan 31 2020 Scott Talbert - 3.9.1-1 -- Update to new upstream release 3.9.1 (#1796923) - -* Tue Jan 28 2020 Fedora Release Engineering - 3.9.0-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Thu Aug 22 2019 Lubomir Rintel - 3.9.0-4 -- Move the NetworkManager dispatcher script out of /etc - -* Wed Jul 24 2019 Fedora Release Engineering - 3.9.0-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Thu Jan 31 2019 Fedora Release Engineering - 3.9.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Fri Aug 10 2018 Scott Talbert - 3.9.0-1 -- New upstream release 3.9.0 - -* Thu Jul 12 2018 Fedora Release Engineering - 3.8.3-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Wed Feb 07 2018 Fedora Release Engineering - 3.8.3-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Sat Sep 09 2017 Scott Talbert - 3.8.3-5 -- Start after network-online.target rather than network.target (#1476999) - -* Wed Jul 26 2017 Fedora Release Engineering - 3.8.3-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Fri Feb 10 2017 Fedora Release Engineering - 3.8.3-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Fri Dec 30 2016 Scott Talbert - 3.8.3-2 -- Prevent NetworkManager from starting ddclient if it is disabled (#1409178) - -* Mon Mar 28 2016 Scott Talbert - 3.8.3-1 -- New upstream release 3.8.3 (#1226537) -- Change NetworkManager dispatcher to look for PID file (#1316149) - -* Sat Jun 07 2014 Fedora Release Engineering - 3.8.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Mon Apr 21 2014 Jamie Nguyen - 3.8.2-1 -- update to upstream release 3.8.2 -- remove old EPEL 6 related macros -- remove all logic for older versions of Fedora/EPEL -- make spec more readable +* Sun Apr 03 2016 Scott Talbert - 3.8.1-10 +- No-change rebuild to restore package * Wed Dec 25 2013 Robert Scheck 3.8.1-9 - Use the new systemd macros (#850084, thanks to Lukáš Nykrýn) diff --git a/sources b/sources index 76f2cf8..53a415a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ddclient-4.0.0.tar.gz) = 095723aa43c4f08d7e3aa46c0bc47e753fdcbcb2cd0ac5f77cd687f98694985ad70e2f6509c05aaa232d0412fcb0aef8bb07a6d9e4302130ab1db047c14e1e86 +3b426ae52d509e463b42eeb08fb89e0b ddclient-3.8.3.tar.bz2