From 35228b84fbb4349ef22ef9f18b2cc19e97a8b43f Mon Sep 17 00:00:00 2001 From: Vivek Kumar Dutta Date: Tue, 28 Nov 2023 04:46:39 +0000 Subject: [PATCH] Add support for full uci import If the downloaded file matches the following pattern "*.uci.conf" then the file will be imported without setting the specific package in uci. e.g. the package needs to be part of the file itself. --- src/download.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/download.c b/src/download.c index 5c76205..8867c52 100644 --- a/src/download.c +++ b/src/download.c @@ -524,8 +524,13 @@ int apply_downloaded_file(struct download *pdownload, char *download_file_name, int err = CWMP_OK; if (download_file_name != NULL) { char file_path[512]; + snprintf(file_path, sizeof(file_path), "/tmp/%s", download_file_name); - err = cwmp_uci_import(download_file_name, file_path, UCI_STANDARD_CONFIG); + if (strstr(download_file_name, ".uci.conf") != NULL) { + err = cwmp_uci_import(NULL, file_path, UCI_STANDARD_CONFIG); + } else { + err = cwmp_uci_import(download_file_name, file_path, UCI_STANDARD_CONFIG); + } remove(file_path); } else { err = cwmp_uci_import("vendor_conf_file", VENDOR_CONFIG_FILE, UCI_STANDARD_CONFIG);