diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 8d15306..0000000 --- a/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -ddclient-3.6.3.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6d46518 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +ddclient-3.8.0.tar.bz2 diff --git a/Makefile b/Makefile deleted file mode 100644 index 6ba9603..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: ddclient -# $Id$ -NAME := ddclient -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Rootx && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/ddclient.NetworkManager b/ddclient.NetworkManager new file mode 100644 index 0000000..df7abf5 --- /dev/null +++ b/ddclient.NetworkManager @@ -0,0 +1,15 @@ +#!/bin/sh + +export LC_ALL=C + +if [ "$2" = "down" ]; then + /sbin/ip route ls | grep -q '^default' || { + [ -f /var/lock/subsys/ddclient ] && /sbin/service ddclient stop || : + } && { :; } +fi + +if [ "$2" = "up" ]; then + /sbin/ip -o route show dev "$1" | grep -q '^default' && { + /sbin/chkconfig ddclient && /sbin/service ddclient start || : + } || { :; } +fi diff --git a/ddclient.cache.patch b/ddclient.cache.patch deleted file mode 100644 index d957c83..0000000 --- a/ddclient.cache.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -Naur ddclient-3.6.3/ddclient ddclient-3.6.3.patched/ddclient ---- ddclient-3.6.3/ddclient 2003-06-14 19:39:16.000000000 +0200 -+++ ddclient-3.6.3.patched/ddclient 2003-09-04 12:25:55.000000000 +0200 -@@ -21,6 +21,7 @@ - my $now = time; - my $hostname = hostname(); - my $etc = ($program =~ /test/i) ? './' : '/etc/'; -+my $cache = ($program =~ /test/i) ? './' : '/var/cache/'; - my $savedir = ($program =~ /test/i) ? 'URL/' : '/tmp/'; - my $msgs = ''; - my $last_msgs = ''; -@@ -184,7 +185,7 @@ - 'global-defaults' => { - 'daemon' => setv(T_DELAY, 0, 0, 1, 0, interval('60s')), - 'file' => setv(T_FILE, 0, 0, 1, "$etc$program.conf", undef), -- 'cache' => setv(T_FILE, 0, 0, 1, "$etc$program.cache", undef), -+ 'cache' => setv(T_FILE, 0, 0, 1, "$cache$program.cache", undef), - 'pid' => setv(T_FILE, 0, 0, 1, "", undef), - 'proxy' => setv(T_FQDNP, 0, 0, 1, '', undef), - 'protocol' => setv(T_PROTO, 0, 0, 1, 'dyndns2', undef), diff --git a/ddclient.initscript b/ddclient.initscript index f25d09d..1271d2c 100755 --- a/ddclient.initscript +++ b/ddclient.initscript @@ -1,77 +1,92 @@ -#!/bin/sh +#!/bin/bash # -# ddclient This shell script takes care of starting and stopping ddclient. +# ddclient Client to update dynamic DNS host entries # -# chkconfig: 345 65 35 -# description: ddclient provides support for updating dynamic DNS services -# processname: ddclient -# config: /etc/sysconfig/ddclient +# chkconfig: - 65 35 +# description: ddclient is a Perl client used to update dynamic DNS \ +# entries for accounts on many dynamic DNS services. +# processname: /usr/sbin/ddclient +# config: /etc/ddclient.conf +# pidfile: /var/run/ddclient/ddclient.pid + +### BEGIN INIT INFO +# Provides: ddclient +# Required-Start: $local_fs $network $syslog +# Required-Stop: $local_fs $network $syslog +# Should-Start: $named +# Should-Stop: $named +# Short-Description: Client to update dynamic DNS host entries +# Description: ddclient is a Perl client used to update dynamic DNS +# entries for accounts on many dynamic DNS services. +### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions -# Source networking configuration. -. /etc/sysconfig/network +if [ -f /etc/sysconfig/ddclient ]; then + . /etc/sysconfig/ddclient +fi -# Check that networking is up. -[ "$NETWORKING" = "no" ] && exit 0 - -. /etc/sysconfig/ddclient - -exec="/usr/sbin/ddclient" -prog=$(basename $exec) +exec=/usr/sbin/ddclient +prog=`basename $exec` lockfile=/var/lock/subsys/$prog +cache=/var/cache/ddclient/ddclient.cache +pid=/var/run/ddclient/ddclient.pid +RETVAL=0 start() { - echo -n $"Starting $prog: " - daemon $exec $DDCLIENT_OPTIONS - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval + # Check that networking is up. + [ ! -f /var/lock/subsys/network -a ! -f /var/lock/subsys/NetworkManager ] && exit 0 + + echo -n $"Starting $prog: " + [ -f $cache ] || touch $cache + chown ddclient:ddclient $cache && chmod 600 $cache || exit $? + daemon --user=ddclient --pidfile=$pid $exec $DDCLIENT_OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $lockfile + + return $RETVAL } stop() { - echo -n $"Stopping $prog: " - killproc $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval + echo -n $"Stopping $prog: " + killproc -p $pid $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $lockfile + + return $RETVAL } restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -fdrstatus() { - status $prog + stop + start } # See how we were called. case "$1" in - start|stop|restart|reload) - $1 - ;; - force-reload) - force_reload - ;; + start) + start + ;; + stop) + stop + ;; status) - fdrstatus - ;; - condrestart) - [ ! -f $lockfile ] || restart - ;; + status -p $pid $prog + ;; + restart|force-reload|reload) + restart + ;; + condrestart|try-restart) + if [ -f $lockfile ]; then + restart + fi + ;; *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}" - exit 2 + echo $"Usage: $0 {start|stop|status|reload|restart|condrestart|force-reload|try-restart}" + RETVAL=1 + ;; esac + +exit $RETVAL diff --git a/ddclient.rwtab b/ddclient.rwtab new file mode 100644 index 0000000..927514c --- /dev/null +++ b/ddclient.rwtab @@ -0,0 +1 @@ +files /var/cache/ddclient/ddclient.cache diff --git a/ddclient.spec b/ddclient.spec index 464ba10..083ebd5 100644 --- a/ddclient.spec +++ b/ddclient.spec @@ -1,85 +1,148 @@ -Name: ddclient -Version: 3.6.3 -Release: 0.fdr.4.2 -Epoch: 0 -Summary: A client to update dynamic DNS host entries. - -Group: System Environment/Daemons -License: GPL -URL: http://burry.ca:4141/ddclient -Source: http://members.rogers.com/ddclient/pub/%{name}-%{version}.tar.gz -Source2: ddclient.initscript -Source3: ddclient.sysconfig -# Patch hardcodes cache location to /var/cache. -# This is reflected in install section below. -Patch: ddclient.cache.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildArch: noarch +Summary: Client to update dynamic DNS host entries +Name: ddclient +Version: 3.8.0 +Release: 2%{?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 +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(hint): perl(IO::Socket::SSL) +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description ddclient is a Perl client used to update dynamic DNS entries for accounts -on many dynamic DNS services. - -# ----------------------------------------------------------------------------- +on many different dynamic DNS services. Features include: Operating as a +daemon, manual and automatic updates, static and dynamic updates, optimized +updates for multiple addresses, MX, wildcards, abuse avoidance, retrying +the failed updates and sending update status to syslog and through e-mail. %prep %setup -q -%patch -p1 +# Move pid file location for running as non-root. +sed -e 's|/var/run/ddclient.pid|%{_localstatedir}/run/%{name}/%{name}.pid|' -i sample-etc_ddclient.conf -# ----------------------------------------------------------------------------- +# Send less mail by default, eg. not on every shutdown. +sed -e 's|^mail=|#mail=|' -i sample-etc_ddclient.conf + +# http://sourceforge.net/forum/forum.php?forum_id=706446 +sed -e 's|"3\.7\.1"|"3.7.2"|' -i %{name} + +# Backwards compatibility from pre-3.6.6-1 +sed -e 's|/etc/ddclient/|%{_sysconfdir}/|' -i %{name} %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 -p sample-etc_ddclient.conf $RPM_BUILD_ROOT%{_sysconfdir}/ddclient.conf -install -p %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/ddclient -install -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ddclient -mkdir -p $RPM_BUILD_ROOT/var/cache -touch $RPM_BUILD_ROOT/var/cache/ddclient.cache +mkdir -p $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/{rc.d/init.d,rwtab.d,sysconfig}} +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 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} +%if 0%{?fedora}%{?rhel} > 4 +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d +install -p -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/50-%{name} +%endif +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/{cache,run}/%{name} +touch $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name}/%{name}.cache -# ----------------------------------------------------------------------------- +# Correct permissions for later usage in %doc +chmod 644 sample-* %clean rm -rf $RPM_BUILD_ROOT -# ----------------------------------------------------------------------------- +%pre +getent group %{name} > /dev/null || %{_sbindir}/groupadd -r %{name} +getent passwd %{name} > /dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_localstatedir}/cache/%{name} -s /sbin/nologin -c "Dynamic DNS Client" %{name} +exit 0 %post -/sbin/chkconfig --add ddclient -touch /var/cache/ddclient.cache -chmod 0600 /var/cache/ddclient.cache +/sbin/chkconfig --add %{name} %preun -if [ $1 = 0 ]; then - /sbin/service ddclient stop > /dev/null 2>&1 - /sbin/chkconfig --del ddclient +if [ $1 -eq 0 ]; then + /sbin/service %{name} stop > /dev/null 2>&1 || : + /sbin/chkconfig --del %{name} fi +%postun +if [ $1 -ne 0 ]; then + /sbin/service %{name} condrestart > /dev/null 2>&1 || : +fi %files %defattr(-,root,root,-) -%doc README* COPYING COPYRIGHT -%doc %attr(0644, root, root) sample* -%{_sbindir}/ddclient -%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/ddclient.conf -%config(noreplace) %{_sysconfdir}/sysconfig/ddclient -%ghost %attr(0600, root, root) /var/cache/ddclient.cache -%{_initrddir}/ddclient - -# ----------------------------------------------------------------------------- +%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} +%if 0%{?fedora}%{?rhel} > 4 +%{_sysconfdir}/NetworkManager/dispatcher.d/50-%{name} +%endif +%attr(600,%{name},%{name}) %config(noreplace) %{_sysconfdir}/%{name}.conf +%config(noreplace) %{_sysconfdir}/rwtab.d/%{name} +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%{_sbindir}/%{name} +%attr(0700,%{name},%{name}) %dir %{_localstatedir}/cache/%{name}/ +%attr(0600,%{name},%{name}) %ghost %{_localstatedir}/cache/%{name}/%{name}.cache +%attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name}/ %changelog +* Sat May 29 2010 Robert Scheck 3.8.0-2 +- Fixed wrong permissions at NetworkManager dispatcher (#506286) +- Updated %%description to be more verbose and detailed (#588053) + +* Sat May 01 2010 Robert Scheck 3.8.0-1 +- Upgrade to 3.8.0 and several spec file cleanups (#551906) +- Rewrote initscript to match LSB standards and headers (#246903) +- Added dispatcher to NetworkManager to avoid failures (#506286) + +* Fri Jul 24 2009 Fedora Release Engineering - 3.7.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Feb 24 2009 Fedora Release Engineering - 3.7.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Jan 23 2008 Robert Scheck 3.7.3-1 +- Upgrade to 3.7.3 (#429438) +- Updated the license tag according to the guidelines + +* Thu Jun 14 2007 Ville Skyttä - 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ä - 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ä - 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 - 3.6.3-5 +- rebuilt + * Mon Apr 05 2004 Toshio Kuratomi - 0:3.6.3-0.fdr.4.fc1 - Fix %%doc %%attr ownership -- Touch the cache file in %post +- Touch the cache file in %%post * Mon Sep 08 2003 Michael Schwendt - 0:3.6.3-0.fdr.3 - Add own Fedora-style initscript and /etc/sysconfig/ddclient file. diff --git a/ddclient.sysconfig b/ddclient.sysconfig index f046b08..97de4c1 100644 --- a/ddclient.sysconfig +++ b/ddclient.sysconfig @@ -1,4 +1,4 @@ -# -# ddclient service options +# -*- sh -*- +# ddclient service options, see ddclient --help for what's available. # DDCLIENT_OPTIONS="-daemon 300" diff --git a/sources b/sources index ea60e93..008224d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -dfa5ff6967cb854de804d4e7b9633fdc ddclient-3.6.3.tar.gz +6cac7a5eb1da781bfd4d98cef0b21f8e ddclient-3.8.0.tar.bz2