opkg: make .opk as the default opkg file extension
[oweals/opkg-lede.git] / libopkg / opkg_install.c
index 3db224f191bd592e2317e7b7d660b60c979a86f2..47554d0fe0b02a503c7ed9dbac3e9af55f37cf3b 100644 (file)
@@ -506,7 +506,9 @@ static int update_file_ownership(opkg_conf_t *conf, pkg_t *new_pkg, pkg_t *old_p
                    hash_table_insert(&conf->obs_file_hash, old_file, old_pkg);
               }
          }
+          pkg_free_installed_files(old_pkg);
      }
+     pkg_free_installed_files(new_pkg);
      return 0;
 }
 
@@ -519,7 +521,7 @@ static int verify_pkg_installable(opkg_conf_t *conf, pkg_t *pkg)
      * XXX: BUG easy for cworth
      * 1) please point the call below to the correct current root destination
      * 2) we need to resolve how to check the required space for a pending pkg, 
-     *    my diddling with the .ipk file size below isn't going to cut it.
+     *    my diddling with the .opk file size below isn't going to cut it.
      * 3) return a proper error code instead of 1
      */
      int comp_size, blocks_available;
@@ -828,22 +830,26 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
      #if HAVE_GPGME
      char *list_file_name, *sig_file_name, *lists_dir;
 
-     sprintf_alloc (&lists_dir, "%s",
-                   (conf->restrict_to_default_dest)
-                    ? conf->default_dest->lists_dir
-                    : conf->lists_dir);
-     sprintf_alloc (&list_file_name, "%s/%s", lists_dir, pkg->src->name);
-     sprintf_alloc (&sig_file_name, "%s/%s.sig", lists_dir, pkg->src->name);
-
-     if (file_exists (sig_file_name))
+     /* check to ensure the package has come from a repository */
+     if (pkg->src)
      {
-       if (opkg_verify_file (conf, list_file_name, sig_file_name))
-         return OPKG_INSTALL_ERR_SIGNATURE;
+       sprintf_alloc (&lists_dir, "%s",
+                     (conf->restrict_to_default_dest)
+                      ? conf->default_dest->lists_dir
+                      : conf->lists_dir);
+       sprintf_alloc (&list_file_name, "%s/%s", lists_dir, pkg->src->name);
+       sprintf_alloc (&sig_file_name, "%s/%s.sig", lists_dir, pkg->src->name);
+
+       if (file_exists (sig_file_name))
+       {
+         if (opkg_verify_file (conf, list_file_name, sig_file_name))
+           return OPKG_INSTALL_ERR_SIGNATURE;
+       }
+
+       free (lists_dir);
+       free (list_file_name);
+       free (sig_file_name);
      }
-
-     free (lists_dir);
-     free (list_file_name);
-     free (sig_file_name);
      #endif
 
      /* Check for md5 values */