pkg_run_script: use pkg->dest in half installed case
[oweals/opkg-lede.git] / libopkg / pkg.c
index 313e691d5159aa2201d137ceb341a3485ad9ed0f..551c62917225524204d6515148b3de7ed8757c21 100644 (file)
@@ -504,34 +504,6 @@ abstract_pkg_t *abstract_pkg_new(void)
        return ab_pkg;
 }
 
-void set_flags_from_control(pkg_t * pkg)
-{
-       char *file_name;
-       FILE *fp;
-
-       sprintf_alloc(&file_name, "%s/%s.control", pkg->dest->info_dir,
-                     pkg->name);
-
-       fp = fopen(file_name, "r");
-       if (fp == NULL) {
-               opkg_perror(ERROR, "Failed to open %s", file_name);
-               free(file_name);
-               return;
-       }
-
-       free(file_name);
-
-       if (pkg_parse_from_stream(pkg, fp, PFM_ALL ^ PFM_ESSENTIAL)) {
-               opkg_msg(DEBUG,
-                        "Unable to read control file for %s. May be empty.\n",
-                        pkg->name);
-       }
-
-       fclose(fp);
-
-       return;
-}
-
 static const char *pkg_state_want_to_str(pkg_state_want_t sw)
 {
        int i;
@@ -1363,7 +1335,8 @@ int pkg_run_script(pkg_t * pkg, const char *script, const char *args)
        /* Installed packages have scripts in pkg->dest->info_dir, uninstalled packages
           have scripts in tmp_unpack_dir. */
        if (pkg->state_status == SS_INSTALLED
-           || pkg->state_status == SS_UNPACKED) {
+           || pkg->state_status == SS_UNPACKED
+           || pkg->state_status == SS_HALF_INSTALLED) {
                if (pkg->dest == NULL) {
                        opkg_msg(ERROR, "Internal error: %s has a NULL dest.\n",
                                 pkg->name);