summaryrefslogtreecommitdiffhomepage
path: root/libs/uvl/root/usr/bin/uvlc
blob: caaeb2af6f3e5953f25efce049daaf4d47fbfb64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/lua

if arg[1] then
	require("luci.util")
	require("luci.uvl")
	require("nixio.fs")

	local uvl = luci.uvl.UVL()
	local scheme, err = uvl:get_scheme( arg[1] )

	if scheme then
		nixio.fs.writefile(
			"%s/bytecode/%s.lua" %{ uvl.schemedir, arg[1] },
			luci.util.get_bytecode(scheme)
		)
	elseif err then
		print("Error:", err:string())
	else
		print("Error: Can not find scheme:", arg[1])
	end
else
	print( "Usage: uvlc <scheme>" )
end