luci-app-openvpn: create base directory if not available
* trivial fix for never ending ticket #3454
Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit b6f36ca91b
)
This commit is contained in:
parent
a56934fb0f
commit
d9430378f9
1 changed files with 12 additions and 7 deletions
|
@ -13,13 +13,18 @@ function index()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ovpn_upload()
|
function ovpn_upload()
|
||||||
local fs = require("nixio.fs")
|
local fs = require("nixio.fs")
|
||||||
local http = require("luci.http")
|
local http = require("luci.http")
|
||||||
local util = require("luci.util")
|
local util = require("luci.util")
|
||||||
local uci = require("luci.model.uci").cursor()
|
local uci = require("luci.model.uci").cursor()
|
||||||
local upload = http.formvalue("ovpn_file")
|
local upload = http.formvalue("ovpn_file")
|
||||||
local name = http.formvalue("instance_name2")
|
local name = http.formvalue("instance_name2")
|
||||||
local file = "/etc/openvpn/" ..name.. ".ovpn"
|
local basedir = "/etc/openvpn"
|
||||||
|
local file = basedir.. "/" ..name.. ".ovpn"
|
||||||
|
|
||||||
|
if not fs.stat(basedir) then
|
||||||
|
fs.mkdir(basedir)
|
||||||
|
end
|
||||||
|
|
||||||
if name and upload then
|
if name and upload then
|
||||||
local fp
|
local fp
|
||||||
|
|
Loading…
Reference in a new issue