index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Aaron Griffin <aaron@archlinux.org> | 2007-03-22 08:22:48 +0000 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2007-03-22 08:22:48 +0000 |
commit | d8ec08f578f413ef63ad6c23cbc11b1cb70ffd69 (patch) | |
tree | 9446470abb253f61e3c3ca37f02eac8ee76416f7 /lib/libalpm/add.c | |
parent | 3aa0c85716bd854cd88bd8df53ce6811cbf90ef0 (diff) |
-rw-r--r-- | lib/libalpm/add.c | 15 |
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 3bb17e90..0c344544 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -318,6 +318,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) pkg_count = alpm_list_count(trans->targets); for(targ = trans->packages; targ; targ = targ->next) { + char scriptlet[PATH_MAX+1]; int targ_count = 0, is_upgrade = 0, use_md5 = 0; double percent = 0.0; pmpkg_t *newpkg = (pmpkg_t *)targ->data; @@ -328,6 +329,9 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) break; } + snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", db->path, + alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); + /* check if we have a valid sha1sum, if not, use MD5 */ if(strlen(newpkg->sha1sum) == 0) { use_md5 = 1; @@ -357,7 +361,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) /* pre_upgrade scriptlet */ if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) { - _alpm_runscriptlet(handle->root, newpkg->data, "pre_upgrade", newpkg->version, oldpkg->version, trans); + _alpm_runscriptlet(handle->root, scriptlet, "pre_upgrade", newpkg->version, oldpkg->version, trans); } } else { is_upgrade = 0; @@ -367,7 +371,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) /* pre_install scriptlet */ if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) { - _alpm_runscriptlet(handle->root, newpkg->data, "pre_install", newpkg->version, NULL, trans); + _alpm_runscriptlet(handle->root, scriptlet, "pre_install", newpkg->version, NULL, trans); } } @@ -817,15 +821,12 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) /* run the post-install script if it exists */ if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) { - char pm_install[PATH_MAX]; - snprintf(pm_install, PATH_MAX, "%s%s%s-%s/install", handle->root, db->path, - alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); if(is_upgrade) { - _alpm_runscriptlet(handle->root, pm_install, "post_upgrade", + _alpm_runscriptlet(handle->root, scriptlet, "post_upgrade", alpm_pkg_get_version(newpkg), oldpkg ? alpm_pkg_get_version(oldpkg) : NULL, trans); } else { - _alpm_runscriptlet(handle->root, pm_install, "post_install", + _alpm_runscriptlet(handle->root, scriptlet, "post_install", alpm_pkg_get_version(newpkg), NULL, trans); } } |