]> git.pld-linux.org Git - packages/ddclient.git/blobdiff - ddclient.spec
up to 3.11.2
[packages/ddclient.git] / ddclient.spec
index 8ca46d2974046b41c7034412e7e74303bb6be745..3c58c3aaa93f3e7557e1a9f80aad947c0af0e0bc 100644 (file)
@@ -1,21 +1,28 @@
-%include       /usr/lib/rpm/macros.perl
+#
+# Conditional build:
+%bcond_without systemd         # systemd units
+
 Summary:       A dynamic IP address utility
 Summary(pl.UTF-8):     Narzędzie do dynamicznych adresów IP
 Summary(pt_BR.UTF-8):  Cliente para atualizar entradas DNS dinâmicas no DynDNS.org
 Name:          ddclient
-Version:       3.8.3
+Version:       3.11.2
 Release:       1
 Epoch:         1
 License:       GPL v2
 Group:         Networking
-Source0:       http://downloads.sourceforge.net/ddclient/%{name}-%{version}.tar.bz2
-# Source0-md5: 3b426ae52d509e463b42eeb08fb89e0b
+Source0:       https://github.com/ddclient/ddclient/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 5ef2ff089cfe4d4b9e1248881199eb4a
 Source1:       %{name}.init
 Source2:       %{name}.sysconfig
 Source3:       %{name}.NetworkManager
+Source4:       %{name}-tmpfiles.conf
+Source5:       %{name}.service
 Patch0:                config.patch
-# https://github.com/wimpunk/ddclient
-URL:           http://ddclient.sourceforge.net/
+URL:           https://github.com/ddclient/ddclient
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: perl-base
 BuildRequires: rpm-perlprov
 BuildRequires: rpmbuild(macros) >= 1.268
 Provides:      group(ddclient)
@@ -28,6 +35,7 @@ Requires(pre):        /usr/bin/getgid
 Requires(pre): /usr/sbin/groupadd
 Requires(pre): /usr/sbin/useradd
 Requires:      rc-scripts
+%{?with_systemd:Requires:      systemd-units >= 1:250.1}
 # for freedns: Digest::SHA1, IO::Socket::SSL
 Suggests:      perl-Digest-SHA1
 Suggests:      perl-IO-Socket-SSL
@@ -38,6 +46,7 @@ BuildRoot:    %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define                cachedir        %{_localstatedir}/cache/ddclient
 %define                rundir          %{_localstatedir}/run/ddclient
+%define                _sysconfdir     /etc/ddclient
 
 %description
 DDclient is a small full featured client with FULL DynDNS NIC2
@@ -79,19 +88,28 @@ gratuita.
 
 %prep
 %setup -q
-cp -p sample-etc_ddclient.conf %{name}.conf
 %patch0 -p1
 
+%build
+%{__aclocal}
+%{__autoconf}
+%{__automake}
+%configure \
+       CURL=/usr/bin/curl
+%{__make}
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},/etc/{rc.d/init.d,sysconfig,NetworkManager/dispatcher.d}} \
-       $RPM_BUILD_ROOT{%{_sbindir},%{cachedir},%{rundir}}
+       $RPM_BUILD_ROOT{%{_sbindir},%{systemdtmpfilesdir},%{?with_systemd:%{systemdunitdir},}%{cachedir},%{rundir}}
 
-cp -p %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+cp -p %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}
 install -p %{name} $RPM_BUILD_ROOT%{_sbindir}
 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/50-%{name}
+cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
+%{?with_systemd:cp -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service}
 touch $RPM_BUILD_ROOT%{cachedir}/%{name}.cache
 
 %clean
@@ -103,37 +121,51 @@ rm -rf $RPM_BUILD_ROOT
 
 %post
 /sbin/chkconfig --add %{name}
-%service %{name} restart "%{name} daemon"
+if [ "$1" = "2" ]; then
+       %service %{name} try-restart "%{name} daemon"
+fi
+%{?with_systemd:%systemd_post %{name}.service}
 
 %preun
 if [ "$1" = "0" ]; then
        %service %{name} stop
        /sbin/chkconfig --del %{name}
 fi
+%{?with_systemd:%systemd_preun %{name}.service}
 
 %postun
 if [ "$1" = "0" ]; then
        %userremove ddclient
        %groupremove ddclient
 fi
+%{?with_systemd:%systemd_reload}
 
-%triggerpostun -- ddclient < 1:3.6.4
+%triggerpostun -- ddclient < 1:3.9.1-2
 if [ -f /etc/ddclient.conf.rpmsave ]; then
        echo "Moving config to new location /etc/ddclient"
        mv -f /etc/ddclient/ddclient.conf /etc/ddclient/ddclient.conf.rpmnew
        mv -f /etc/ddclient.conf.rpmsave /etc/ddclient/ddclient.conf
        mv -f /etc/ddclient.cache /etc/ddclient.cache.rpmsave
 fi
+%{?with_systemd:%systemd_trigger %{name}.service}
+
+%triggerin -- perl-base
+[ "$2" = "2" ] || exit 0
+%service %{name} try-restart "%{name} daemon"
+%{?with_systemd:%systemd_service_restart %{name}.service}
 
 %files
 %defattr(644,root,root,755)
-%doc ChangeLog Changelog.old README*
+%doc ChangeLog.md README*
 %attr(755,root,root) %{_sbindir}/ddclient
-%dir %{_sysconfdir}/%{name}
-%attr(640,root,ddclient) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/%{name}.conf
-%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ddclient
+%dir %{_sysconfdir}
+# switch to %attr(640,root,ddclient) when this gets resolution: https://sourceforge.net/p/ddclient/bugs/77/
+%attr(600,ddclient,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
+%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
 %attr(754,root,root) /etc/rc.d/init.d/%{name}
 %attr(755,root,root) /etc/NetworkManager/dispatcher.d/50-%{name}
+%{systemdtmpfilesdir}/%{name}.conf
+%{?with_systemd:%{systemdunitdir}/%{name}.service}
 
 %dir %attr(770,root,ddclient) %{cachedir}
 %ghost %attr(600,ddclient,ddclient) %ghost %{cachedir}/%{name}.cache
This page took 0.062938 seconds and 4 git commands to generate.