Convert updatedd to the uci config format, add a hotplug script as well (#1213)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@6436 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
b59e2debca
commit
252940db34
@ -113,6 +113,8 @@ endef
|
|||||||
define Package/updatedd/install
|
define Package/updatedd/install
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./files/ddns.init $(1)/etc/init.d/ddns
|
$(INSTALL_BIN) ./files/ddns.init $(1)/etc/init.d/ddns
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
$(INSTALL_DATA) ./files/ddns.config $(1)/etc/config/updatedd
|
||||||
$(INSTALL_DIR) $(1)/usr/bin
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/updatedd $(1)/usr/bin/
|
$(CP) $(PKG_INSTALL_DIR)/usr/bin/updatedd $(1)/usr/bin/
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/updatedd
|
$(INSTALL_DIR) $(1)/usr/lib/updatedd
|
||||||
|
6
net/updatedd/files/ddns.config
Normal file
6
net/updatedd/files/ddns.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
config updatedd
|
||||||
|
option ddns_service ''
|
||||||
|
option ddns_user ''
|
||||||
|
option ddns_passwd ''
|
||||||
|
option ddns_host ''
|
||||||
|
option ddns_update '0'
|
15
net/updatedd/files/ddns.hotplug
Normal file
15
net/updatedd/files/ddns.hotplug
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
NAME=updatedd
|
||||||
|
CONFIG=/etc/$NAME.conf
|
||||||
|
COMMAND=/usr/sbin/$NAME
|
||||||
|
|
||||||
|
[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && {
|
||||||
|
[ -x $COMMAND ] && [ -r $CONFIG ] && {
|
||||||
|
include /lib/network
|
||||||
|
scan_interfaces
|
||||||
|
|
||||||
|
config_get ifname wan ifname
|
||||||
|
[ -n "$ifname" ] && {
|
||||||
|
/etc/init.d/ddns restart
|
||||||
|
}
|
||||||
|
} &
|
||||||
|
}
|
@ -1,9 +1,16 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2006 OpenWrt.org
|
# Copyright (C) 2006 OpenWrt.org
|
||||||
|
|
||||||
start() {
|
. /etc/functions.sh
|
||||||
[ -f /etc/default/ddns ] && . /etc/default/ddns
|
|
||||||
|
|
||||||
|
config_load updatedd
|
||||||
|
config_get ddns_service cfg1 ddns_service
|
||||||
|
config_get ddns_user cfg1 ddns_user
|
||||||
|
config_get ddns_passwd cfg1 ddns_passwd
|
||||||
|
config_get ddns_host cfg1 ddns_host
|
||||||
|
config_get ddns_update cfg1 ddns_update
|
||||||
|
|
||||||
|
start() {
|
||||||
[ "$ddns_update" = 1 ] && {
|
[ "$ddns_update" = 1 ] && {
|
||||||
/usr/bin/updatedd -Y $ddns_service -- $ddns_user:$ddns_passwd $ddns_host
|
/usr/bin/updatedd -Y $ddns_service -- $ddns_user:$ddns_passwd $ddns_host
|
||||||
}
|
}
|
||||||
@ -12,3 +19,8 @@ start() {
|
|||||||
stop() {
|
stop() {
|
||||||
killall updatedd
|
killall updatedd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user