local util = require "luci.util"
return { result = (os.execute(string.format("/bin/umount %s", util.shellquote(args.path))) == 0) }
end
- },
-
- setReboot = {
- call = function()
- return { result = (os.execute("/sbin/reboot >/dev/null 2>&1") == 0) }
- end
}
}
"ubus": {
"file": [ "write", "remove", "exec" ],
"iwinfo": [ "scan" ],
- "luci": [ "setInitAction", "setLocaltime", "setPassword", "setBlockDetect", "setUmount", "setReboot" ],
+ "luci": [ "setInitAction", "setLocaltime", "setPassword", "setBlockDetect", "setUmount" ],
"uci": [ "add", "apply", "confirm", "delete", "order", "set", "rename" ]
},
"uci": [ "*" ]
'require fs';
'require ui';
'require uci';
-'require rpc';
-
-var callReboot = rpc.declare({
- object: 'luci',
- method: 'setReboot',
- expect: { result: false }
-});
return L.view.extend({
load: function() {
},
handleReboot: function(ev) {
- return callReboot().then(function() {
+ return fs.exec('/sbin/reboot').then(function(res) {
+ if (res.code != 0) {
+ L.ui.addNotification(null, E('p', _('The reboot command failed with code %d').format(res.code)));
+ L.raise('Error', 'Reboot failed');
+ }
+
L.ui.showModal(_('Rebooting…'), [
E('p', { 'class': 'spinning' }, _('Waiting for device...'))
]);
}, 150000);
L.ui.awaitReconnect();
- });
+ })
+ .catch(function(e) { L.ui.addNotification(null, E('p', e.message)) });
},
handleSaveApply: null,