opkg: adding cache support
[oweals/opkg-lede.git] / libopkg / opkg_conf.c
index 965618f37a681b9e88193c4a9e57307db18dc750..b61fa3eb7af33bd1ceaac0b1ba057e82a1403247 100644 (file)
@@ -49,6 +49,7 @@ static int set_and_load_pkg_dest_list(opkg_conf_t *conf,
 int opkg_init_options_array(const opkg_conf_t *conf, opkg_option_t **options)
 {
      opkg_option_t tmp[] = {
+         { "cache", OPKG_OPT_TYPE_STRING, &conf->cache},
          { "force_defaults", OPKG_OPT_TYPE_BOOL, &conf->force_defaults },
          { "force_depends", OPKG_OPT_TYPE_BOOL, &conf->force_depends },
          { "force_overwrite", OPKG_OPT_TYPE_BOOL, &conf->force_overwrite },
@@ -138,7 +139,6 @@ int opkg_conf_init(opkg_conf_t *conf, const args_t *args)
        return OPKG_CONF_ERR_LOCK;
      }
 
-
      if (args->tmp_dir)
          tmp_dir_base = args->tmp_dir;
      else 
@@ -153,27 +153,6 @@ int opkg_conf_init(opkg_conf_t *conf, const args_t *args)
          return OPKG_CONF_ERR_TMP_DIR;
      }
 
-     conf->force_depends = 0;
-     conf->force_defaults = 0;
-     conf->force_overwrite = 0;
-     conf->force_downgrade = 0;
-     conf->force_reinstall = 0;
-     conf->force_space = 0;
-     conf->force_removal_of_essential_packages = 0;
-     conf->force_removal_of_dependent_packages = 0;
-     conf->nodeps = 0;
-     conf->offline_root = NULL;
-     conf->offline_root_pre_script_cmd = NULL;
-     conf->offline_root_post_script_cmd = NULL;
-     conf->verbosity = 1;
-     conf->noaction = 0;
-
-     conf->http_proxy = NULL;
-     conf->ftp_proxy = NULL;
-     conf->no_proxy = NULL;
-     conf->proxy_user = NULL;
-     conf->proxy_passwd = NULL;
-
      pkg_hash_init("pkg-hash", &conf->pkg_hash, OPKG_CONF_DEFAULT_HASH_LEN);
      hash_table_init("file-hash", &conf->file_hash, OPKG_CONF_DEFAULT_HASH_LEN);
      hash_table_init("obs-file-hash", &conf->obs_file_hash, OPKG_CONF_DEFAULT_HASH_LEN);
@@ -292,6 +271,8 @@ int opkg_conf_init(opkg_conf_t *conf, const args_t *args)
      opkg_conf_override_string(&conf->offline_root_post_script_cmd, 
                               args->offline_root_post_script_cmd);
 
+     opkg_conf_override_string(&conf->cache, args->cache);
+
 /* Pigi: added a flag to disable the checking of structures if the command does not need to 
          read anything from there.
 */
@@ -360,6 +341,8 @@ void opkg_conf_deinit(opkg_conf_t *conf)
      opkg_conf_free_string(&conf->offline_root_pre_script_cmd);
      opkg_conf_free_string(&conf->offline_root_post_script_cmd);
 
+     opkg_conf_free_string(&conf->cache);
+
      if (conf->verbosity > 1) { 
          int i;
          hash_table_t *hashes[] = {