Re: [OpenWrt-Devel] [PATCH procd] system: support passing "options" to the "sysupgrade" ubus method

2019-08-22 Thread Rafał Miłecki
On Sat, 17 Aug 2019 at 12:31, Jo-Philipp Wich wrote: > > [...] > > + > > + blobmsg_for_each_attr(option, options, rem) { > > + const char *prefix = "UPGRADE_OPT_"; > > + char *name = malloc(strlen(prefix) + > > strlen(blobmsg_name(option))); > > + char

Re: [OpenWrt-Devel] [PATCH procd] system: support passing "options" to the "sysupgrade" ubus method

2019-08-17 Thread Jo-Philipp Wich
Hi, > [...] > + > + blobmsg_for_each_attr(option, options, rem) { > + const char *prefix = "UPGRADE_OPT_"; > + char *name = malloc(strlen(prefix) + > strlen(blobmsg_name(option))); > + char value[11]; > + char *c; > + int tmp; > + >

Re: [OpenWrt-Devel] [PATCH procd] system: support passing "options" to the "sysupgrade" ubus method

2019-08-16 Thread John Crispin
On 16/08/2019 18:17, Bjørn Mork wrote: John Crispin writes: + for (c = name + strlen(prefix); *c; c++) { + *c = toupper(*c); + } + and, matter of tatse, but i'd drop the travolta brackets on single line clauses I thought <> were "travolta

Re: [OpenWrt-Devel] [PATCH procd] system: support passing "options" to the "sysupgrade" ubus method

2019-08-16 Thread Bjørn Mork
John Crispin writes: >> +for (c = name + strlen(prefix); *c; c++) { >> +*c = toupper(*c); >> +} >> + > > and, matter of tatse, but i'd drop the travolta brackets on single > line clauses I thought <> were "travolta brackets", ref

Re: [OpenWrt-Devel] [PATCH procd] system: support passing "options" to the "sysupgrade" ubus method

2019-08-16 Thread John Crispin
On 16/08/2019 16:28, Rafał Miłecki wrote: From: Rafał Miłecki Object passed as "options" gets translated into environment variables UPGRADE_OPT_*. E.g. "options": { "foo": 5 } will result in setting UPGRADE_OPT_FOO=5. This allows stage2 sysupgrade to get options explicitly. So far it was

[OpenWrt-Devel] [PATCH procd] system: support passing "options" to the "sysupgrade" ubus method

2019-08-16 Thread Rafał Miłecki
From: Rafał Miłecki Object passed as "options" gets translated into environment variables UPGRADE_OPT_*. E.g. "options": { "foo": 5 } will result in setting UPGRADE_OPT_FOO=5. This allows stage2 sysupgrade to get options explicitly. So far it was guessing what to do by checking for existence of