mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
Merge branch 'dynamicdns-nonat'
This commit is contained in:
commit
3e2c84dba2
@ -167,11 +167,11 @@ doWriteCFG()
|
|||||||
echo "NAT no" >> ${HELPERCFG}
|
echo "NAT no" >> ${HELPERCFG}
|
||||||
# if this file is added ez-ipupdate will take ip form this interface
|
# if this file is added ez-ipupdate will take ip form this interface
|
||||||
{
|
{
|
||||||
"interface=${default_interface}"
|
echo "interface=${default_interface}"
|
||||||
# if this line is added to config file, ez-ipupdate will be launched on startup via init.d
|
# if this line is added to config file, ez-ipupdate will be launched on startup via init.d
|
||||||
"daemon"
|
echo "daemon"
|
||||||
"execute=${0} success"
|
echo "execute=${0} success"
|
||||||
} > ${out_file}
|
} >> ${out_file}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -189,10 +189,10 @@ doReadCFG()
|
|||||||
ipurl=""
|
ipurl=""
|
||||||
|
|
||||||
if [ ! -z "${cfgfile}" ];then
|
if [ ! -z "${cfgfile}" ];then
|
||||||
host=$(grep host "${cfgfile}" 2> /dev/null |cut -d = -f 2)
|
host=$(grep ^host= "${cfgfile}" 2> /dev/null | cut -d = -f 2-)
|
||||||
server=$(grep server "${cfgfile}" 2> /dev/null |cut -d = -f 2 |grep -v ^\'\')
|
server=$(grep ^server= "${cfgfile}" 2> /dev/null | cut -d = -f 2- | grep -v ^\'\')
|
||||||
user=$(grep user "${cfgfile}" 2> /dev/null |cut -d = -f 2 |cut -d : -f 1 )
|
user=$(grep ^user= "${cfgfile}" 2> /dev/null | cut -d = -f 2- | cut -d : -f 1 )
|
||||||
pass=$(grep user "${cfgfile}" 2> /dev/null |cut -d = -f 2 |cut -d : -f 2)
|
pass=$(grep ^user= "${cfgfile}" 2> /dev/null | cut -d = -f 2- | cut -d : -f 2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z ${HELPERCFG} ];then
|
if [ ! -z ${HELPERCFG} ];then
|
||||||
@ -338,8 +338,8 @@ case ${cmd} in
|
|||||||
doGetWANIP
|
doGetWANIP
|
||||||
if [ "$(grep ^NAT ${HELPERCFG} | awk '{print $2}')" = "no" ];then
|
if [ "$(grep ^NAT ${HELPERCFG} | awk '{print $2}')" = "no" ];then
|
||||||
#if we are not behind a NAT device and we use gnudip, start the daemon tool
|
#if we are not behind a NAT device and we use gnudip, start the daemon tool
|
||||||
local gnudipServer=$(grep server ${cfgfile} 2> /dev/null |cut -d = -f 2 |grep -v ^\'\')
|
gnudipServer=$(grep ^server= ${cfgfile} 2> /dev/null | cut -d = -f 2- |grep -v ^\'\')
|
||||||
if [ -f ${CFG} -a ! -z "${gnudipServer}" ];then
|
if [ ! -f ${CFG} -a ! -z "${gnudipServer}" ];then
|
||||||
mv ${CFG_disabled} ${CFG}
|
mv ${CFG_disabled} ${CFG}
|
||||||
/etc/init.d/${TOOLNAME} start
|
/etc/init.d/${TOOLNAME} start
|
||||||
fi
|
fi
|
||||||
@ -374,10 +374,10 @@ case ${cmd} in
|
|||||||
fi
|
fi
|
||||||
# if we don't know our WAN IP do a blind update once a hour
|
# if we don't know our WAN IP do a blind update once a hour
|
||||||
if [ "${wanip}" = ${NOIP} ];then
|
if [ "${wanip}" = ${NOIP} ];then
|
||||||
uptime=$(cut -d . -f 1 /proc/uptime)
|
currenttime=$(date +%s)
|
||||||
LAST=0
|
LAST=0
|
||||||
[ -f ${LASTUPDATE} ] && LAST=$(cat ${LASTUPDATE})
|
[ -f ${LASTUPDATE} ] && LAST=$(cat ${LASTUPDATE})
|
||||||
diff=$((uptime - LAST))
|
diff=$((currenttime - LAST))
|
||||||
if [ ${diff} -gt ${UPDATEMINUTESUNKNOWN} ];then
|
if [ ${diff} -gt ${UPDATEMINUTESUNKNOWN} ];then
|
||||||
doUpdate
|
doUpdate
|
||||||
fi
|
fi
|
||||||
@ -392,7 +392,7 @@ case ${cmd} in
|
|||||||
success)
|
success)
|
||||||
date=$(date)
|
date=$(date)
|
||||||
echo "last update done (${date})" > ${STATUSFILE}
|
echo "last update done (${date})" > ${STATUSFILE}
|
||||||
awk '{print $1}' /proc/uptime |cut -d . -f 1 > ${LASTUPDATE}
|
date +%s > ${LASTUPDATE}
|
||||||
# if called from cronjob, the current IP is given as parameter
|
# if called from cronjob, the current IP is given as parameter
|
||||||
if [ $# -eq 1 ];then
|
if [ $# -eq 1 ];then
|
||||||
echo "${1}" > ${IPFILE}
|
echo "${1}" > ${IPFILE}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user