[PATCH] package/yaddns: bump version, add uci compatibility
Use a newer multi-service version, and integrate into the UCI configuration system properly (should work with luci too). Signed-off-by: Paul Fertser <fercerpav@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/packages@24959 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
69c5433778
commit
802a9b66e1
@ -8,12 +8,15 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=yaddns
|
||||
PKG_VERSION:=0.1.2
|
||||
PKG_VERSION:=1.0-rc2
|
||||
PKG_REV:=1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@SF/yaddns
|
||||
PKG_MD5SUM:=b76aad36ca3341814d5f0c17d6420e8a
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=svn://patatrac.info/yaddns/tags/yaddns-1.0-rc2
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
PKG_SOURCE_PROTO:=svn
|
||||
|
||||
PKG_INSTALL:=1
|
||||
|
||||
@ -31,9 +34,21 @@ Yaddns is a small ddns client with multiple ddns server supports (dyndns, ...)
|
||||
and a high flexibility. Yaddns is particularly appropriate for embedded systems.
|
||||
endef
|
||||
|
||||
define Package/yaddns/conffiles
|
||||
/etc/config/ddns
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
(cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
|
||||
$(SED) '/^AM_CFLAGS/ s/-Werror//' src/Makefile.am; \
|
||||
./autogen.sh);
|
||||
$(call Build/Configure/Default, )
|
||||
endef
|
||||
|
||||
define Package/yaddns/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/yaddns $(1)/usr/bin/
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,yaddns))
|
||||
|
67
net/yaddns/files/etc/config/ddns
Normal file
67
net/yaddns/files/etc/config/ddns
Normal file
@ -0,0 +1,67 @@
|
||||
#################################################################
|
||||
# In order to enable dynamic dns you need at least one section, and in that
|
||||
# seciton the "enabled" option must be set to one
|
||||
#
|
||||
# Each section represents an update to a different service
|
||||
#
|
||||
# You specify your domain name, your username and your password with the optins
|
||||
# "domain", "username" and "password" respectively
|
||||
#
|
||||
# Next you need to specify the name of the service you are connecting to "eg.
|
||||
# dyndns". The list of the available dns services is specified in the
|
||||
# /usr/lib/ddns/services file.
|
||||
#
|
||||
# We also need to specify the source of the ip address to associate with your
|
||||
# domain. The "ip_source" option can be "network", "interface" or "web", with
|
||||
# "network" as the default.
|
||||
#
|
||||
# If "ip_source" is "network" you specify a network section in your
|
||||
# /etc/network config file (e.g. "wan", which is the default) with the
|
||||
# "ip_network" option. If you specify "wan", you will update with whatever the
|
||||
# ip for your wan is.
|
||||
#
|
||||
# If "ip_source" is "interface" you specify a hardware interface (e.g. "eth1")
|
||||
# and whatever the current ip of this interface is will be associated with the
|
||||
# domain when an update is performed.
|
||||
#
|
||||
# If "ip_source" is "script" you specify a script to obtain ip address. The
|
||||
# "ip_script" option should contain path to your script.
|
||||
#
|
||||
# The last possibility is that "ip_source" is "web", which means that in order
|
||||
# to obtain our ip address we will connect to a website, and the first valid ip
|
||||
# address listed on that page will be assumed to be ours. If you are behind
|
||||
# another firewall this is the best option since none of the local networks or
|
||||
# interfaces will have the external ip. The website to connect to is specified
|
||||
# by the "ip_url" option.
|
||||
#
|
||||
# Finally we need to specify how often to check whether we need to check
|
||||
# whether the ip address has changed (and if so update it), this is only valid
|
||||
# for the "web" method. Use the "check_interval" to specify how often to check
|
||||
# whether an update is necessary. Specify the units for this value with the
|
||||
# "check_unit" option. Units can be "days", "hours", "minutes" or "seconds".
|
||||
# The default check_interval is 600 seconds, or ten minutes.
|
||||
#
|
||||
# For yaddns all ip_* options are system-wide and are taken from the first
|
||||
# enabled section.
|
||||
#
|
||||
#########################################################
|
||||
|
||||
config service "myddns"
|
||||
option enabled "0"
|
||||
|
||||
option service_name "dyndns"
|
||||
option domain "mypersonaldomain.dyndns.org"
|
||||
option username "myusername"
|
||||
option password "mypassword"
|
||||
|
||||
option ip_source "network"
|
||||
option ip_network "wan"
|
||||
|
||||
#option ip_source "interface"
|
||||
#option ip_interface "eth0.1"
|
||||
|
||||
#option ip_source "web"
|
||||
#option ip_url "http://checkip.dyndns.org"
|
||||
#option check_interval "10"
|
||||
#option check_unit "minutes"
|
||||
|
117
net/yaddns/files/etc/hotplug.d/iface/25-ddns
Normal file
117
net/yaddns/files/etc/hotplug.d/iface/25-ddns
Normal file
@ -0,0 +1,117 @@
|
||||
#!/bin/sh
|
||||
|
||||
YADDNS_CONF=/tmp/yaddns.conf
|
||||
YADDNS_PID=/var/run/yaddns.pid
|
||||
|
||||
prepare_yaddns_conf ()
|
||||
{
|
||||
. /etc/functions.sh
|
||||
include /lib/network
|
||||
|
||||
> $YADDNS_CONF
|
||||
|
||||
SECTIONS=""
|
||||
config_cb()
|
||||
{
|
||||
SECTIONS="$SECTIONS $2"
|
||||
}
|
||||
config_load "ddns"
|
||||
|
||||
for section in $SECTIONS; do
|
||||
config_get enabled $section enabled
|
||||
if [ "$enabled" = "1" ]; then
|
||||
if [ -z "$header_filled" ]; then
|
||||
config_get ip_source $section ip_source
|
||||
#if ip source is not defined, assume we want to get ip from wan
|
||||
if [ "$ip_source" != "interface" ] && [ "$ip_source" != "web" ]; then
|
||||
ip_source="network"
|
||||
fi
|
||||
if [ "$ip_source" = "interface" ]; then
|
||||
config_get ip_interface $section ip_interface
|
||||
fi
|
||||
if [ "$ip_source" = "network" ]; then
|
||||
if [ -z "$ip_network" ]; then
|
||||
ip_network="wan"
|
||||
fi
|
||||
scan_interfaces
|
||||
config_load /var/state/network
|
||||
config_get ip_interface $ip_network ifname
|
||||
fi
|
||||
if [ "$ip_source" = "web" ]; then
|
||||
config_get ip_url $section ip_url
|
||||
config_get check_interval $section check_interval
|
||||
config_get check_unit $section check_unit
|
||||
if [ -z "$check_interval" ]; then
|
||||
check_interval=600
|
||||
fi
|
||||
if [ -z "$check_unit" ]; then
|
||||
check_unit="seconds"
|
||||
fi
|
||||
if [ -z "$ip_url" ]; then
|
||||
ip_url="http://checkip.dyndns.org/"
|
||||
fi
|
||||
case "$check_unit" in
|
||||
"days" )
|
||||
check_interval_seconds=$(($check_interval*60*60*24))
|
||||
;;
|
||||
"hours" )
|
||||
check_interval_seconds=$(($check_interval*60*60))
|
||||
;;
|
||||
"minutes" )
|
||||
check_interval_seconds=$(($check_interval*60))
|
||||
;;
|
||||
"seconds" )
|
||||
check_interval_seconds=$check_interval
|
||||
;;
|
||||
* )
|
||||
#default is hours
|
||||
check_interval_seconds=$(($check_interval*60*60))
|
||||
;;
|
||||
esac
|
||||
myip_host="`echo $ip_url | sed 's%.*//\([^:/]*\).*%\1%'`"
|
||||
myip_port="`echo $ip_url | sed -n 's%.*//[^:]*:\([0-9]\+\).*%\1%; t m; b; :m p'`"
|
||||
if [ -z "$myip_port" ]; then
|
||||
myip_port=80
|
||||
fi
|
||||
myip_path="`echo $ip_url | sed 's%.*//[^/]*\(.*\)%\1%'`"
|
||||
if [ -z "$myip_path" ]; then
|
||||
myip_path="/"
|
||||
fi
|
||||
echo mode = \"indirect\" >> $YADDNS_CONF
|
||||
echo myip_host = \"$myip_host\" >> $YADDNS_CONF
|
||||
echo myip_path = \"$myip_path\" >> $YADDNS_CONF
|
||||
echo myip_port = \"$myip_port\" >> $YADDNS_CONF
|
||||
echo myip_upint = \"$check_interval_seconds\" >> $YADDNS_CONF
|
||||
else
|
||||
echo mode = \"direct\" >> $YADDNS_CONF
|
||||
echo wanifname = \"$ip_interface\" >> $YADDNS_CONF
|
||||
fi
|
||||
echo >> $YADDNS_CONF
|
||||
header_filled=1
|
||||
fi
|
||||
config_get service_name $section service_name
|
||||
config_get domain $section domain
|
||||
config_get username $section username
|
||||
config_get password $section password
|
||||
echo account \{ >> $YADDNS_CONF
|
||||
echo -e '\tname = '\"$section\" >> $YADDNS_CONF
|
||||
echo -e '\tservice = '\"$service_name\" >> $YADDNS_CONF
|
||||
echo -e '\tusername = '\"$username\" >> $YADDNS_CONF
|
||||
echo -e '\tpassword = '\"$password\" >> $YADDNS_CONF
|
||||
echo -e '\thostname = '\"$domain\" >> $YADDNS_CONF
|
||||
echo \} >> $YADDNS_CONF
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [ "$INTERFACE" = "wan" ] && [ "$ACTION" = "ifup" ]
|
||||
then
|
||||
prepare_yaddns_conf
|
||||
pid=`pidof yaddns`
|
||||
if [ -z "$pid" ]; then
|
||||
yaddns -f $YADDNS_CONF -p $YADDNS_PID -D
|
||||
else
|
||||
kill -HUP $pid
|
||||
fi
|
||||
fi
|
||||
|
5
net/yaddns/files/usr/lib/ddns/services
Normal file
5
net/yaddns/files/usr/lib/ddns/services
Normal file
@ -0,0 +1,5 @@
|
||||
"changeip"
|
||||
"dyndns"
|
||||
"dyndnsit"
|
||||
"no-ip"
|
||||
"ovh"
|
Loading…
x
Reference in New Issue
Block a user