-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Torsten Landschoff wrote:
> On Fri, Feb 13, 2009 at 06:43:19AM +0100, Christian Perrier wrote:
>  
>> Then I would adive Torsten to issue a call for translation updates
>> after adding the new templates so that translators have a chance to
>> re-complete their work before the release of the package.
> 
> Noted, fine with me.
> 
> Greetings, Torsten

Here's the updated patch including the new templates.

Let me know anything else I can help with.

Take care,

- --
Dan McCombs
Dynamic Network Services, Inc.
http://www.dyndns.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmVdzMACgkQSTakzmXY5/hc0QCdEru6GqurDvyGfrSEDT6YI1uY
FN0Anim1z1BumsHJH+iZtFD1HIo2IyUt
=GUcs
-----END PGP SIGNATURE-----
diff -Naur ddclient-3.7.3/debian/config ddclient-3.7.3-dyndns/debian/config
--- ddclient-3.7.3/debian/config	2009-02-11 08:56:31.000000000 -0500
+++ ddclient-3.7.3-dyndns/debian/config	2009-02-13 08:28:02.000000000 -0500
@@ -95,27 +95,53 @@
   fi
 
   # ask the user about the dynamic DNS names, account and interface
-  db_input critical ddclient/names || true
   db_input critical ddclient/username || true
   db_input critical ddclient/password || true
-  db_input critical ddclient/interface || true
+  db_get ddclient/service
+  # if the chosen service is dyndns, ask some extra questions.  otherwise, set them to false
+  if [ "$RET" = "www.dyndns.com" ]; then
+  	db_input critical ddclient/checkip || true
+	if [ -f /usr/bin/wget ]; then
+		db_input critical ddclient/fetchhosts || true
+	else
+		db_fset ddclient/fetchhosts seen true
+		db_set ddclient/fetchhosts Manually
+	fi
+  else
+  	db_fset ddclient/checkip seen true
+	db_fset ddclient/fetchhosts seen true
+	db_set ddclient/checkip false
+	db_set ddclient/fetchhosts Manually
+  fi
+  db_go
+  db_get ddclient/checkip
+  # ask the traditional questions if the dyndns questions weren't answered true
+  if [ "$RET" = "false" ]; then
+	db_input critical ddclient/interface || true
+  fi
+  db_get ddclient/fetchhosts
+  if [ "$RET" = "Manually" ]; then
+  	db_input critical ddclient/names || true
+  fi
   db_go
 
   # set the default mode ddclient should run in (ip-up | daemon),
   # depending on the entered interface (XpppX or other)
   db_get ddclient/interface
   interface=$RET
+  db_get ddclient/checkip
+  checkip=$RET
 
-  # if it is actually a ppp or related interface
-  if [ -z "${interface##*ppp*}" ]; then
+  # if it is actually a ppp or related interface, and we're not using checkip
+  if [ "$checkip" != "true"  ] && [ -z "${interface##*ppp*}" ]; then
     db_fget ddclient/run_ipup seen
-    if [ $RET = "false" ]; then
+    if [ "$RET" = "false" ]; then
       db_set ddclient/run_ipup true
     fi
   # if it is an interface of a different type
   else
     db_fget ddclient/run_daemon seen
-    if [ $RET = "false" ]; then
+    if [ "$RET" = "false" ]; then
       db_set ddclient/run_daemon true
     fi
   fi
@@ -127,7 +153,7 @@
 
   # if ddclient should run in daemon mode we ask for the update interval
   db_get ddclient/run_daemon
-  if [ $RET = "true" ]; then
+  if [ "$RET" = "true" ]; then
     db_input medium ddclient/daemon_interval || true
     db_go
   fi
diff -Naur ddclient-3.7.3/debian/ddclient.templates ddclient-3.7.3-dyndns/debian/ddclient.templates
--- ddclient-3.7.3/debian/ddclient.templates	2009-02-11 08:56:31.000000000 -0500
+++ ddclient-3.7.3-dyndns/debian/ddclient.templates	2009-02-13 08:28:02.000000000 -0500
@@ -38,6 +38,14 @@
 _Description: Password for dynamic DNS service:
  Enter the password you use to log into the dynamic DNS service.
 
+Template: ddclient/checkip
+Type: boolean
+Default: true
+_Description: Find public IP using checkip.dyndns.com?
+ Please choose whether ddclient should try to find the IP address
+ of this machine via the DynDNS web interface.  This is recommended
+ for machines that are using Network Address Translation.
+
 Template: ddclient/interface
 Type: string
 _Description: Interface used for dynamic DNS service:
@@ -73,3 +81,32 @@
  this. Maybe you modified the configuration file manually, thus it won't
  be modified. If you want a new config file to be created, please run
  "dpkg-reconfigure ddclient".
+
+Template: ddclient/fetchhosts
+Type: select
+Default: From list
+Choices: From list, Manually
+_Description: Selection method for updated names:
+ You'll have to select which host names to update using ddclient.  You can
+ select host names to update from a list (taken from your DynDNS account)
+ or enter them manually.
+
+Template: ddclient/hostslist
+Type: multiselect
+Choices: ${choices}
+_Description: Host names to keep updated:
+ The list of host names managed via your DynDNS account has been downloaded.
+ Please choose the one(s) for which ddclient should be used to keep IP address
+ records up to date.
+
+Template: ddclient/blankhostslist
+Type: error
+_Description: Empty host list
+ The list of host names managed under your account is empty when retrieved
+ from the dynamic DNS service website.
+ .
+ You may have provided an incorrect username or password, or the online account
+ may have no host names configured.
+ .
+ Please check your account to be sure you have host names configured, then run
+ "dpkg-reconfigure ddclient" to input your username and password again.
diff -Naur ddclient-3.7.3/debian/postinst ddclient-3.7.3-dyndns/debian/postinst
--- ddclient-3.7.3/debian/postinst	2009-02-11 08:56:31.000000000 -0500
+++ ddclient-3.7.3-dyndns/debian/postinst	2009-02-13 08:28:02.000000000 -0500
@@ -35,9 +35,33 @@
   db_version 2.0 || { echo "ddclient.config: \
     need DebConf 2.0 or later"; exit 1; }
 
-	
   # if /etc/ddclient.conf does not exist:
   if [ ! -f /etc/ddclient.conf ]; then
+  	# check if we should fetch the hostlist for a dyndns account
+	db_get ddclient/fetchhosts
+	if [ "$RET" = "From list" ]; then
+		# get the dyndns host list
+		db_get ddclient/username	&& username="$RET"
+		db_get ddclient/password	&& password="$RET"
+		hostslist=`/usr/bin/wget http://$username:$passw...@update.dyndns.com/text/gethostlist -q -O - | awk -F \: '{print $2, $4}' | sed -e "N;s/ \n/,/g" | sed -e "s/,/, /g"`
+		
+		# add the list to our multichoice template, then prompt the user
+		db_subst ddclient/hostslist choices $hostslist
+		db_input critical ddclient/hostslist || true
+		db_go
+	
+		# set names using the host list to write it to the config file later
+		db_get ddclient/hostslist
+		hostslist=`echo "$RET" | sed -e "s/, /,/g"`
+		db_set ddclient/names "$hostslist"
+
+		# if the hostslist was blank, let the user know some possible reasons
+		if [ -z $hostslist ]; then
+			db_input high ddclient/blankhostslist
+			db_go
+		fi
+	fi
+
     # get the values from the debconf database
     db_get ddclient/protocol 		&& protocol="$RET"
     db_get ddclient/server   		&& server="$RET"
@@ -45,8 +69,15 @@
     db_get ddclient/username 		&& username="$RET"
     db_get ddclient/password \
       && password=$(echo "$RET"|sed -e "s/'/\\\\'/g")
-    db_get ddclient/interface 		&& interface="$RET"
-
+    db_get ddclient/interface
+	if [ "$RET" ]; then
+		interface="use=if, if=$RET"
+	else
+		db_get ddclient/checkip
+		if [ "$RET" = "true" ]; then
+			interface="use=web, web=checkip.dyndns.com, web-skip='IP Address'"
+		fi
+	fi
 
     # create configuration file /etc/ddclient.conf
     config=`mktemp /etc/ddclient.conf.XXXXXX`
@@ -58,7 +89,7 @@
 
 pid=/var/run/ddclient.pid
 protocol=$protocol
-use=if, if=$interface
+$interface
 server=$server
 login=$username
 password='$password'

Reply via email to