mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-02-09 21:32:57 +01:00
Ticket refs #5579: Add module dependency on opkg
This commit is contained in:
parent
e10c674444
commit
fd1b8d55f8
1 changed files with 20 additions and 4 deletions
|
|
@ -162,11 +162,15 @@ static bool check_dependency(const char *conf_obj)
|
|||
/* multiple files => "file:/etc/config/network,/lib/netifd/proto/dhcp.sh" */
|
||||
/* one ubus => "ubus:router.network" (with method : "ubus:router.network->hosts") */
|
||||
/* multiple ubus => "ubus:router.system->info,dsl->status,wifi" */
|
||||
/* common (files and ubus) => "file:/etc/config/network,/etc/config/dhcp;ubus:router.system,dsl->status" */
|
||||
/* one package => "opkg:icwmp" */
|
||||
/* multiple packages => "opkg:icwmp,obuspa" */
|
||||
/* common (files, ubus and opkg) => "file:/etc/config/network,/etc/config/dhcp;ubus:router.system,dsl->status;opkg:icwmp" */
|
||||
|
||||
char *pch, *spch;
|
||||
char *pch = NULL, *spch = NULL;
|
||||
char conf_list[512] = {0};
|
||||
|
||||
DM_STRNCPY(conf_list, conf_obj, sizeof(conf_list));
|
||||
|
||||
char *conf_list = dmstrdup(conf_obj);
|
||||
for (pch = strtok_r(conf_list, ";", &spch); pch != NULL; pch = strtok_r(NULL, ";", &spch)) {
|
||||
char *conf_type = strchr(pch, ':');
|
||||
if (!conf_type)
|
||||
|
|
@ -177,8 +181,20 @@ static bool check_dependency(const char *conf_obj)
|
|||
|
||||
char *token, *saveptr;
|
||||
for (token = strtok_r(conf_name, ",", &saveptr); token != NULL; token = strtok_r(NULL, ",", &saveptr)) {
|
||||
if ((!strcmp(pch, "file") && !file_exists(token)) || (!strcmp(pch, "ubus") && !dmubus_object_method_exists(token)))
|
||||
|
||||
if (!strcmp(pch, "file") && !file_exists(token))
|
||||
return false;
|
||||
|
||||
if (!strcmp(pch, "ubus") && !dmubus_object_method_exists(token))
|
||||
return false;
|
||||
|
||||
if (!strcmp(pch, "opkg")) {
|
||||
char opkg_path[256] = {0};
|
||||
|
||||
snprintf(opkg_path, sizeof(opkg_path), "/usr/lib/opkg/info/%s.control", token);
|
||||
if (!file_exists(opkg_path))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue