diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index b67ecec..0000000 --- a/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -ddclient-3.7.3.tar.bz2 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 2523f42..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 $$d/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/Root && { 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.initscript b/ddclient.initscript index 2a8176a..1271d2c 100755 --- a/ddclient.initscript +++ b/ddclient.initscript @@ -1,79 +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: - 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: " - [ -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 + # 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: " - # FIXME: call killproc with -p $pid; not done yet so that a 3.6.6->3.7.1 - # update will do the right thing with try-restart during the upgrade - 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 + stop + start } # See how we were called. case "$1" in - start|stop|restart|reload) - $1 - ;; - force-reload) - force_reload - ;; + start) + start + ;; + stop) + stop + ;; status) - status -p $pid $prog - ;; - try-restart|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|try-restart|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.spec b/ddclient.spec index 7b01699..083ebd5 100644 --- a/ddclient.spec +++ b/ddclient.spec @@ -1,113 +1,114 @@ -Name: ddclient -Version: 3.7.3 -Release: 3%{?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) +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 -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 +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 -i -e 's|^mail=|#mail=|' sample-etc_ddclient.conf +sed -e 's|^mail=|#mail=|' -i sample-etc_ddclient.conf # http://sourceforge.net/forum/forum.php?forum_id=706446 -sed -i -e 's|"3\.7\.1"|"3.7.2"|' ddclient +sed -e 's|"3\.7\.1"|"3.7.2"|' -i %{name} # Backwards compatibility from pre-3.6.6-1 -sed -i -e 's|/etc/ddclient/|%{_sysconfdir}/|' ddclient - +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 -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 +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 -/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 || : +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 -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 +/sbin/chkconfig --add %{name} %preun if [ $1 -eq 0 ]; then - %{_initrddir}/ddclient stop > /dev/null 2>&1 - /sbin/chkconfig --del ddclient + /sbin/service %{name} stop > /dev/null 2>&1 || : + /sbin/chkconfig --del %{name} fi %postun -if [ $1 -ge 1 ]; then - %{_initrddir}/ddclient try-restart >/dev/null +if [ $1 -ne 0 ]; then + /sbin/service %{name} condrestart > /dev/null 2>&1 || : 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/ - +%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 diff --git a/sources b/sources index 184dc0a..008224d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -f6a55bc68cf73ffe7e80d2fa5cd44f85 ddclient-3.7.3.tar.bz2 +6cac7a5eb1da781bfd4d98cef0b21f8e ddclient-3.8.0.tar.bz2