summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-03-22 08:22:48 +0000
committerAaron Griffin <aaron@archlinux.org>2007-03-22 08:22:48 +0000
commitd8ec08f578f413ef63ad6c23cbc11b1cb70ffd69 (patch)
tree9446470abb253f61e3c3ca37f02eac8ee76416f7 /lib/libalpm/remove.c
parent3aa0c85716bd854cd88bd8df53ce6811cbf90ef0 (diff)
downloadpacman-d8ec08f578f413ef63ad6c23cbc11b1cb70ffd69.tar.xz
* Correct install scriptlet usage (reuse of handle->root when not needed)
* Skip running scriptlet when chroot fails - to prevent issues in the host filesystem
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 47e5cfe7..03b23d25 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -275,7 +275,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
for(targ = trans->packages; targ; targ = targ->next) {
int position = 0;
- char pm_install[PATH_MAX];
+ char scriptlet[PATH_MAX];
alpm_list_t *files;
info = (pmpkg_t*)targ->data;
const char *pkgname = NULL;
@@ -284,6 +284,8 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
break;
}
+ snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", db->path,
+ pkgname, alpm_pkg_get_version(info));
/* get the name now so we can use it after package is removed */
pkgname = alpm_pkg_get_name(info);
@@ -294,9 +296,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
/* run the pre-remove scriptlet if it exists */
if(alpm_pkg_has_scriptlet(info) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
- snprintf(pm_install, PATH_MAX, "%s/%s-%s/install", db->path,
- pkgname, alpm_pkg_get_version(info));
- _alpm_runscriptlet(handle->root, pm_install, "pre_remove",
+ _alpm_runscriptlet(handle->root, scriptlet, "pre_remove",
alpm_pkg_get_version(info), NULL, trans);
}
}
@@ -324,9 +324,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
/* run the post-remove script if it exists */
if(alpm_pkg_has_scriptlet(info) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
- snprintf(pm_install, PATH_MAX, "%s/%s-%s/install", db->path,
- pkgname, alpm_pkg_get_version(info));
- _alpm_runscriptlet(handle->root, pm_install, "post_remove",
+ _alpm_runscriptlet(handle->root, scriptlet, "post_remove",
alpm_pkg_get_version(info), NULL, trans);
}
}