diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Network.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Propellor/Property/Network.hs b/src/Propellor/Property/Network.hs index 1908bbb3..0d079899 100644 --- a/src/Propellor/Property/Network.hs +++ b/src/Propellor/Property/Network.hs @@ -45,7 +45,7 @@ dhcp iface = hasContent (interfaceDFile iface) -- -- If the interface file already exists, this property does nothing, -- no matter its content. --- +-- -- (ipv6 addresses are not included because it's assumed they come up -- automatically in most situations.) static :: Interface -> Property NoInfo @@ -96,8 +96,19 @@ interfacesFile :: FilePath interfacesFile = "/etc/network/interfaces" -- | A file in the interfaces.d directory. +-- /etc/network/interfaces.d/ files have to match -- ^[a-zA-Z0-9_-]+$ +-- see "man 5 interfaces" interfaceDFile :: Interface -> FilePath -interfaceDFile iface = "/etc/network/interfaces.d" </> iface +interfaceDFile i = interfaceDFile' (escapeInterfaceDName i) + +interfaceDFile' :: Interface -> FilePath +interfaceDFile' iface = "/etc/network/interfaces.d" </> iface + +escapeInterfaceDName :: Interface -> FilePath +escapeInterfaceDName "" = "" +escapeInterfaceDName (':' : xs) = escapeInterfaceDName xs +escapeInterfaceDName ('.' : xs) = escapeInterfaceDName xs +escapeInterfaceDName (x : xs) = x : escapeInterfaceDName xs -- | Ensures that files in the the interfaces.d directory are used. interfacesDEnabled :: Property NoInfo |
