Blob Blame History Raw
Name:           ddclient
Version:        3.7.3
Release:        1%{?dist}
Summary:        Client to update dynamic DNS host entries

Group:          System Environment/Daemons
License:        GPLv2+
URL:            http://ddclient.sourceforge.net/
Source0:        http://downloads.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.bz2
Source1:        ddclient.rwtab
Source2:        ddclient.initscript
Source3:        ddclient.sysconfig
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch
Requires(pre):  /usr/sbin/useradd
Requires(pre):  /usr/sbin/groupadd
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(hint): perl(IO::Socket::SSL)

%description
ddclient is a Perl client used to update dynamic DNS entries for accounts
on many dynamic DNS services.


%prep
%setup -q
rm sample-etc_rc.d_init.d_ddclient*

# Move pid file location for running as non-root.
sed -i -e 's|/var/run/ddclient.pid|/var/run/ddclient/ddclient.pid|' \
    sample-etc_ddclient.conf

# Send less mail by default, eg. not on every shutdown.
sed -i -e 's|^mail=|#mail=|' sample-etc_ddclient.conf

# http://sourceforge.net/forum/forum.php?forum_id=706446
sed -i -e 's|"3\.7\.1"|"3.7.2"|' ddclient

# Backwards compatibility from pre-3.6.6-1
sed -i -e 's|/etc/ddclient/|%{_sysconfdir}/|' ddclient


%build


%install
rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT%{_sbindir}
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
install -p ddclient $RPM_BUILD_ROOT%{_sbindir}
install -pm 600 sample-etc_ddclient.conf \
    $RPM_BUILD_ROOT%{_sysconfdir}/ddclient.conf
install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rwtab.d/ddclient
install -p %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/ddclient
install -pm 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ddclient
mkdir -p $RPM_BUILD_ROOT/var/cache/ddclient
touch $RPM_BUILD_ROOT/var/cache/ddclient/ddclient.cache
mkdir -p $RPM_BUILD_ROOT/var/run/ddclient


%clean
rm -rf $RPM_BUILD_ROOT


%pre
/usr/sbin/groupadd -r ddclient >/dev/null 2>&1 || :
/usr/sbin/useradd -r -M -d /var/cache/ddclient -g ddclient \
    -s /sbin/nologin -c "Dynamic DNS Client" ddclient >/dev/null 2>&1 || :

%post
/sbin/chkconfig --add ddclient
if [ $1 -gt 1 ]; then
    # 3.6.6->3.7.1: config(noreplace), but we need the ownership change...
    chown ddclient:ddclient %{_sysconfdir}/ddclient.conf
    # ...and the pid file location change is nice to have too
    if grep -qF /var/run/ddclient.pid %{_sysconfdir}/ddclient.conf ; then
        sed -i -e 's|/var/run/ddclient.pid|/var/run/ddclient/ddclient.pid|' \
            %{_sysconfdir}/ddclient.conf || :
    fi
fi

%preun
if [ $1 -eq 0 ]; then
    %{_initrddir}/ddclient stop > /dev/null 2>&1
    /sbin/chkconfig --del ddclient
fi

%postun
if [ $1 -ge 1 ]; then
    %{_initrddir}/ddclient try-restart >/dev/null
fi

%files
%defattr(-,root,root,-)
%doc README* COPYING COPYRIGHT Changelog sample-*
%attr(600,ddclient,ddclient) %config(noreplace) %{_sysconfdir}/ddclient.conf
%config(noreplace) %{_sysconfdir}/rwtab.d/ddclient
%config(noreplace) %{_sysconfdir}/sysconfig/ddclient
%attr(0700,ddclient,ddclient) %dir /var/cache/ddclient/
%attr(0600,ddclient,ddclient) %ghost /var/cache/ddclient/ddclient.cache
%{_initrddir}/ddclient
%{_sbindir}/ddclient
%attr(0755,ddclient,ddclient) %dir /var/run/ddclient/


%changelog
* Wed Jan 23 2008 Robert Scheck <robert@fedoraproject.org> 3.7.3-1
- Upgrade to 3.7.3 (#429438)
- Updated the license tag according to the guidelines

* Thu Jun 14 2007 Ville Skyttä <ville.skytta at iki.fi> - 3.7.2-1
- 3.7.2.
- Tweak default config to send less mail (eg. not on every shutdown).

* Fri Mar  2 2007 Ville Skyttä <ville.skytta at iki.fi> - 3.7.1-1
- 3.7.1, cache file moved to /var/cache/ddclient.
- Run as a dedicated ddclient user (#220539).
- Add read only root/temporary state config (#220540).
- Create/chmod cache in init script instead of %%post.
- Add scriptlet dependencies, try-restart action and other minor tweaks.

* Sat Jul 30 2005 Ville Skyttä <ville.skytta at iki.fi> - 3.6.6-1
- 3.6.6, update URLs (#165272).
- Restart service on future package upgrades (still manually needed this time).
- Don't set service to autostart on "chkconfig --add".
- Fix sysconfig/ddclient permissions.
- Drop non-useful samples.

* Fri Apr  7 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 3.6.3-5
- rebuilt

* Mon Apr 05 2004 Toshio Kuratomi <toshio[+]tiki-lounge.com> - 0:3.6.3-0.fdr.4.fc1
- Fix %%doc %%attr ownership
- Touch the cache file in %%post

* Mon Sep 08 2003 Michael Schwendt <mschwendt[AT]users.sf.net> - 0:3.6.3-0.fdr.3
- Add own Fedora-style initscript and /etc/sysconfig/ddclient file.
- Fix file permissions of config file and example files.
- Since ddclient.cache.patch uses hardcoded /var, don't use
  %%_localstatedir in spec file either.

* Sun Sep 07 2003 Thomas Vander Stichele <thomas at apestaart dot org>
- 0:3.6.3-0.fdr.2: fixed ghostness of cache file