[source] dnsmasq: make tftp root if not existing

LEDE Commits lede-commits at lists.infradead.org
Thu May 4 14:10:42 PDT 2017


dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/7296767639b511ab96ca2847ffad84dd4c37452d

commit 7296767639b511ab96ca2847ffad84dd4c37452d
Author: Alberto Bursi <alberto.bursi at outlook.it>
AuthorDate: Tue May 2 19:31:17 2017 +0200

    dnsmasq: make tftp root if not existing
    
    If there's a TFTP root directory configured, create it with mkdir -p
    (which does not throw an error if the folder exists already)
    before starting dnsmasq. This is useful for TFTP roots in /tmp, for example.
    
    Originally submitted by nfw user aka Nathaniel Wesley Filardo
    
    Signed-off-by: Alberto Bursi <alberto.bursi at outlook.it>
---
 package/network/services/dnsmasq/files/dnsmasq.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index e6ba732..3b80130 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -762,7 +762,7 @@ dnsmasq_start()
 	append_bool "$cfg" dbus "--enable-dbus"
 	append_bool "$cfg" expandhosts "--expand-hosts"
 	config_get tftp_root "$cfg" "tftp_root"
-	[ -d "$tftp_root" ] && append_bool "$cfg" enable_tftp "--enable-tftp"
+	[ -n "$tftp_root" ] && mkdir -p "$tftp_root" && append_bool "$cfg" enable_tftp "--enable-tftp"
 	append_bool "$cfg" tftp_no_fail "--tftp-no-fail"
 	append_bool "$cfg" nonwildcard "--bind-dynamic"
 	append_bool "$cfg" fqdn "--dhcp-fqdn"



More information about the lede-commits mailing list