diff options
author | Glenn L McGrath | 2001-09-21 05:07:47 +0000 |
---|---|---|
committer | Glenn L McGrath | 2001-09-21 05:07:47 +0000 |
commit | 48cc89b7381d255299229402b72c6ccc838515f0 (patch) | |
tree | 9d1b32300925d92110a2b3d407651608b52a76dc /archival | |
parent | e73866181f553067cae3411608f3cf1677d63a8b (diff) | |
download | busybox-48cc89b7381d255299229402b72c6ccc838515f0.zip busybox-48cc89b7381d255299229402b72c6ccc838515f0.tar.gz |
Fix to make preinst run when required, from Stefan Soucek
Diffstat (limited to 'archival')
-rw-r--r-- | archival/dpkg.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index e58052d..437b50d 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -1265,6 +1265,7 @@ void unpack_package(deb_file_t *deb_file) FILE *out_stream; char *info_prefix; + int return_value; /* If existing version, remove it first */ if (strcmp(name_hashtable[get_status(status_num, 3)], "installed") == 0) { @@ -1282,6 +1283,16 @@ void unpack_package(deb_file_t *deb_file) sprintf(info_prefix, "/var/lib/dpkg/info/%s.", package_name); deb_extract(deb_file->filename, stdout, (extract_quiet | extract_control_tar_gz | extract_all_to_fs), info_prefix, NULL); + /* Run the preinst prior to extracting */ + return_value = run_package_script(package_name, "preinst"); + if (return_value == -1) { + error_msg_and_die("could not execute pre-installation script."); + } + if (return_value != 0) { + /* when preinst returns exit code != 0 then quit installation process */ + error_msg_and_die("subprocess pre-installation script returned error."); + } + /* Extract data.tar.gz to the root directory */ deb_extract(deb_file->filename, stdout, (extract_quiet | extract_data_tar_gz | extract_all_to_fs), "/", NULL); @@ -1307,7 +1318,7 @@ void configure_package(deb_file_t *deb_file) printf("Setting up %s (%s)\n", package_name, package_version); - /* Run the preinst prior to extracting */ + /* Run the postinst script */ return_value = run_package_script(package_name, "postinst"); if (return_value == -1) { /* TODO: handle failure gracefully */ |