summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xmodules/luci-base/root/usr/libexec/rpcd/luci8
-rw-r--r--modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json3
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/mounts.js88
3 files changed, 33 insertions, 66 deletions
diff --git a/modules/luci-base/root/usr/libexec/rpcd/luci b/modules/luci-base/root/usr/libexec/rpcd/luci
index f200ee5f4f..2601512da6 100755
--- a/modules/luci-base/root/usr/libexec/rpcd/luci
+++ b/modules/luci-base/root/usr/libexec/rpcd/luci
@@ -516,14 +516,6 @@ local methods = {
return { error = err }
end
end
- },
-
- setUmount = {
- args = { path = "/mnt" },
- call = function(args)
- local util = require "luci.util"
- return { result = (os.execute(string.format("/bin/umount %s", util.shellquote(args.path))) == 0) }
- end
}
}
diff --git a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
index 51a7860dea..e757beab6c 100644
--- a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
+++ b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
@@ -63,13 +63,14 @@
"/sbin/reboot": [ "exec" ],
"/sbin/sysupgrade": [ "exec" ],
"/bin/tar": [ "exec" ],
+ "/bin/umount": [ "exec" ],
"/tmp/backup.tar.gz": [ "write" ],
"/tmp/firmware.bin": [ "write" ]
},
"ubus": {
"file": [ "write", "remove", "exec" ],
"iwinfo": [ "scan" ],
- "luci": [ "setInitAction", "setLocaltime", "setPassword", "setBlockDetect", "setUmount" ],
+ "luci": [ "setInitAction", "setLocaltime", "setPassword", "setBlockDetect" ],
"uci": [ "add", "apply", "confirm", "delete", "order", "set", "rename" ]
},
"uci": [ "*" ]
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/mounts.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/mounts.js
index 301ebab331..b4f5cf71a5 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/mounts.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/mounts.js
@@ -1,10 +1,10 @@
'use strict';
+'require fs';
'require uci';
'require rpc';
'require form';
-var callBlockDevices, callMountPoints, callBlockDetect, callUmount,
- callFileRead, callFileStat, callFileExec;
+var callBlockDevices, callMountPoints, callBlockDetect;
callBlockDevices = rpc.declare({
object: 'luci',
@@ -24,44 +24,6 @@ callBlockDetect = rpc.declare({
expect: { result: false }
});
-callUmount = rpc.declare({
- object: 'luci',
- method: 'setUmount',
- params: [ 'path' ],
- expect: { result: false }
-});
-
-callFileRead = rpc.declare({
- object: 'file',
- method: 'read',
- params: [ 'path' ],
- expect: { data: '' },
- filter: function(s) {
- return (s || '').split(/\n/).filter(function(ln) {
- return ln.match(/\S/) && !ln.match(/^nodev\t/);
- }).map(function(ln) {
- return ln.trim();
- });
- }
-});
-
-callFileStat = rpc.declare({
- object: 'file',
- method: 'stat',
- params: [ 'path' ],
- expect: { '': {} },
- filter: function(st) {
- return (L.isObject(st) && st.path != null);
- }
-});
-
-callFileExec = rpc.declare({
- object: 'file',
- method: 'exec',
- params: [ 'command', 'params' ],
- expect: { code: 255 }
-});
-
function device_textvalue(devices, section_id) {
var v = (uci.get('fstab', section_id, 'uuid') || '').toLowerCase(),
e = Object.keys(devices).filter(function(dev) { return (devices[dev].uuid || '-').toLowerCase() == v })[0];
@@ -114,30 +76,32 @@ return L.view.extend({
},
handleMountAll: function(m, ev) {
- return callFileExec('/sbin/block', ['mount'])
- .then(function(rc) {
- if (rc != 0)
- L.ui.addNotification(null, E('p', _('The <em>block mount</em> command failed with code %d').format(rc)));
+ return fs.exec('/sbin/block', ['mount'])
+ .then(function(res) {
+ if (res.code != 0)
+ L.ui.addNotification(null, E('p', _('The <em>block mount</em> command failed with code %d').format(res.code)));
})
.then(L.bind(uci.unload, uci, 'fstab'))
.then(L.bind(m.render, m));
},
handleUmount: function(m, path, ev) {
- return callUmount(path)
+ return fs.exec('/bin/umount', [path])
.then(L.bind(uci.unload, uci, 'fstab'))
- .then(L.bind(m.render, m));
+ .then(L.bind(m.render, m))
+ .catch(function(e) { L.ui.addNotification(null, E('p', e.message)) });
},
load: function() {
return Promise.all([
callBlockDevices(),
- callFileRead('/proc/filesystems'),
- callFileRead('/etc/filesystems'),
- callFileStat('/usr/sbin/e2fsck'),
- callFileStat('/usr/sbin/fsck.f2fs'),
- callFileStat('/usr/sbin/dosfsck'),
- callFileStat('/usr/bin/btrfsck'),
+ fs.lines('/proc/filesystems'),
+ fs.lines('/etc/filesystems'),
+ L.resolveDefault(fs.stat('/usr/sbin/e2fsck'), null),
+ L.resolveDefault(fs.stat('/usr/sbin/fsck.f2fs'), null),
+ L.resolveDefault(fs.stat('/usr/sbin/fsck.fat'), null),
+ L.resolveDefault(fs.stat('/usr/bin/btrfsck'), null),
+ L.resolveDefault(fs.stat('/usr/bin/ntfsfix'), null),
uci.load('fstab')
]);
},
@@ -149,19 +113,29 @@ return L.view.extend({
triggers = {},
trigger, m, s, o;
- var filesystems = procfs.concat(etcfs.filter(function(fs) {
- return procfs.indexOf(fs) < 0;
- })).sort();
-
var fsck = {
ext2: results[3],
ext3: results[3],
ext4: results[3],
f2fs: results[4],
vfat: results[5],
- btrfs: results[6]
+ btrfs: results[6],
+ ntfs: results[7]
};
+ var filesystems = {};
+
+ for (var i = 0; i < procfs.length; i++)
+ if (procfs[i].match(/\S/) && !procfs[i].match(/^nodev\t/))
+ filesystems[procfs[i].trim()] = true;
+
+ for (var i = 0; i < etcfs.length; i++)
+ if (etcfs[i].match(/\S/))
+ filesystems[etcfs[i].trim()] = true;
+
+ filesystems = Object.keys(filesystems).sort();
+
+
if (!uci.sections('fstab', 'global').length)
uci.add('fstab', 'global');