[PATCH luci] luci-mod-system: use new "rc" ubus object for init.d scripts
Christian Marangi
ansuelsmth at gmail.com
Thu Jun 30 07:40:52 PDT 2022
On Fri, Sep 11, 2020 at 01:26:45PM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal at milecki.pl>
>
> It's meant to be wide/generic method for handling /etc/init.d/ scripts.
>
Hi, I notice this and tested it on runtime but it didn't work.
Wonder if we should still do this change.
> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
> ---
> .../resources/view/system/startup.js | 24 +++++++++----------
> .../usr/share/rpcd/acl.d/luci-mod-system.json | 8 +++----
> 2 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js
> index ae92ce88b..1b5559502 100644
> --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js
> +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js
> @@ -7,15 +7,15 @@
> var isReadonlyView = !L.hasViewPermission() || null;
>
> return view.extend({
> - callInitList: rpc.declare({
> - object: 'luci',
> - method: 'getInitList',
> + callRcList: rpc.declare({
> + object: 'rc',
> + method: 'list',
> expect: { '': {} }
> }),
>
> - callInitAction: rpc.declare({
> - object: 'luci',
> - method: 'setInitAction',
> + callRcInit: rpc.declare({
> + object: 'rc',
> + method: 'init',
> params: [ 'name', 'action' ],
> expect: { result: false }
> }),
> @@ -23,12 +23,12 @@ return view.extend({
> load: function() {
> return Promise.all([
> L.resolveDefault(fs.read('/etc/rc.local'), ''),
> - this.callInitList()
> + this.callRcList()
> ]);
> },
>
> handleAction: function(name, action, ev) {
> - return this.callInitAction(name, action).then(function(success) {
> + return this.callRcInit(name, action).then(function(success) {
> if (success != true)
> throw _('Command failed');
>
> @@ -80,19 +80,19 @@ return view.extend({
> ]);
>
> for (var init in initList)
> - if (initList[init].index < 100)
> + if (initList[init].start < 100)
> list.push(Object.assign({ name: init }, initList[init]));
>
> list.sort(function(a, b) {
> - if (a.index != b.index)
> - return a.index - b.index
> + if (a.start != b.start)
> + return a.start - b.start
>
> return a.name > b.name;
> });
>
> for (var i = 0; i < list.length; i++) {
> rows.push([
> - '%02d'.format(list[i].index),
> + '%02d'.format(list[i].start),
> list[i].name,
> E('div', [
> this.renderEnableDisable(list[i]),
> diff --git a/modules/luci-mod-system/root/usr/share/rpcd/acl.d/luci-mod-system.json b/modules/luci-mod-system/root/usr/share/rpcd/acl.d/luci-mod-system.json
> index 38ff98dee..d5beb130c 100644
> --- a/modules/luci-mod-system/root/usr/share/rpcd/acl.d/luci-mod-system.json
> +++ b/modules/luci-mod-system/root/usr/share/rpcd/acl.d/luci-mod-system.json
> @@ -45,8 +45,8 @@
> "/etc/rc.local": [ "read" ]
> },
> "ubus": {
> - "file": [ "read" ],
> - "luci": [ "getInitList" ]
> + "rc": [ "list" ],
> + "file": [ "read" ]
> }
> },
> "write": {
> @@ -54,8 +54,8 @@
> "/etc/rc.local": [ "write" ]
> },
> "ubus": {
> - "file": [ "write" ],
> - "luci": [ "setInitAction" ]
> + "rc": [ "init" ],
> + "file": [ "write" ]
> }
> }
> },
> --
> 2.27.0
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
--
Ansuel
More information about the openwrt-devel
mailing list