luci-base: add reboot rpc call
authorJo-Philipp Wich <jo@mein.io>
Mon, 7 Oct 2019 08:51:04 +0000 (10:51 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 7 Oct 2019 09:53:39 +0000 (11:53 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/root/usr/libexec/rpcd/luci
modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json

index 8215fb95ddca0e7ba711d0b6d641c7c18b7f4d1f..ace0957f3e1ac36198592e524c34acbc017acf21 100755 (executable)
@@ -685,6 +685,12 @@ local methods = {
                        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
        }
 }
 
index 54caa743634543eca7099d325e1e08f991f9ae24..001e6deec8c61cf783c4c12252cca89757686cc5 100644 (file)
@@ -67,7 +67,7 @@
                        "ubus": {
                                "file": [ "write", "remove", "exec" ],
                                "iwinfo": [ "scan" ],
-                               "luci": [ "setInitAction", "setLocaltime", "setPassword", "setBlockDetect", "setUmount" ],
+                               "luci": [ "setInitAction", "setLocaltime", "setPassword", "setBlockDetect", "setUmount", "setReboot" ],
                                "uci": [ "add", "apply", "confirm", "delete", "order", "set", "rename" ]
                        },
                        "uci": [ "*" ]