diff options
author | Eric Luehrsen <ericluehrsen@hotmail.com> | 2017-03-21 21:43:42 -0400 |
---|---|---|
committer | Eric Luehrsen <ericluehrsen@hotmail.com> | 2017-03-21 21:54:25 -0400 |
commit | 5f86d50de91ed308b9160ddc3a4ea307f6272063 (patch) | |
tree | e731a73d317c09b9ae53bd9e588d0226d27e6e86 /net/unbound/files | |
parent | 3d3908971e1cf198f502f1167ad2e4b2a9c110e5 (diff) |
unbound: support copy without dash update
Signed-off-by: Eric Luehrsen <ericluehrsen@hotmail.com>
Diffstat (limited to 'net/unbound/files')
-rw-r--r-- | net/unbound/files/unbound.sh | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/net/unbound/files/unbound.sh b/net/unbound/files/unbound.sh index 5f733fbcb..d918152d7 100644 --- a/net/unbound/files/unbound.sh +++ b/net/unbound/files/unbound.sh @@ -88,6 +88,29 @@ UNBOUND_CONTROL_CFG="$UNBOUND_CONTROL -c $UNBOUND_CONFFILE" ############################################################################## +copy_dash_update() { + # TODO: remove this function and use builtins when this issues is resovled. + # Due to OpenWrt/LEDE divergence "cp -u" isn't yet universally available. + local filetime keeptime + + + if [ -f $UNBOUND_KEYFILE.keep ] ; then + # root.key.keep is reused if newest + filetime=$( date -r $UNBOUND_KEYFILE +%s ) + keeptime=$( date -r $UNBOUND_KEYFILE.keep +%s ) + + + if [ $keeptime -gt $filetime ] ; then + cp $UNBOUND_KEYFILE.keep $UNBOUND_KEYFILE + fi + + + rm -f $UNBOUND_KEYFILE.keep + fi +} + +############################################################################## + create_interface_dns() { local cfg="$1" local ipcommand logint ignore ifname ifdashname @@ -312,11 +335,7 @@ unbound_mkdir() { fi - if [ -f $UNBOUND_KEYFILE.keep ] ; then - # root.key.keep is reused if newest - cp -u $UNBOUND_KEYFILE.keep $UNBOUND_KEYFILE - rm -f $UNBOUND_KEYFILE.keep - fi + copy_dash_update # Ensure access and prepare to jail |