make ez-ipupdate uci aware, Signed-off-by: David Bird <david@coova.com>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@11363 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
blogic 2008-06-05 09:45:34 +00:00
parent c0cd540e53
commit e8216f812d
3 changed files with 75 additions and 25 deletions

View File

@ -28,10 +28,6 @@ define Package/ez-ipupdate
URL:=http://ez-ipupdate.com/ URL:=http://ez-ipupdate.com/
endef endef
define Package/ez-ipupdate/conffiles
/etc/ez-ipupdate.conf
endef
# uses GNU configure # uses GNU configure
define Build/Compile define Build/Compile
@ -41,8 +37,8 @@ endef
define Package/ez-ipupdate/install define Package/ez-ipupdate/install
$(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ez-ipupdate $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/ez-ipupdate $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc $(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_CONF) ./files/ez-ipupdate.conf $(1)/etc/ $(INSTALL_CONF) ./files/ez-ipupdate.config $(1)/etc/config/ddns
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_BIN) ./files/ez-ipupdate.hotplug $(1)/etc/hotplug.d/iface/30-ez-ipupdate $(INSTALL_BIN) ./files/ez-ipupdate.hotplug $(1)/etc/hotplug.d/iface/30-ez-ipupdate
endef endef

View File

@ -1,8 +0,0 @@
service-type=zoneedit
user=myname:mypassword
host=mydomain.com
quiet
# Do not change the lines below
cache-file=/tmp/ez-ipupdate.cache
pid-file=/var/run/ez-ipupdate.pid

View File

@ -1,14 +1,76 @@
NAME=ez-ipupdate NAME=ez-ipupdate
CONFIG=/etc/$NAME.conf
COMMAND=/usr/sbin/$NAME COMMAND=/usr/sbin/$NAME
[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && { case "$ACTION" in
[ -x $COMMAND ] && [ -r $CONFIG ] && { ifup|ifdown)
include /lib/network cleanup() {
scan_interfaces [ -e $1 ] && {
kill -9 $(cat $1)
rm $1
}
}
config_get ifname wan ifname ddns() {
[ -n "$ifname" ] && \ local cfg="$1"
$COMMAND -c $CONFIG -i $ifname 2>&1 | logger -t $NAME config_get program $cfg program
} & [ "$program" = "$NAME" ] && {
} config_get interface $cfg interface
[ "$interface" = "$INTERFACE" ] && {
config_get dev "$INTERFACE" ifname
config_get enabled $cfg enabled
enabled=${enabled:-1}
config_get pidfile $cfg pidfile
pidfile=${pidfile:-/var/run/$NAME-$dev.pid}
case "$ACTION" in
ifdown)
cleanup $pidfile
;;
*)
case "$enabled" in
1|yes|true)
[ ! -e $pidfile ] && {
config_get cache $cfg cache
[ -z "$cache" ] && cache=/tmp/$NAME-$dev.cache
config_get config $cfg config
[ -z "$config" ] && {
config=/var/run/$NAME-$dev.conf
config_get service $cfg service
config_get username $cfg username
config_get password $cfg password
config_get hostname $cfg hostname
service=${service:-"dyndns"}
cat > $config <<EOF
service-type=$service
user=$username:$password
host=$hostname
cache-file=$cache
pid-file=$pidfile
interface=$dev
quiet
EOF
}
$COMMAND -d -c $config 2>&1 | logger -t $NAME &
}
;;
*)
cleanup $pidfile
;;
esac
esac
}
}
}
include /lib/network
scan_interfaces
config_load ddns
config_foreach ddns ddns
;;
esac