2007-07-20 12:15:36 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
START=50
|
|
|
|
|
|
|
|
start_service () {
|
|
|
|
local section="$1"
|
2007-09-14 14:09:40 +00:00
|
|
|
config_get service "$section" service
|
|
|
|
config_get username "$section" username
|
|
|
|
config_get password "$section" password
|
|
|
|
config_get host "$section" host
|
|
|
|
config_get update "$section" update
|
2007-07-20 12:15:36 +00:00
|
|
|
|
|
|
|
[ "$update" = 1 ] && {
|
2008-07-15 02:45:48 +00:00
|
|
|
if [ "$service" = "dyndns" ]; then
|
|
|
|
wget http://checkip.dyndns.org -O /tmp/updatedd_ip_check
|
|
|
|
current_ip=`cat /tmp/updatedd_ip_check |cut -d':' -f2|cut -d'<' -f1 |cut -d' ' -f2`
|
|
|
|
rm /tmp/updatedd_ip_check
|
|
|
|
old_ip=`nslookup "$host" |grep "$host" -A 1 |grep Address |cut -d' ' -f3`
|
|
|
|
if [ "$current_ip" = "$old_ip" ]; then
|
|
|
|
echo "Preventing abusive update"
|
|
|
|
abusive=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ "$abusive" != "1" ]; then
|
|
|
|
/usr/bin/updatedd -Y $service -- $username:$password $host
|
|
|
|
fi
|
2007-07-20 12:15:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
|
|
|
config_load "updatedd"
|
|
|
|
config_foreach start_service updatedd
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
killall updatedd
|
|
|
|
}
|