diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-25 11:52:32 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-25 11:52:32 +0200 |
commit | d1090c91ccbd75b30f30a70dbbb2e0f7b129f083 (patch) | |
tree | 7f43c06e94d7f1db5fdbc86e914f8ff98557c2fd | |
parent | f3b56b428f5c903ef4622d7e04925d9056f751e9 (diff) | |
download | busybox-w32-d1090c91ccbd75b30f30a70dbbb2e0f7b129f083.tar.gz busybox-w32-d1090c91ccbd75b30f30a70dbbb2e0f7b129f083.tar.bz2 busybox-w32-d1090c91ccbd75b30f30a70dbbb2e0f7b129f083.zip |
dpkg: delete postrm script after it's run, not before. closes bug 449
function old new delta
purge_package 220 252 +32
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | archival/dpkg.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 577b77fec..abeb16238 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -1354,8 +1354,8 @@ static void remove_package(const unsigned package_num, int noisy) | |||
1354 | free_array(exclude_files); | 1354 | free_array(exclude_files); |
1355 | free_array(remove_files); | 1355 | free_array(remove_files); |
1356 | 1356 | ||
1357 | /* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */ | 1357 | /* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */ |
1358 | exclude_files = xzalloc(sizeof(char*) * 3); | 1358 | exclude_files = xzalloc(sizeof(exclude_files[0]) * 3); |
1359 | exclude_files[0] = xstrdup(conffile_name); | 1359 | exclude_files[0] = xstrdup(conffile_name); |
1360 | exclude_files[1] = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, "postrm"); | 1360 | exclude_files[1] = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, "postrm"); |
1361 | 1361 | ||
@@ -1393,20 +1393,25 @@ static void purge_package(const unsigned package_num) | |||
1393 | sprintf(list_name, "/var/lib/dpkg/info/%s.%s", package_name, "list"); | 1393 | sprintf(list_name, "/var/lib/dpkg/info/%s.%s", package_name, "list"); |
1394 | remove_files = create_list(list_name); | 1394 | remove_files = create_list(list_name); |
1395 | 1395 | ||
1396 | exclude_files = xzalloc(sizeof(char*)); | ||
1397 | |||
1398 | /* Some directories cant be removed straight away, so do multiple passes */ | 1396 | /* Some directories cant be removed straight away, so do multiple passes */ |
1399 | while (remove_file_array(remove_files, exclude_files)) /* repeat */; | 1397 | while (remove_file_array(remove_files, NULL)) |
1398 | continue; | ||
1400 | free_array(remove_files); | 1399 | free_array(remove_files); |
1401 | 1400 | ||
1402 | /* Create a list of all /var/lib/dpkg/info/<package> files */ | 1401 | /* Create a list of all /var/lib/dpkg/info/<package> files */ |
1403 | remove_files = all_control_list(package_name); | 1402 | remove_files = all_control_list(package_name); |
1403 | |||
1404 | /* Delete all of them except the postrm script */ | ||
1405 | exclude_files = xzalloc(sizeof(exclude_files[0]) * 2); | ||
1406 | exclude_files[0] = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, "postrm"); | ||
1404 | remove_file_array(remove_files, exclude_files); | 1407 | remove_file_array(remove_files, exclude_files); |
1405 | free_array(remove_files); | 1408 | free_array(exclude_files); |
1406 | free(exclude_files); | ||
1407 | 1409 | ||
1408 | /* Run postrm script */ | 1410 | /* Run and remove postrm script */ |
1409 | run_package_script_or_die(package_name, "postrm"); | 1411 | run_package_script_or_die(package_name, "postrm"); |
1412 | remove_file_array(remove_files, NULL); | ||
1413 | |||
1414 | free_array(remove_files); | ||
1410 | 1415 | ||
1411 | /* Change package status */ | 1416 | /* Change package status */ |
1412 | set_status(status_num, "not-installed", 3); | 1417 | set_status(status_num, "not-installed", 3); |