From 7f5d7b4416fce9b0f4a945d80aeede0823dea038c7bacefb539d281e5442456b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 11 Nov 2013 14:01:16 +0000 Subject: [PATCH] Accepting request 204930 from home:posophe:branches:network Made required changes. sysvinit script is broken according to rpmlint (log 12.2 ) I can't fix it as I don't know sysvinit scripts OBS-URL: https://build.opensuse.org/request/show/204930 OBS-URL: https://build.opensuse.org/package/show/network/ddclient?expand=0&rev=27 --- ddclient-tmpfiles.conf | 1 + ddclient.changes | 5 ++++ ddclient.service | 15 ++++++++++++ ddclient.spec | 55 +++++++++++++++++++++++++++++++++--------- 4 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 ddclient-tmpfiles.conf create mode 100644 ddclient.service diff --git a/ddclient-tmpfiles.conf b/ddclient-tmpfiles.conf new file mode 100644 index 0000000..1ad6c4b --- /dev/null +++ b/ddclient-tmpfiles.conf @@ -0,0 +1 @@ +d /var/run/ddclient 0755 ddclient ddclient - diff --git a/ddclient.changes b/ddclient.changes index 3acef6a..fa755de 100644 --- a/ddclient.changes +++ b/ddclient.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sun Oct 27 15:12:09 UTC 2013 - p.drouand@gmail.com + +- Improve systemd support for openSUSE >= 12.3 + ------------------------------------------------------------------- Thu May 16 13:23:40 UTC 2013 - seife+obs@b1-systems.com diff --git a/ddclient.service b/ddclient.service new file mode 100644 index 0000000..5c7684f --- /dev/null +++ b/ddclient.service @@ -0,0 +1,15 @@ +[Unit] +Description=A Perl Client Used To Update Dynamic DNS +After=network.target nss-lookup.target + +[Service] +User=ddclient +Group=ddclient +Type=forking +PIDFile=/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 diff --git a/ddclient.spec b/ddclient.spec index c59494f..c51e929 100644 --- a/ddclient.spec +++ b/ddclient.spec @@ -24,13 +24,16 @@ Version: 3.8.1 Release: 0 Url: http://ddclient.sourceforge.net/ Source0: http://switch.dl.sourceforge.net/sourceforge/ddclient/%{name}-%{version}.tar.bz2 -Source1: rc.ddclient +Source1: %{name}.service Source2: %{name}.sysconfig +Source3: %{name}-tmpfiles.conf +Source4: rc.%{name} Patch0: %{name}-3.8.1-config.patch Patch1: %{name}-3.8.1-update_nic.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-build -PreReq: %fillup_prereq +BuildRequires: pkgconfig(systemd) +Requires(pre): %fillup_prereq Requires: perl >= 5.004 +%{?systemd_requires} Recommends: perl-IO-Socket-SSL %description @@ -63,32 +66,60 @@ mv sample-ddclient-wrapper.sh examples %install #make DESTDIR=$RPM_BUILD_ROOT install -%{__mkdir_p} $RPM_BUILD_ROOT%{_sbindir} -%{__mkdir_p} $RPM_BUILD_ROOT/%{_sysconfdir}/init.d -%{__install} -m 755 %{name} $RPM_BUILD_ROOT%{_sbindir}/ -%{__install} -m 644 sample-etc_ddclient.conf $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}.conf +%{__mkdir_p} %{buildroot}%{_sbindir} +%{__mkdir_p} %{buildroot}%{_sysconfdir} +%if 0%{?suse_version} >=1230 +%{__mkdir_p} %{buildroot}%{_unitdir} +%{__mkdir_p} %{buildroot}%{_libexecdir}/tmpfiles.d +%else +%{__mkdir_p} %{buildroot}%{_sysconfdir}/init.d +%endif +%{__install} -m 755 %{name} %{buildroot}%{_sbindir}/ +%{__install} -m 644 sample-etc_ddclient.conf %{buildroot}%{_sysconfdir}/%{name}.conf # init script and config file -%{__install} -m 755 %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/%{name} -%{__ln_s} %{_sysconfdir}/init.d/%{name} $RPM_BUILD_ROOT%{_sbindir}/rc%{name} -%{__install} -d -m 755 $RPM_BUILD_ROOT/var/adm/fillup-templates -%{__install} -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{name} -%{__install} -d -m 755 $RPM_BUILD_ROOT/var/cache/%{name} +%if 0%{?suse_version} >=1230 +%{__install} -m 755 %{SOURCE1} %{buildroot}%{_libexecdir}/tmpfiles.d/%{name}.conf +%{__install} -m 755 %{SOURCE3} %{buildroot}/%{_unitdir}/%{name}.service +%{__ln_s} %{_unitdir}/%{name}.service %{buildroot}%{_sbindir}/rc%{name} +%else +%{__install} -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/%{name} +%{__ln_s} %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name} +%endif +%{__install} -d -m 755 %{buildroot}/var/adm/fillup-templates +%{__install} -m 644 %{SOURCE2} %{buildroot}/var/adm/fillup-templates/sysconfig.%{name} +%{__install} -d -m 755 %{buildroot}/var/cache/%{name} %post %{fillup_only} +%if 0%{?suse_version} >=1230 +%service_add_post %{name}.service +%endif %preun +%if 0%{?suse_version} >=1230 +%service_del_preun %{name}.service +%else %stop_on_removal ddclient +%endif %postun +%if 0%{?suse_version} >=1230 +%service_del_postun %{name}.service +%else %restart_on_update ddclient %insserv_cleanup +%endif %files %defattr(-, root, root) %doc COPY* README* sample* examples %config(noreplace) %attr(600,root,root) %{_sysconfdir}/%{name}.conf +%if 0%{?suse_version} >=1230 +%config %attr(0755,root,root) %{_unitdir}/%{name}.service +%config %attr(0644,root,root) %{_libexecdir}/tmpfiles.d/ddclient.conf +%else %config %attr(0755,root,root) /etc/init.d/%{name} +%endif %{_sbindir}/%{name} %{_sbindir}/rc%{name} /var/adm/fillup-templates/sysconfig.%{name}