[ez-ipupdate] Migrate to systemd.
Jon Ciesla
limb at fedoraproject.org
Tue Apr 17 16:41:35 UTC 2012
commit e8dba15b31ecfe846443287d56ae2bf707bd5517
Author: Jon Ciesla <limburgher at gmail.com>
Date: Tue Apr 17 11:41:25 2012 -0500
Migrate to systemd.
ez-ipupdate.service | 11 +++++++++
ez-ipupdate.spec | 59 ++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 55 insertions(+), 15 deletions(-)
---
diff --git a/ez-ipupdate.service b/ez-ipupdate.service
new file mode 100644
index 0000000..9ba2ff6
--- /dev/null
+++ b/ez-ipupdate.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Ez-ipupdate Check and update your IP to dynamic DNS Server
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/run/ez-ipupdate/ez-ipupdate.pid
+ExecStart=/usr/sbin/ez-ipupdate --daemon --config-file /etc/ez-ipupdate/default.conf --pid-file /run/ez-ipupdate/ez-ipupdate.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/ez-ipupdate.spec b/ez-ipupdate.spec
index 20c2f5d..7ae9b83 100644
--- a/ez-ipupdate.spec
+++ b/ez-ipupdate.spec
@@ -1,20 +1,21 @@
Name: ez-ipupdate
Version: 3.0.11
-Release: 0.24.b8%{?dist}
+Release: 0.25.b8%{?dist}
Summary: Client for Dynamic DNS Services
Group: Applications/Internet
License: GPLv2+
URL: http://www.gusnet.cx/proj/ez-ipupdate/
Source0: http://www.gusnet.cx/proj/ez-ipupdate/dist/ez-ipupdate-3.0.11b8.tar.gz
-Source1: %{name}.init
+Source1: %{name}.service
Patch0: http://ftp.debian.org/debian/pool/main/e/ez-ipupdate/ez-ipupdate_3.0.11b8-10.diff.gz
Patch1: %{name}-pidfile.patch
Patch2: ez-ipupdate-3.0.11b8-zoneedit-server.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/chkconfig
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
Requires(pre): /usr/sbin/useradd /usr/sbin/groupadd
%description
@@ -61,13 +62,14 @@ make install DESTDIR=$RPM_BUILD_ROOT bindir=%{_sbindir}
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
cp -p ez-ipupdate.8 $RPM_BUILD_ROOT%{_mandir}/man8
-mkdir -p $RPM_BUILD_ROOT%{_initrddir}
-%{__perl} -pe \
- 's|/var/|%{_localstatedir}/|g ;
- s|/usr/sbin/|%{_sbindir}/|g ;
- s|/etc/([^ir])|%{_sysconfdir}/$1|g ;
- s|/etc/rc\.d/init\.d/|%{_initrddir}/|g' \
- < %{SOURCE1} > $RPM_BUILD_ROOT%{_initrddir}/ez-ipupdate
+#mkdir -p $RPM_BUILD_ROOT%{_initrddir}
+#%{__perl} -pe \
+# 's|/var/|%{_localstatedir}/|g ;
+# s|/usr/sbin/|%{_sbindir}/|g ;
+# s|/etc/([^ir])|%{_sysconfdir}/$1|g ;
+# s|/etc/rc\.d/init\.d/|%{_initrddir}/|g' \
+# < %{SOURCE1} > $RPM_BUILD_ROOT%{_initrddir}/ez-ipupdate
+install -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/ez-ipupdate.service
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/ez-ipupdate
> $RPM_BUILD_ROOT%{_localstatedir}/cache/ez-ipupdate/default-cache
@@ -91,7 +93,10 @@ rm -rf $RPM_BUILD_ROOT
-s /sbin/nologin -c "Dynamic DNS Client" ez-ipupd >/dev/null 2>&1 || :
%post
-/sbin/chkconfig --add ez-ipupdate
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
# move config file from old location to new if it exists
if [ $1 -gt 1 ]; then
[ -f %{_sysconfdir}/ez-ipupdate.conf ] && /bin/mv %{_sysconfdir}/ez-ipupdate.conf %{_sysconfdir}/ez-ipupdate/default.conf
@@ -102,15 +107,34 @@ fi
%preun
if [ $1 -eq 0 ] ; then
- %{_initrddir}/ez-ipupdate stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del ez-ipupdate
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable ez-ipupdate.service > /dev/null 2>&1 || :
+ /bin/systemctl stop ez-ipupdate.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart ez-ipupdate.service >/dev/null 2>&1 || :
fi
+%triggerun -- ez-ipupdate < 3.0.11-0.25.b8
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply ez-ipupdate
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save ez-ipupdate >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del ez-ipupdate >/dev/null 2>&1 || :
+/bin/systemctl try-restart ez-ipupdate.service >/dev/null 2>&1 || :
+
+
%files
%defattr(-,root,root,-)
%{_mandir}/man8/ez-ipupdate.8*
%attr(0755,root,root) %{_sbindir}/ez-ipupdate
-%attr(0755,root,root) %{_initrddir}/ez-ipupdate
+%attr(0644,root,root) %{_unitdir}/ez-ipupdate.service
%dir %{_sysconfdir}/ez-ipupdate/
%doc CHANGELOG COPYING README example.conf example-*.conf
%defattr(0644,root,root,-)
@@ -120,7 +144,12 @@ fi
%ghost %{_localstatedir}/cache/ez-ipupdate/default-cache
%ghost %attr(0640,root,ez-ipupd) %config(noreplace,missingok) %{_sysconfdir}/ez-ipupdate/default.conf
+
+
%changelog
+* Tue Apr 17 2012 Jon Ciesla <limburgher at gmail.com> - 3.0.11-0.25.b8
+- Migrate to systemd, BZ 767801.
+
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.0.11-0.24.b8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list