[Patchteam] New Package Dudders - a utility for updating DNS records
[Patchteam] New Package Dudders - a utility for updating DNS records
Signed-off-by: Dean Scarff <dos@scarff.id.au>


git-svn-id: svn://svn.openwrt.org/openwrt/packages@22695 3c298f89-4303-0410-b956-a3cf2f4a3e73

--- /dev/null
+++ b/net/dudders/Makefile
@@ -1,1 +1,64 @@
+# $Id$
 
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dudders
+PKG_VERSION:=1.04
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_SHA1SUM:=ae3fc90804698468c8f8e285c2387eb629c25dbf
+PKG_CAT:=bzcat
+PKG_BUILD_DEPENDS:=+libopenssl +libgcrypt
+PKG_FIXUP:=libtool
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dudders
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=DNS
+  TITLE:=DNS Update SIG(0) client
+  MAINTAINER:=<dos@scarff.id.au>
+  DEPENDS:=
+  URL:=http://dudders.sourceforge.net/
+endef
+
+define Package/dudders/description
+  Dudders is a utility for updating DNS records.  It points
+  a domain name to a given IP address, using the RFC2136 DNS
+  UPDATE protocol and a SIG(0) signature.  It is designed with
+  embedded systems in mind.
+
+  You must have either libopenssl or libgcrypt installed to
+  use this package.
+endef
+
+define Package/dudders/conffiles
+/etc/config/dudders
+endef
+
+EXTRA_CFLAGS:= -DNDEBUG -std=gnu99
+
+CONFIGURE_ARGS+= \
+                --with-libgcrypt-prefix="$(STAGING_DIR)/usr"
+
+define Package/dudders/install
+        $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dudders $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib/dudders
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/dudders/crypt_gcrypt.so \
+                      $(1)/usr/lib/dudders
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/dudders/crypt_openssl.so \
+                       $(1)/usr/lib/dudders
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/dudders.conf $(1)/etc/config/dudders
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/dudders.hotplug $(1)/etc/hotplug.d/iface/30-dudders
+endef
+
+$(eval $(call BuildPackage,dudders))
+

--- /dev/null
+++ b/net/dudders/files/dudders.conf
@@ -1,1 +1,8 @@
+config dudders
+        option enabled  'no'
+        option tcp      'yes'
+        option keyfile '/tmp/dudders.private'
+        option keyname  'owner.example.com'
+        option hostname 'test.example.com'
+       option ttl       86400
 

--- /dev/null
+++ b/net/dudders/files/dudders.hotplug
@@ -1,1 +1,47 @@
+#!/bin/sh
 
+. /etc/functions.sh
+
+config_cb() {
+       local cfg="$CONFIG_SECTION"
+       local cfgtype
+       config_get cfgtype "$cfg" TYPE
+       dudders=/usr/bin/dudders
+
+       case "$cfgtype" in
+               dudders)
+                       config_get enabled  $cfg enabled
+                       [ "$enabled" = "yes" ] || return 0
+
+                       config_get tcp      $cfg tcp
+                       config_get keyname  $cfg keyname
+                       config_get mname    $cfg mname
+                       config_get zone     $cfg zone
+                       config_get keyfile  $cfg keyfile
+                       config_get hostname $cfg hostname
+                       config_get ttl      $cfg ttl
+
+                       [ -r "$keyfile" ] || return 1
+                       sleep 1
+                       interface=$(route -n 2>&- \
+                         |grep '^0.0.0.0' \
+                         |sed -e 's/.* \([^ ]\+\)$/\1/')
+                       [ -z "$interface" ] && return 0
+                       [ "$DEVICE" = "$interface" -o \
+                         "$IFNAME" = "$interface" -o \
+                         "$PPP_IFACE" = "$interface" ] || return 0
+                       ipaddr=${PPP_LOCAL:-${IPLOCAL:-$(ifconfig "$interface" \
+                           |grep -o 'addr:[^ ]\+' \
+                           |sed -e 's/addr://')}}
+                       OPTS=${keyname:+" -k '$keyname'"}
+                       [ "$tcp" = "yes" ] && OPTS=$OPTS" -T"
+                       OPTS=$OPTS${mname:+" -m '$mname'"}
+                       OPTS=$OPTS${zone:+" -z '$zone'"}
+                       eval $dudders -k $keyfile $OPTS $hostname $ttl $ipaddr
+               ;;
+       esac
+}
+case "${ACTION:-ifup}" in
+       ifup) config_load dudders ;;
+esac
+

comments