+ if (args->conf_file) {
+ struct stat stat_buf;
+ err = stat(args->conf_file, &stat_buf);
+ if (err == 0)
+ if (opkg_conf_parse_file(conf, args->conf_file,
+ &conf->pkg_src_list, &tmp_dest_nv_pair_list)<0) {
+ /* Memory leakage from opkg_conf_parse-file */
+ return OPKG_CONF_ERR_PARSE;
+ }
+ }
+
+ offline_root = conf->offline_root;
+ opkg_conf_override_string(&conf->offline_root, args->offline_root);
+
+ if (conf->offline_root)
+ sprintf_alloc(&etc_opkg_conf_pattern, "%s/etc/opkg/*.conf", conf->offline_root);
+ else {
+ char *conf_file_dir = getenv("OPKG_CONF_DIR");
+ if (conf_file_dir == NULL)
+ conf_file_dir = ARGS_DEFAULT_CONF_FILE_DIR;
+ sprintf_alloc(&etc_opkg_conf_pattern, "%s/*.conf", conf_file_dir);
+ }
+ memset(&globbuf, 0, sizeof(globbuf));
+ err = glob(etc_opkg_conf_pattern, 0, NULL, &globbuf);
+ free (etc_opkg_conf_pattern);
+ if (!err) {
+ int i;
+ for (i = 0; i < globbuf.gl_pathc; i++) {
+ if (globbuf.gl_pathv[i])
+ if (args->conf_file &&
+ !strcmp(args->conf_file, globbuf.gl_pathv[i]))
+ continue;
+ if ( opkg_conf_parse_file(conf, globbuf.gl_pathv[i],
+ &conf->pkg_src_list, &tmp_dest_nv_pair_list)<0) {
+ /* Memory leakage from opkg_conf_parse-file */
+ return OPKG_CONF_ERR_PARSE;
+ }
+ if (offline_root != conf->offline_root) {
+ opkg_message(conf, OPKG_ERROR,
+ "Config file %s, within an offline "
+ "root contains option offline_root.\n",
+ globbuf.gl_pathv[i]);
+ return OPKG_CONF_ERR_PARSE;
+ }
+ }
+ }
+ globfree(&globbuf);
+
+ opkg_conf_override_string(&conf->offline_root_path,
+ args->offline_root_path);
+ opkg_conf_override_string(&conf->offline_root_pre_script_cmd,
+ args->offline_root_pre_script_cmd);
+ opkg_conf_override_string(&conf->offline_root_post_script_cmd,
+ args->offline_root_post_script_cmd);
+
+ opkg_conf_override_string(&conf->cache, args->cache);
+