Merge commit 'de7e69dbe3' as 'luci-app-einat'
This commit is contained in:
commit
bb6c79b701
11 changed files with 775 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"admin/network/einat": {
|
||||
"title": "einat-ebpf",
|
||||
"order": 60,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "einat"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-einat" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
21
luci-app-einat/root/usr/share/rpcd/acl.d/luci-app-einat.json
Normal file
21
luci-app-einat/root/usr/share/rpcd/acl.d/luci-app-einat.json
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"luci-app-einat": {
|
||||
"description": "Grant access to LuCI app einat",
|
||||
"read": {
|
||||
"file": {
|
||||
"/etc/init.d/einat reload": [ "exec" ]
|
||||
},
|
||||
"ubus": {
|
||||
"service": [ "list" ],
|
||||
"luci.einat": [ "*" ]
|
||||
},
|
||||
"uci": ["einat"]
|
||||
},
|
||||
"write": {
|
||||
"ubus": {
|
||||
"rc": [ "init" ]
|
||||
},
|
||||
"uci": ["einat"]
|
||||
}
|
||||
}
|
||||
}
|
||||
38
luci-app-einat/root/usr/share/rpcd/ucode/luci.einat
Normal file
38
luci-app-einat/root/usr/share/rpcd/ucode/luci.einat
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/ucode
|
||||
|
||||
'use strict';
|
||||
|
||||
import { access, popen } from 'fs';
|
||||
|
||||
const methods = {
|
||||
get_features: {
|
||||
call: function() {
|
||||
let features = {
|
||||
version: null,
|
||||
features: [],
|
||||
build_features: []
|
||||
};
|
||||
|
||||
const fd = popen('/usr/bin/einat -v');
|
||||
if (fd) {
|
||||
for (let line = fd.read('line'); length(line); line = fd.read('line')) {
|
||||
let ver = match(trim(line), /version: (\S+)/);
|
||||
if (ver)
|
||||
features.version = ver[1];
|
||||
let feats = match(trim(line), /features: (\S+)/);
|
||||
if (feats)
|
||||
features.features = split(feats[1], ',');
|
||||
let build_feats = match(trim(line), /build_features: (\S+)/);
|
||||
if (build_feats)
|
||||
features.build_features = split(build_feats[1], ',');
|
||||
}
|
||||
|
||||
fd.close();
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return { 'luci.einat': methods };
|
||||
Loading…
Add table
Add a link
Reference in a new issue