From 70e95786dc046555fa8a72f819138b0c9dd6937a Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 15 Dec 2011 12:24:59 +0100
Subject: [PATCH] libxbps: pass xhp->conffile as last argument when execing
 INSTALL/REMOVE scripts.

---
 include/xbps_api.h      | 2 +-
 lib/package_configure.c | 3 ++-
 lib/package_purge.c     | 3 ++-
 lib/package_remove.c    | 5 +++--
 lib/package_unpack.c    | 3 ++-
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/xbps_api.h b/include/xbps_api.h
index cae2315f..6f8e74a7 100644
--- a/include/xbps_api.h
+++ b/include/xbps_api.h
@@ -56,7 +56,7 @@
  */
 #define XBPS_PKGINDEX_VERSION	"1.3"
 
-#define XBPS_API_VERSION	"20111215"
+#define XBPS_API_VERSION	"20111215-1"
 #define XBPS_VERSION		"0.11.0"
 
 /**
diff --git a/lib/package_configure.c b/lib/package_configure.c
index 2da6938d..131a556d 100644
--- a/lib/package_configure.c
+++ b/lib/package_configure.c
@@ -140,7 +140,8 @@ xbps_configure_pkg(const char *pkgname,
 
 	if (access(buf, X_OK) == 0) {
 		if (xbps_file_exec(buf, "post",
-		    pkgname, lver, update ? "yes" : "no", NULL) != 0) {
+		    pkgname, lver, update ? "yes" : "no",
+		    xhp->conffile, NULL) != 0) {
 			xbps_set_cb_state(XBPS_STATE_CONFIGURE_FAIL, errno,
 			    pkgname, lver,
 			    "%s: [configure] INSTALL script failed to execute "
diff --git a/lib/package_purge.c b/lib/package_purge.c
index e43254ff..f2902527 100644
--- a/lib/package_purge.c
+++ b/lib/package_purge.c
@@ -202,7 +202,8 @@ xbps_purge_pkg(const char *pkgname, bool check_state)
 		return rv;
 	}
 	if (access(buf, X_OK) == 0) {
-		rv = xbps_file_exec(buf, "purge", pkgname, version, "no", NULL);
+		rv = xbps_file_exec(buf, "purge", pkgname, version,
+		    "no", xhp->conffile, NULL);
 		if (rv != 0) {
 			free(buf);
 			if (errno && errno != ENOENT) {
diff --git a/lib/package_remove.c b/lib/package_remove.c
index ee6c20cc..7ea8080c 100644
--- a/lib/package_remove.c
+++ b/lib/package_remove.c
@@ -240,7 +240,7 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
 	if (access(buf, X_OK) == 0) {
 		rmfile_exists = true;
 		if (xbps_file_exec(buf, "pre", pkgname, version,
-		    update ? "yes" : "no", NULL) != 0) {
+		    update ? "yes" : "no", xhp->conffile, NULL) != 0) {
 			xbps_set_cb_state(XBPS_STATE_REMOVE_FAIL,
 			    errno, pkgname, version,
 			    "%s: [remove] REMOVE script failed to "
@@ -307,7 +307,8 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
 	 * updating the package.
 	 */
 	if (rmfile_exists &&
-	    (xbps_file_exec(buf, "post", pkgname, version, "no", NULL) != 0)) {
+	    (xbps_file_exec(buf, "post", pkgname, version, "no",
+	     xhp->conffile, NULL) != 0)) {
 		xbps_set_cb_state(XBPS_STATE_REMOVE_FAIL,
 		    errno, pkgname, version,
 		    "%s: [remove] REMOVE script failed to execute "
diff --git a/lib/package_unpack.c b/lib/package_unpack.c
index fe213e68..288d89d4 100644
--- a/lib/package_unpack.c
+++ b/lib/package_unpack.c
@@ -257,7 +257,8 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
 				goto out;
 			}
 			rv = xbps_file_exec(buf, "pre",
-			     pkgname, version, update ? "yes" : "no", NULL);
+			     pkgname, version, update ? "yes" : "no",
+			     xhp->conffile, NULL);
 			free(buf);
 			if (rv != 0) {
 				xbps_set_cb_state(XBPS_STATE_UNPACK_FAIL,