Fixes with help from Stefan, Typo in prerm script, and when reinstall a package the...
authorGlenn L McGrath <bug1@ihug.co.nz>
Thu, 4 Oct 2001 05:22:42 +0000 (05:22 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Thu, 4 Oct 2001 05:22:42 +0000 (05:22 -0000)
archival/dpkg.c
dpkg.c

index 06d722c9db8ec0675194661efc326112dd39fd41..9c8fffa9c796f37e33a3337ee2dfd812c8889296 100644 (file)
@@ -1184,7 +1184,7 @@ void remove_package(const unsigned int package_num)
        printf("Removing %s ...\n", package_name);
 
        /* run prerm script */
-       return_value = run_package_script(package_name, "prem");
+       return_value = run_package_script(package_name, "prerm");
        if (return_value == -1) {
                error_msg_and_die("script failed, prerm failure");
        }
@@ -1410,11 +1410,15 @@ extern int dpkg_main(int argc, char **argv)
                        if ((dpkg_opt & dpkg_opt_unpack) || (dpkg_opt & dpkg_opt_install)) {
                                status_node = (status_node_t *) xmalloc(sizeof(status_node_t));
                                status_node->package = deb_file[deb_count]->package;
-                               /* use reinstreq isnt changed to "ok" until the package control info
-                                * is written to the status file*/
-                               status_node->status = search_name_hashtable("install reinstreq not-installed");
 
+                               /* Try and find a currently installed version of this package */
                                status_num = search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
+                               if ((status_hashtable[status_num] == NULL) ||
+                                       (status_hashtable[status_num]->status == 0)) {
+                                       /* reinstreq isnt changed to "ok" until the package control info
+                                        * is written to the status file*/
+                                       status_node->status = search_name_hashtable("install reinstreq not-installed");
+                               }
                                status_hashtable[status_num] = status_node;
                        }
                }
diff --git a/dpkg.c b/dpkg.c
index 06d722c9db8ec0675194661efc326112dd39fd41..9c8fffa9c796f37e33a3337ee2dfd812c8889296 100644 (file)
--- a/dpkg.c
+++ b/dpkg.c
@@ -1184,7 +1184,7 @@ void remove_package(const unsigned int package_num)
        printf("Removing %s ...\n", package_name);
 
        /* run prerm script */
-       return_value = run_package_script(package_name, "prem");
+       return_value = run_package_script(package_name, "prerm");
        if (return_value == -1) {
                error_msg_and_die("script failed, prerm failure");
        }
@@ -1410,11 +1410,15 @@ extern int dpkg_main(int argc, char **argv)
                        if ((dpkg_opt & dpkg_opt_unpack) || (dpkg_opt & dpkg_opt_install)) {
                                status_node = (status_node_t *) xmalloc(sizeof(status_node_t));
                                status_node->package = deb_file[deb_count]->package;
-                               /* use reinstreq isnt changed to "ok" until the package control info
-                                * is written to the status file*/
-                               status_node->status = search_name_hashtable("install reinstreq not-installed");
 
+                               /* Try and find a currently installed version of this package */
                                status_num = search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
+                               if ((status_hashtable[status_num] == NULL) ||
+                                       (status_hashtable[status_num]->status == 0)) {
+                                       /* reinstreq isnt changed to "ok" until the package control info
+                                        * is written to the status file*/
+                                       status_node->status = search_name_hashtable("install reinstreq not-installed");
+                               }
                                status_hashtable[status_num] = status_node;
                        }
                }