Merge pull request #5164 from dibdot/openvpn

luci-app-openvpn: create base directory if not available
This commit is contained in:
Dirk Brenken 2021-07-04 08:42:38 +02:00 committed by GitHub
commit 7da84e543f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,13 +13,18 @@ function index()
end
function ovpn_upload()
local fs = require("nixio.fs")
local http = require("luci.http")
local util = require("luci.util")
local uci = require("luci.model.uci").cursor()
local upload = http.formvalue("ovpn_file")
local name = http.formvalue("instance_name2")
local file = "/etc/openvpn/" ..name.. ".ovpn"
local fs = require("nixio.fs")
local http = require("luci.http")
local util = require("luci.util")
local uci = require("luci.model.uci").cursor()
local upload = http.formvalue("ovpn_file")
local name = http.formvalue("instance_name2")
local basedir = "/etc/openvpn"
local file = basedir.. "/" ..name.. ".ovpn"
if not fs.stat(basedir) then
fs.mkdir(basedir)
end
if name and upload then
local fp