[ddclient] Migrate to systemd, latest upstream.

Jon Ciesla limb at fedoraproject.org
Thu Mar 29 12:06:38 UTC 2012


commit 49e399bf6989f30e2b3cb93144f5437eafe521f5
Author: Jon Ciesla <limburgher at gmail.com>
Date:   Thu Mar 29 07:06:13 2012 -0500

    Migrate to systemd, latest upstream.

 .gitignore       |    1 +
 ddclient.service |   15 ++++++++++++
 ddclient.spec    |   63 +++++++++++++++++++++++++++++++++++++++++------------
 sources          |    2 +-
 4 files changed, 65 insertions(+), 16 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 6d46518..b5e08cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 ddclient-3.8.0.tar.bz2
+/ddclient-3.8.1.tar.bz2
diff --git a/ddclient.service b/ddclient.service
new file mode 100644
index 0000000..5ab0547
--- /dev/null
+++ b/ddclient.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=A Perl Client Used To Update Dynamic DNS
+After=syslog.target network.target
+
+[Service]
+User=ddclient
+Group=ddclient
+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
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/ddclient.spec b/ddclient.spec
index 28ebef4..9dbe43d 100644
--- a/ddclient.spec
+++ b/ddclient.spec
@@ -1,20 +1,23 @@
 Summary:           Client to update dynamic DNS host entries
 Name:              ddclient
-Version:           3.8.0
-Release:           5%{?dist}
+Version:           3.8.1
+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.initscript
+Source2:           ddclient.service
 Source3:           ddclient.sysconfig
 Source4:           ddclient.NetworkManager
 BuildArch:         noarch
 Requires(pre):     shadow-utils
-Requires(post):    /sbin/chkconfig
-Requires(preun):   /sbin/service, /sbin/chkconfig
-Requires(postun):  /sbin/service
+#Requires(post):    /sbin/chkconfig
+#Requires(preun):   /sbin/service, /sbin/chkconfig
+#Requires(postun):  /sbin/service
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 Requires:          perl(IO::Socket::SSL)
 BuildRoot:         %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -44,11 +47,12 @@ sed -e 's|/etc/ddclient/|%{_sysconfdir}/|' -i %{name}
 %install
 rm -rf $RPM_BUILD_ROOT
 
-mkdir -p $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/{rc.d/init.d,rwtab.d,sysconfig}}
+mkdir -p $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/{rwtab.d,sysconfig}}
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
 install -p -m 755 %{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}
 install -p -m 600 sample-etc_ddclient.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
 install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rwtab.d/%{name}
-install -p -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/%{name}
+install -p -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
 install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
 %if 0%{?fedora}%{?rhel} > 4
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d
@@ -69,25 +73,50 @@ getent passwd %{name} > /dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_loc
 exit 0
 
 %post
-/sbin/chkconfig --add %{name}
+#/sbin/chkconfig --add %{name}
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun
-if [ $1 -eq 0 ]; then
-  /sbin/service %{name} stop > /dev/null 2>&1 || :
-  /sbin/chkconfig --del %{name}
+#if [ $1 -eq 0 ]; then
+#  /sbin/service %{name} stop > /dev/null 2>&1 || :
+#  /sbin/chkconfig --del %{name}
+#fi
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable ddclient.service > /dev/null 2>&1 || :
+    /bin/systemctl stop ddclient.service > /dev/null 2>&1 || :
 fi
 
+
 %postun
-if [ $1 -ne 0 ]; then
-  /sbin/service %{name} condrestart > /dev/null 2>&1 || :
+#if [ $1 -ne 0 ]; then
+#  /sbin/service %{name} condrestart > /dev/null 2>&1 || :
+#fi
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart ddclient.service >/dev/null 2>&1 || :
 fi
 
+%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 ddclient >/dev/null 2>&1 || :
+/bin/systemctl try-restart ddclient.service >/dev/null 2>&1 || :
+
 %files
 %defattr(-,root,root,-)
 %doc README* COPYING COPYRIGHT Changelog 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
-%{_sysconfdir}/rc.d/init.d/%{name}
+%{_unitdir}/%{name}.service
 %if 0%{?fedora}%{?rhel} > 4
 %{_sysconfdir}/NetworkManager/dispatcher.d/50-%{name}
 %endif
@@ -100,6 +129,10 @@ fi
 %attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name}/
 
 %changelog
+* Thu Mar 29 2012 Jon Ciesla <limburgher at gmail.com> - 3.8.1-1
+- Latest upstream.
+- Migrate to systemd, 718756.
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.8.0-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 
diff --git a/sources b/sources
index 008224d..61c72ba 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-6cac7a5eb1da781bfd4d98cef0b21f8e  ddclient-3.8.0.tar.bz2
+7fa417bc65f8f0e6ce78418a4f631988  ddclient-3.8.1.tar.bz2


More information about the scm-commits mailing list