From ea3ad7fa8371bba91d099782152b1906426e1b1d010889183b098854bf6ddbaa Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Wed, 21 Oct 2009 09:57:28 +0000 Subject: [PATCH] Accepting request 19426 from home:computersalat:devel Copy from home:computersalat:devel/ddclient via accept of submit request 19426 revision 9. Request was accepted with message: reviewed ... mostly ok. * useless use of cat, grep -e "^use=" $DDCLIENT_CONFIG should have worked too --This line, and those below, will be ignored-- OBS-URL: https://build.opensuse.org/request/show/19426 OBS-URL: https://build.opensuse.org/package/show/network/ddclient?expand=0&rev=6 --- ddclient-3.6.3-config.patch | 11 ---- ddclient-3.7.1-config.patch | 22 ------- ddclient-3.7.1-sysconfig.patch | 10 ---- ddclient-3.8.0-config.patch | 52 ++++++++++++++++ ddclient-3.8.0-update_nic.patch | 12 ++++ ddclient.changes | 21 +++++++ ddclient.spec | 61 +++++++++---------- ddclient.sysconfig | 15 ++++- rc.ddclient | 101 +++++++++++++++++++++++--------- 9 files changed, 203 insertions(+), 102 deletions(-) delete mode 100644 ddclient-3.6.3-config.patch delete mode 100644 ddclient-3.7.1-config.patch delete mode 100644 ddclient-3.7.1-sysconfig.patch create mode 100644 ddclient-3.8.0-config.patch create mode 100644 ddclient-3.8.0-update_nic.patch diff --git a/ddclient-3.6.3-config.patch b/ddclient-3.6.3-config.patch deleted file mode 100644 index 530b99d..0000000 --- a/ddclient-3.6.3-config.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ddclient-3.6.3/sample-etc_ddclient.conf.orig 2003-06-14 19:39:16.000000000 +0200 -+++ ddclient-3.6.3/sample-etc_ddclient.conf 2003-08-13 15:20:58.000000000 +0200 -@@ -14,7 +14,7 @@ - ###################################################################### - daemon=300 # check every 300 seconds - syslog=yes # log update msgs to syslog --mail=root # mail all msgs to root -+#mail=root # mail all msgs to root - mail-failure=root # mail failed update msgs to root - pid=/var/run/ddclient.pid # record PID in file. - # diff --git a/ddclient-3.7.1-config.patch b/ddclient-3.7.1-config.patch deleted file mode 100644 index 102d5b5..0000000 --- a/ddclient-3.7.1-config.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ddclient-3.7.1/ddclient.orig 2007-01-25 16:42:22.000000000 +0100 -+++ ddclient-3.7.1/ddclient 2007-02-12 16:09:53.000000000 +0100 -@@ -21,7 +21,7 @@ - $program =~ s/d$//; - my $now = time; - my $hostname = hostname(); --my $etc = ($program =~ /test/i) ? './' : '/etc/ddclient/'; -+my $etc = ($program =~ /test/i) ? './' : '/etc/'; - my $cachedir = ($program =~ /test/i) ? './' : '/var/cache/ddclient/'; - my $savedir = ($program =~ /test/i) ? 'URL/' : '/tmp/'; - my $msgs = ''; ---- ddclient-3.7.1/sample-etc_ddclient.conf.orig 2007-02-13 09:40:04.000000000 +0100 -+++ ddclient-3.7.1/sample-etc_ddclient.conf 2007-02-13 09:40:48.000000000 +0100 -@@ -23,7 +23,7 @@ - #mail=root # mail all msgs to root - mail-failure=root # mail failed update msgs to root - pid=/var/run/ddclient.pid # record PID in file. --ssl=yes # use ssl-support. Works with -+ssl=no # use ssl-support. Works with - # ssl-library - # - #use=watchguard-soho, fw=192.168.111.1:80 # via Watchguard's SOHO FW diff --git a/ddclient-3.7.1-sysconfig.patch b/ddclient-3.7.1-sysconfig.patch deleted file mode 100644 index 83f1b02..0000000 --- a/ddclient-3.7.1-sysconfig.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ddclient-3.7.1/sample-etc_ddclient.conf.orig 2007-05-03 14:25:43.000000000 +0200 -+++ ddclient-3.7.1/sample-etc_ddclient.conf 2007-05-03 14:29:36.000000000 +0200 -@@ -18,6 +18,7 @@ - ## are mentioned here. - ## - ###################################################################### -+# daemon: consider to use /etc/sysconfig/ddclient instead of modifying here - daemon=300 # check every 300 seconds - syslog=yes # log update msgs to syslog - #mail=root # mail all msgs to root diff --git a/ddclient-3.8.0-config.patch b/ddclient-3.8.0-config.patch new file mode 100644 index 0000000..52acc80 --- /dev/null +++ b/ddclient-3.8.0-config.patch @@ -0,0 +1,52 @@ +diff -ruN ddclient-3.8.0-orig/ddclient ddclient-3.8.0/ddclient +--- ddclient-3.8.0-orig/ddclient 2009-01-27 19:14:02.000000000 +0000 ++++ ddclient-3.8.0/ddclient 2009-04-29 21:37:27.690282779 +0000 +@@ -27,7 +27,7 @@ + $program =~ s/d$//; + my $now = time; + my $hostname = hostname(); +-my $etc = ($program =~ /test/i) ? './' : '/etc/ddclient/'; ++my $etc = ($program =~ /test/i) ? './' : '/etc/'; + my $cachedir = ($program =~ /test/i) ? './' : '/var/cache/ddclient/'; + my $savedir = ($program =~ /test/i) ? 'URL/' : '/tmp/'; + my $msgs = ''; +diff -ruN ddclient-3.8.0-orig/sample-etc_ddclient.conf ddclient-3.8.0/sample-etc_ddclient.conf +--- ddclient-3.8.0-orig/sample-etc_ddclient.conf 2008-11-19 20:20:34.000000000 +0000 ++++ ddclient-3.8.0/sample-etc_ddclient.conf 2009-04-30 14:14:47.793725557 +0000 +@@ -18,12 +18,16 @@ + ## are mentioned here. + ## + ###################################################################### ++# daemon: consider to use /etc/sysconfig/ddclient instead of modifying here ++# + daemon=300 # check every 300 seconds ++# ++###################################################################### + syslog=yes # log update msgs to syslog +-mail=root # mail all msgs to root ++#mail=root # mail all msgs to root + mail-failure=root # mail failed update msgs to root + pid=/var/run/ddclient.pid # record PID in file. +-ssl=yes # use ssl-support. Works with ++ssl=no # use ssl-support. Works with + # ssl-library + # postscript=script # run script after updating. The + # new IP is added as argument. +@@ -52,10 +56,17 @@ + ## To obtain an IP address from Web status page (using the proxy if defined) + #use=web, web=checkip.dyndns.org/, web-skip='IP Address' # found after IP Address + # ++###################################################################### ++# you do not need to define use= if you are using DSL (ppp0) ++# rc.ddclient is using "use=if, if=ppp0" as default ++# + #use=ip, ip=127.0.0.1 # via static IP's + #use=if, if=eth0 # via interfaces ++#use=if, if=ippp0 # when using ISDN ++#use=if, if=ppp0 # when using DSL + #use=web # via web + # ++###################################################################### + #protocol=dyndns2 # default protocol + #proxy=fasthttp.sympatico.ca:80 # default proxy + #server=members.dyndns.org # default server diff --git a/ddclient-3.8.0-update_nic.patch b/ddclient-3.8.0-update_nic.patch new file mode 100644 index 0000000..2a5fa3e --- /dev/null +++ b/ddclient-3.8.0-update_nic.patch @@ -0,0 +1,12 @@ +diff -ruN ddclient-3.8.0-orig/ddclient ddclient-3.8.0/ddclient +--- ddclient-3.8.0-orig/ddclient 2009-01-27 19:14:02.000000000 +0000 ++++ ddclient-3.8.0/ddclient 2009-05-01 20:55:20.386630124 +0000 +@@ -726,7 +726,7 @@ + foreach my $h (sort keys %config) { + next if $config{$h}{'protocol'} ne lc($s); + $examined{$h} = 1; +- my $use = $config{$h}{'use'} || opt('use'); ++ my $use = $opt{'use'} || $config{$h}{'use'}; + local $opt{$use} = $config{$h}{$use} if $config{$h}{$use}; + my $ip = get_ip($use); + if (!defined $ip || !$ip) { diff --git a/ddclient.changes b/ddclient.changes index 4f9739d..e89ee3d 100644 --- a/ddclient.changes +++ b/ddclient.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Tue Sep 1 11:01:31 UTC 2009 - chris@computersalat.de + +- rework config patch + o now one patch + o merged + - ddclient-3.6.3-config.patch + - ddclient-3.7.1-config.patch + - ddclient-3.7.1-sysconfig.patch + to ddclient-3.8.0-config.patch + o defaults for ppp0 +- added update_nic.patch + * opt('use') should have priority to global-defaults +- init script + o beautify + o should start rp-pppoe + o ppp0 as a "use=" default if not set in ddclient.conf +- sysconfig + o added argument list for DDCLIENT_OPTIONS +- cleanup spec + ------------------------------------------------------------------- Sun Aug 30 20:12:52 CEST 2009 - coolo@novell.com diff --git a/ddclient.spec b/ddclient.spec index 54358f8..cf2e295 100644 --- a/ddclient.spec +++ b/ddclient.spec @@ -17,25 +17,27 @@ # norootforbuild +#Distribution: %dist +#Packager: %packager +#Vendor: %vendor Name: ddclient -License: GPL v2 or later -Group: Productivity/Networking/DNS/Utilities -Requires: perl >= 5.004 -Suggests: perl-IO-Socket-SSL -PreReq: %fillup_prereq -AutoReqProv: on +Summary: A Perl Client to Update Dynamic DNS Entries Version: 3.8.0 Release: 4 +License: GPL v2 or later +Group: Productivity/Networking/DNS/Utilities +AutoReqProv: on Url: http://ddclient.sourceforge.net/ -BuildRoot: %{_tmppath}/%{name}-%{version}-build -Summary: A Perl Client to Update Dynamic DNS Entries Source0: http://switch.dl.sourceforge.net/sourceforge/ddclient/%{name}-%{version}.tar.bz2 Source1: rc.ddclient -Source2: ddclient.sysconfig -Patch0: ddclient-3.6.3-config.patch -Patch1: ddclient-3.7.1-config.patch -Patch2: ddclient-3.7.1-sysconfig.patch +Source2: %{name}.sysconfig +Patch0: %{name}-3.8.0-config.patch +Patch1: %{name}-3.8.0-update_nic.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-build +PreReq: %fillup_prereq +Requires: perl >= 5.004 +Suggests: perl-IO-Socket-SSL %description ddclient is a small full-featured client requiring only Perl. Supported @@ -58,9 +60,8 @@ Authors: %prep %setup -%patch0 -p1 -b _orig +%patch0 -p1 %patch1 -p1 -%patch2 -p1 rm -f sample-etc_ddclient.conf.orig chmod a-x sample-etc* mkdir examples @@ -81,16 +82,16 @@ mv sample-ddclient-wrapper.sh examples %install #make DESTDIR=$RPM_BUILD_ROOT install -mkdir -p $RPM_BUILD_ROOT/usr/sbin -mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/init.d -install -m 755 %{name} $RPM_BUILD_ROOT/usr/sbin/ -install -m 644 sample-etc_ddclient.conf $RPM_BUILD_ROOT/%{_sysconfdir}/ddclient.conf +%{__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 # init script and config file -install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/ddclient -ln -s %{_sysconfdir}/init.d/ddclient $RPM_BUILD_ROOT/usr/sbin/rcddclient -install -d -m 755 $RPM_BUILD_ROOT/var/adm/fillup-templates -install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.ddclient -install -d -m 755 $RPM_BUILD_ROOT/var/cache/ddclient +%{__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} %post %{fillup_only} @@ -104,16 +105,16 @@ install -d -m 755 $RPM_BUILD_ROOT/var/cache/ddclient %clean # Clear up the mess -[ "$RPM_BUILD_ROOT" != "" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT; +%{__rm} -rf $RPM_BUILD_ROOT; %files %defattr(-, root, root) -%config(noreplace) %attr(600,root,root) %{_sysconfdir}/ddclient.conf -%config %attr(0755,root,root) /etc/init.d/ddclient -/usr/sbin/%{name} -/usr/sbin/rcddclient -/var/adm/fillup-templates/sysconfig.ddclient -%dir /var/cache/ddclient %doc COPY* README* sample* examples +%config(noreplace) %attr(600,root,root) %{_sysconfdir}/%{name}.conf +%config %attr(0755,root,root) /etc/init.d/%{name} +%{_sbindir}/%{name} +%{_sbindir}/rc%{name} +/var/adm/fillup-templates/sysconfig.%{name} +%dir /var/cache/%{name} %changelog diff --git a/ddclient.sysconfig b/ddclient.sysconfig index fa12879..72ca9ac 100644 --- a/ddclient.sysconfig +++ b/ddclient.sysconfig @@ -13,6 +13,19 @@ DDCLIENT_INTERVALL="300" ## Default: "" ## ServiceRestart: ddclient # -# additional startup options, e.g. "-debug" +# optional per-service arguments (see below). +# +# -{no}retry : retry failed updates. (default: noretry). +# -{no}force : force an update even if the update may be unnecessary (default: noforce). +# -timeout max : wait at most 'max' seconds for the host to respond (default: 0). +# -{no}syslog : log messages to syslog (default: nosyslog). +# -facility {type} : log messages to syslog to facility {type} (default: daemon). +# -priority {pri} : log messages to syslog with priority {pri} (default: notice). +# -{no}exec : do {not} execute; just show what would be done (default: exec). +# -{no}debug : print {no} debugging information (default: nodebug). +# -{no}verbose : print {no} verbose information (default: noverbose). +# -{no}quiet : print {no} messages for unnecessary updates (default: noquiet). +# -help : this message (default: 0). +# -{no}query : print {no} ip addresses and exit. # DDCLIENT_OPTIONS="" diff --git a/rc.ddclient b/rc.ddclient index 4e0a1b1..cee2016 100644 --- a/rc.ddclient +++ b/rc.ddclient @@ -12,9 +12,9 @@ ### BEGIN INIT INFO # Provides: ddclient # Required-Start: $syslog $local_fs $network -# Should-Start: $time ypbind sendmail $remote_fs +# Should-Start: $time ypbind sendmail $remote_fs rp-pppoe # Required-Stop: $syslog $local_fs -# Should-Stop: $time ypbind sendmail $remote_fs +# Should-Stop: $time ypbind sendmail $remote_fs rp-pppoe # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: ddclient a daemon to update dynamic DNS entries @@ -25,59 +25,104 @@ # -# Source SuSE config, only if exists with size greater zero -test -s /etc/rc.status && . /etc/rc.status - -DDCLIENT_SYSCONFIG=/etc/sysconfig/ddclient -DDCLIENT_CONFIG=/etc/ddclient.conf DDCLIENT_BIN=/usr/sbin/ddclient +DDCLIENT_CONFIG=/etc/ddclient.conf +DDCLIENT_SYSCONFIG=/etc/sysconfig/ddclient -test -s "$DDCLIENT_CONFIG" || exit 6 - -test -s "$DDCLIENT_SYSCONFIG" && . "$DDCLIENT_SYSCONFIG" +[ -x $DDCLIENT_BIN ] || exit 5 +[ -s $DDCLIENT_CONFIG ] || exit 6 +[ -s $DDCLIENT_SYSCONFIG ] && . $DDCLIENT_SYSCONFIG +# some defaults dd_intervall=${DDCLIENT_INTERVALL:-300} +# if no "use=" is set in ddclient.conf try 'ppp0' as a default +if [ `/bin/cat $DDCLIENT_CONFIG | grep -e "^use=" >/dev/null; echo $?` -eq 0 ]; then + dd_use= +else + dd_use="-use if -if ppp0" +fi + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_failed set local and overall rc status to failed +# rc_failed set local and overall rc status to +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status +. /etc/rc.status + +# First reset status of this service rc_reset +# Return values acc. to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - insufficient privilege +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running +# +# Note that starting an already running service, stopping +# or restarting a not-running service as well as the restart +# with force-reload (in case signalling is not supported) are +# considered a success. + case "$1" in start) - echo -n "Starting ddclient daemon" - startproc "$DDCLIENT_BIN" -daemon $dd_intervall $DDCLIENT_OPTIONS - rc_status -v - ;; + echo -n "Starting ddclient daemon :" + /sbin/startproc "$DDCLIENT_BIN" -daemon $dd_intervall "$dd_use" $DDCLIENT_OPTIONS + + # remember status and be verbose + rc_status -v + ;; stop) - echo -n "Shutting down ddclient daemon" - killproc -TERM `basename "$DDCLIENT_BIN"` - rc_status -v - ;; + echo -n "Shutting down ddclient daemon :" + /sbin/killproc -TERM `basename "$DDCLIENT_BIN"` + + # remember status and be verbose + rc_status -v + ;; try-restart) $0 status >/dev/null && $0 restart + # Remember status and be quiet rc_status ;; restart) - $0 stop - $0 start - rc_status - ;; + $0 stop + $0 start + + # Remember status and be quiet + rc_status + ;; force-reload) # echo -n "Reload service ddclient" rc_failed 3 + + # remember status and be verbose rc_status -v ;; reload) rc_failed 3 + + # remember status and be verbose rc_status -v ;; status) - echo -n "Checking for service ddclient " - checkproc `basename "$DDCLIENT_BIN"` - rc_status -v - ;; + echo -n "Checking for service ddclient :" + /sbin/checkproc `basename "$DDCLIENT_BIN"` + + # remember status and be verbose + rc_status -v + ;; *) - echo "Usage: ddclient {start|stop|try-restart|restart|status}" - exit 1 + echo "Usage: ddclient {start|stop|try-restart|restart|status}" + exit 1 esac rc_exit