Merge pull request #289 from chris5560/master
luci-app-ddns: adaption to new luci structure and cleanup
This commit is contained in:
commit
546de2c81c
7 changed files with 40 additions and 287 deletions
|
@ -1,51 +0,0 @@
|
|||
Version: 2.1.0-3
|
||||
Date: 2014-12-07
|
||||
ddns-scripts: 2.1.0-2 or greater needed
|
||||
|
||||
- modified controller
|
||||
- remove support for ddns-scripts Version 1.x
|
||||
- ddns-scripts not correctly installed do not start
|
||||
- no config file create an empty one
|
||||
- moved log settings to advanced tab
|
||||
- set default syslog level "Notice"
|
||||
- removed special handling for dynamic_dns_helper.sh in postinst
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Version: 2.1.0-2
|
||||
Date: 2014-11-15
|
||||
ddns-scripts: 2.1.0-2 or greater needed
|
||||
|
||||
- moved /usr/lib/ddns/dynamic_dns_lucihelper.sh to ddns-scripts package
|
||||
- fixed error message when validating proxy
|
||||
- modified validating ip_script to allow the usage of parameters
|
||||
- using ipkg/postinst AND ipkg/postinst-pkg as long as LuCI Makefiles did not
|
||||
fullfil requirements of new OpenWrt default_postinst and default_postrm
|
||||
reported in Issue #255
|
||||
- cleanup whitespaces at line ends
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Version: 2.1.0-1
|
||||
Date: 2014-11-09
|
||||
ddns-scripts: 2.1.0-1 or greater needed
|
||||
|
||||
fix verify of entry for DNS server Issue #244
|
||||
https://github.com/openwrt/luci/issues/244
|
||||
add support for option 'update_script'
|
||||
add display of version information when click on "Dynamic DNS" on overview page
|
||||
add verify of installed ddns-scripts version and show as hint if not correct version
|
||||
modified epoch to date conversation
|
||||
cbi object Flag did not set section.changed state, fixed in tools.flag_parse function
|
||||
ucitrack entry no longer needed and removed
|
||||
minor fixes
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Version: 2.0.1-1
|
||||
Date: 2014-09-21
|
||||
ddns-scripts: 2.0.1-1 up to 2.0.1-9
|
||||
|
||||
New DDNS status in System->Status overview
|
||||
New Overview page with option to start/stop a section
|
||||
New Detail page with tabbed view incl. logfile viewer
|
||||
Extended verify of all entries before save to config
|
||||
incl. connect test to DNS- and Proxy-server
|
||||
Support for all available options of ddns-scripts 1.x and 2.x
|
|
@ -1,13 +1,21 @@
|
|||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
# Copyright (C) 2008-2015 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Support for Dynamic DNS
|
||||
LUCI_DEPENDS:=+ddns-scripts
|
||||
LUCI_TITLE:=LuCI Support for Dynamic DNS (ddns-scripts)
|
||||
LUCI_DEPENDS:=+ddns-scripts +luci-mod-admin-full
|
||||
|
||||
PKG_NAME:=luci-app-ddns
|
||||
PKG_VERSION:=2.1.0
|
||||
PKG_RELEASE:=4
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKGARCH:=all
|
||||
|
||||
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
||||
|
||||
include ../../luci.mk
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ LuCI - Lua Configuration Interface
|
|||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
Copyright 2013 Manuel Munz <freifunk at somakoma dot de>
|
||||
Copyright 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -25,8 +26,8 @@ local SYS = require "luci.sys"
|
|||
local DDNS = require "luci.tools.ddns" -- ddns multiused functions
|
||||
local UTIL = require "luci.util"
|
||||
|
||||
local luci_ddns_version = "2.1.0-3" -- luci-app-ddns / openwrt Makefile compatible version
|
||||
local ddns_scripts_min = "2.1.0-2" -- minimum version of ddns-scripts required
|
||||
local luci_ddns_version = "2.1.0-4" -- luci-app-ddns / openwrt Makefile compatible version
|
||||
local ddns_scripts_min = "2.1.0-3" -- minimum version of ddns-scripts required
|
||||
|
||||
function index()
|
||||
-- no services_ipv6 file or no dynamic_dns_lucihelper.sh
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
Copyright 2013 Manuel Munz <freifunk at somakoma dot de>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
]]--
|
||||
|
||||
require("luci.tools.webadmin")
|
||||
|
||||
m = Map("ddns", translate("Dynamic DNS"),
|
||||
translate("Dynamic DNS allows that your router can be reached with " ..
|
||||
"a fixed hostname while having a dynamically changing " ..
|
||||
"IP address."))
|
||||
|
||||
s = m:section(TypedSection, "service", "")
|
||||
s.addremove = true
|
||||
s.anonymous = false
|
||||
|
||||
s:option(Flag, "enabled", translate("Enable"))
|
||||
|
||||
interface = s:option(ListValue, "interface", translate("Event interface"), translate("Network on which the ddns-updater scripts will be started"))
|
||||
luci.tools.webadmin.cbi_add_networks(interface)
|
||||
interface.default = "wan"
|
||||
|
||||
svc = s:option(ListValue, "service_name", translate("Service"))
|
||||
svc.rmempty = false
|
||||
svc.default = "dyndns.org"
|
||||
|
||||
local services = { }
|
||||
local fd = io.open("/usr/lib/ddns/services", "r")
|
||||
if fd then
|
||||
local ln
|
||||
repeat
|
||||
ln = fd:read("*l")
|
||||
local s = ln and ln:match('^%s*"([^"]+)"')
|
||||
if s then services[#services+1] = s end
|
||||
until not ln
|
||||
fd:close()
|
||||
end
|
||||
|
||||
local v
|
||||
for _, v in luci.util.vspairs(services) do
|
||||
svc:value(v)
|
||||
end
|
||||
|
||||
function svc.cfgvalue(...)
|
||||
local v = Value.cfgvalue(...)
|
||||
if not v or #v == 0 then
|
||||
return "-"
|
||||
else
|
||||
return v
|
||||
end
|
||||
end
|
||||
|
||||
function svc.write(self, section, value)
|
||||
if value == "-" then
|
||||
m.uci:delete("ddns", section, self.option)
|
||||
else
|
||||
Value.write(self, section, value)
|
||||
end
|
||||
end
|
||||
|
||||
svc:value("-", "-- "..translate("custom").." --")
|
||||
|
||||
local url = s:option(Value, "update_url", translate("Custom update-URL"))
|
||||
url:depends("service_name", "-")
|
||||
url.rmempty = true
|
||||
|
||||
local hostname = s:option(Value, "domain", translate("Hostname"))
|
||||
hostname.rmempty = true
|
||||
hostname.default = "mypersonaldomain.dyndns.org"
|
||||
hostname.datatype = "host"
|
||||
|
||||
local username = s:option(Value, "username", translate("Username"))
|
||||
username.rmempty = true
|
||||
|
||||
local pw = s:option(Value, "password", translate("Password"))
|
||||
pw.rmempty = true
|
||||
pw.password = true
|
||||
|
||||
require("luci.tools.webadmin")
|
||||
|
||||
local src = s:option(ListValue, "ip_source",
|
||||
translate("Source of IP address"))
|
||||
src.default = "network"
|
||||
src:value("network", translate("network"))
|
||||
src:value("interface", translate("interface"))
|
||||
src:value("web", translate("URL"))
|
||||
|
||||
local iface = s:option(ListValue, "ip_network", translate("Network"))
|
||||
iface:depends("ip_source", "network")
|
||||
iface.rmempty = true
|
||||
iface.default = "wan"
|
||||
luci.tools.webadmin.cbi_add_networks(iface)
|
||||
iface = s:option(ListValue, "ip_interface", translate("Interface"))
|
||||
iface:depends("ip_source", "interface")
|
||||
iface.rmempty = true
|
||||
for k, v in pairs(luci.sys.net.devices()) do
|
||||
iface:value(v)
|
||||
end
|
||||
|
||||
local web = s:option(Value, "ip_url", translate("URL"))
|
||||
web:depends("ip_source", "web")
|
||||
web.default = "http://checkip.dyndns.com/"
|
||||
web.rmempty = true
|
||||
|
||||
|
||||
local ci = s:option(Value, "check_interval", translate("Check for changed IP every"))
|
||||
ci.datatype = "and(uinteger,min(1))"
|
||||
ci.default = 10
|
||||
|
||||
local unit = s:option(ListValue, "check_unit", translate("Check-time unit"))
|
||||
unit.default = "minutes"
|
||||
unit:value("minutes", translate("min"))
|
||||
unit:value("hours", translate("h"))
|
||||
|
||||
fi = s:option(Value, "force_interval", translate("Force update every"))
|
||||
fi.datatype = "and(uinteger,min(1))"
|
||||
fi.default = 72
|
||||
|
||||
local unit = s:option(ListValue, "force_unit", translate("Force-time unit"))
|
||||
unit.default = "hours"
|
||||
unit:value("minutes", translate("min"))
|
||||
unit:value("hours", translate("h"))
|
||||
|
||||
|
||||
return m
|
|
@ -18,6 +18,9 @@ msgid ""
|
|||
"separate Configurations i.e. 'myddns_ipv4' and 'myddns_ipv6'"
|
||||
msgstr ""
|
||||
|
||||
msgid "Build"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"BusyBox's nslookup and Wget do not support to specify the IP version to use "
|
||||
"for communication with DDNS Provider."
|
||||
|
@ -279,6 +282,9 @@ msgstr ""
|
|||
msgid "Please press [Read] button"
|
||||
msgstr ""
|
||||
|
||||
msgid "Please update to the current version!"
|
||||
msgstr ""
|
||||
|
||||
msgid "Process ID"
|
||||
msgstr ""
|
||||
|
||||
|
@ -309,6 +315,9 @@ msgstr ""
|
|||
msgid "Show more"
|
||||
msgstr ""
|
||||
|
||||
msgid "Software update required"
|
||||
msgstr ""
|
||||
|
||||
msgid "Source of IP address"
|
||||
msgstr ""
|
||||
|
||||
|
@ -318,6 +327,11 @@ msgstr ""
|
|||
msgid "Stopped"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"The currently installed 'ddns-scripts' package did not support all available "
|
||||
"settings."
|
||||
msgstr ""
|
||||
|
||||
msgid "There is no service configured."
|
||||
msgstr ""
|
||||
|
||||
|
@ -347,6 +361,9 @@ msgstr ""
|
|||
msgid "User defined script to read systems IP-Address"
|
||||
msgstr ""
|
||||
|
||||
msgid "Version Information"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Writes detailed messages to log file. File will be truncated automatically."
|
||||
msgstr ""
|
||||
|
@ -407,6 +424,9 @@ msgstr ""
|
|||
msgid "install update here"
|
||||
msgstr ""
|
||||
|
||||
msgid "installed"
|
||||
msgstr ""
|
||||
|
||||
msgid "interface"
|
||||
msgstr ""
|
||||
|
||||
|
@ -458,6 +478,9 @@ msgstr ""
|
|||
msgid "or"
|
||||
msgstr ""
|
||||
|
||||
msgid "or greater"
|
||||
msgstr ""
|
||||
|
||||
msgid "please disable"
|
||||
msgstr ""
|
||||
|
||||
|
@ -473,6 +496,9 @@ msgstr ""
|
|||
msgid "proxy port missing"
|
||||
msgstr ""
|
||||
|
||||
msgid "required"
|
||||
msgstr ""
|
||||
|
||||
msgid "seconds"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,24 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
# luci updates are not in sync with ddns-script updates !!!
|
||||
# needed because luci update might delete helper script
|
||||
# copy dynamic_dns_helper.tmp.sh from ddns-scripts
|
||||
cp -f /usr/lib/ddns/dynamic_dns_lucihelper.tmp.sh /usr/lib/ddns/dynamic_dns_lucihelper.sh
|
||||
|
||||
# no longer needed for "Save and Apply" to restart ddns
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@ddns[-1]
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
# make helper script executable
|
||||
chmod 755 /usr/lib/ddns/dynamic_dns_lucihelper.sh
|
||||
|
||||
# update application section for luci-app-ddns
|
||||
uci -q get ddns.global > /dev/null || uci -q set ddns.global='ddns'
|
||||
uci -q get ddns.global.date_format > /dev/null || uci -q set ddns.global.date_format='%F %R'
|
||||
uci -q get ddns.global.log_lines > /dev/null || uci -q set ddns.global.log_lines='250'
|
||||
uci -q commit ddns
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
#!/bin/sh
|
||||
# /usr/lib/ddns/luci_dns_helper.sh
|
||||
#
|
||||
# Written by Christian Schoenebeck in August 2014 to support:
|
||||
# this script is used by luci-app-ddns
|
||||
# - getting registered IP
|
||||
# - check if possible to get local IP
|
||||
# - verifing given DNS- or Proxy-Server
|
||||
#
|
||||
# variables in small chars are read from /etc/config/ddns
|
||||
# variables in big chars are defined inside these scripts as gloval vars
|
||||
# variables in big chars beginning with "__" are local defined inside functions only
|
||||
# set -vx #script debugger
|
||||
|
||||
[ $# -lt 2 ] && exit 1
|
||||
|
||||
. /usr/lib/ddns/dynamic_dns_functions.sh # global vars are also defined here
|
||||
|
||||
# set -vx #script debugger
|
||||
|
||||
# preset some variables wrong or not set in dynamic_dns_functions.sh
|
||||
SECTION_ID="dynamic_dns_lucihelper"
|
||||
LOGFILE="$LOGDIR/$SECTION_ID.log"
|
||||
LUCI_HELPER="ACTIV" # supress verbose and critical logging
|
||||
# global variables normally set by reading DDNS UCI configuration
|
||||
use_logfile=0
|
||||
use_syslog=0
|
||||
|
||||
case "$1" in
|
||||
get_registered_ip)
|
||||
local IP
|
||||
domain=$2 # Hostname/Domain
|
||||
use_ipv6=${3:-"0"} # Use IPv6 - default IPv4
|
||||
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
|
||||
force_dnstcp=${5:-"0"} # Force TCP on DNS - default 0 - No
|
||||
dns_server=${6:-""} # DNS server - default No DNS
|
||||
get_registered_ip IP
|
||||
[ $? -ne 0 ] && IP=""
|
||||
echo -n "$IP" # suppress LF
|
||||
;;
|
||||
verify_dns)
|
||||
# $2 == dns-server to verify # no need for force_dnstcp because
|
||||
# verify with nc (netcat) uses tcp anyway
|
||||
use_ipv6=${3:-"0"} # Use IPv6 - default IPv4
|
||||
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
|
||||
verify_dns "$2"
|
||||
;;
|
||||
verify_proxy)
|
||||
# $2 == proxy string to verify
|
||||
use_ipv6=${3:-"0"} # Use IPv6 - default IPv4
|
||||
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
|
||||
verify_proxy "$2"
|
||||
;;
|
||||
get_local_ip)
|
||||
local IP
|
||||
use_ipv6="$2" # Use IPv6
|
||||
ip_source="$3" # IP source
|
||||
ip_network="$4" # set if source = "network" otherwise "-"
|
||||
ip_url="$5" # set if source = "web" otherwise "-"
|
||||
ip_interface="$6" # set if source = "interface" itherwiase "-"
|
||||
ip_script="$7" # set if source = "script" otherwise "-"
|
||||
proxy="$8" # proxy if set
|
||||
force_ipversion="0" # not needed but must be set
|
||||
use_https="0" # not needed but must be set
|
||||
[ -n "$proxy" -a "$ip_source" == "web" ] && {
|
||||
# proxy defined, used for ip_source=web
|
||||
export HTTP_PROXY="http://$proxy"
|
||||
export HTTPS_PROXY="http://$proxy"
|
||||
export http_proxy="http://$proxy"
|
||||
export https_proxy="http://$proxy"
|
||||
}
|
||||
# don't need IP only the return code
|
||||
[ "$ip_source" == "web" -o "$ip_source" == "script"] && {
|
||||
# we wait only 3 seconds for an
|
||||
# answer from "web" or "script"
|
||||
__timeout 3 -- get_local_ip IP
|
||||
} || get_local_ip IP
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue