dnsmasq: make tftp root if not existing
authorAlberto Bursi <alberto.bursi@outlook.it>
Tue, 2 May 2017 17:31:17 +0000 (19:31 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 1 Jun 2017 22:09:14 +0000 (00:09 +0200)
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@outlook.it>
package/network/services/dnsmasq/files/dnsmasq.init

index cce7558fc9720a2c2917ee3f9d93aeff8727a093..5b4de32181ab04b1088c94ca40f7bce5f276a0bc 100644 (file)
@@ -581,7 +581,7 @@ dnsmasq_start()
        append_bool "$cfg" boguspriv "--bogus-priv"
        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"