Commit 96bb528c authored by Rafał Miłecki's avatar Rafał Miłecki
Browse files

luci-mod-system: use ubus method for reboot



It's more generic & convenient than hardcoding /sbin/reboot executable
path. procd provides "reboot" method since 2016.
Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
parent 77af0925
'use strict';
'require view';
'require fs';
'require rpc';
'require ui';
'require uci';
var callReboot = rpc.declare({
object: 'system',
method: 'reboot',
expect: { result: 0 }
});
return view.extend({
load: function() {
return uci.changes();
......@@ -31,9 +37,9 @@ return view.extend({
},
handleReboot: function(ev) {
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)));
return callReboot().then(function(res) {
if (res != 0) {
L.ui.addNotification(null, E('p', _('The reboot command failed with code %d').format(res)));
L.raise('Error', 'Reboot failed');
}
......
......@@ -160,7 +160,8 @@
"/sbin/reboot": [ "exec" ]
},
"ubus": {
"file": [ "exec" ]
"file": [ "exec" ],
"system": [ "reboot" ]
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment