The following commit has been merged in the master branch:
commit d5b15f56fbc93983005cf2f9cc1117a3bbb3670c
Author: Raphaël Hertzog <[email protected]>
Date:   Fri Apr 16 11:56:17 2010 +0200

    dpkg: export DPKG_LIBDIR to maintainer scripts
    
    It can be used to find out the location of some internal dpkg programs
    that might be called from maintainer scripts. That way we can avoid
    hardcoding /usr/lib/dpkg and maintainer scripts will still work when
    called from a dpkg manually installed in /usr/local for example.

diff --git a/debian/changelog b/debian/changelog
index 4e22316..06757d7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -34,6 +34,9 @@ dpkg (1.15.6.2) UNRELEASED; urgency=low
   * dpkg now exports DPKG_MAINTSCRIPT_NAME to maintainer scripts with the
     type of maintainer script currently running (preinst, postinst, prerm,
     postrm). Closes: #546577
+  * dpkg now exports DPKG_LIBDIR to maintainer scripts pointing to the
+    private directory containing internal programs like the upcoming
+    maintscript-helper.
 
   [ Colin Watson ]
   * Modern tar files typically use NormalFile1 rather than NormalFile0 for
diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index d730923..0c6eaa6 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -81,6 +81,7 @@ DPKG_BEGIN_DECLS
 #define MAINTSCRIPTPKGENVVAR "DPKG_MAINTSCRIPT_PACKAGE"
 #define MAINTSCRIPTARCHENVVAR "DPKG_MAINTSCRIPT_ARCH"
 #define MAINTSCRIPTNAMEENVVAR "DPKG_MAINTSCRIPT_NAME"
+#define MAINTSCRIPTLIBDIRENVVAR "DPKG_LIBDIR"
 #define MAINTSCRIPTDPKGENVVAR "DPKG_RUNNING_VERSION"
 
 #define SHELLENV            "SHELL"
diff --git a/man/dpkg.1 b/man/dpkg.1
index 1073be6..cbac662 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -644,6 +644,10 @@ examine the situation. Contains the path to the new 
conffile.
 Defined by \fBdpkg\fP on the maintainer script environment to the
 version of the currently running \fBdpkg\fP instance.
 .TP
+.B DPKG_LIBDIR
+Defined by \fBdpkg\fP on the maintainer script environment to the
+private library directory of the currently running \fBdpkg\fP instance.
+.TP
 .B DPKG_MAINTSCRIPT_PACKAGE
 Defined by \fBdpkg\fP on the maintainer script environment to the
 package name being handled.
diff --git a/src/Makefile.am b/src/Makefile.am
index b3f2fe5..ddde846 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,6 +6,7 @@ pkgconfdir = $(sysconfdir)/@PACKAGE@
 AM_CPPFLAGS = \
        -DLOCALEDIR=\"$(localedir)\" \
        -DADMINDIR=\"$(admindir)\" \
+       -DPKGLIBDIR=\"$(pkglibdir)\" \
        -idirafter $(top_srcdir)/lib/compat \
        -I$(top_builddir) \
        -I$(top_srcdir)/lib
diff --git a/src/help.c b/src/help.c
index fb5ec93..59bed9a 100644
--- a/src/help.c
+++ b/src/help.c
@@ -261,6 +261,7 @@ do_script(struct pkginfo *pkg, struct pkginfoperfile *pif,
     if (setenv(MAINTSCRIPTPKGENVVAR, pkg->name, 1) ||
         setenv(MAINTSCRIPTARCHENVVAR, pif->architecture, 1) ||
         setenv(MAINTSCRIPTNAMEENVVAR, cmd->argv[0], 1) ||
+        setenv(MAINTSCRIPTLIBDIRENVVAR, PKGLIBDIR, 1) ||
         setenv(MAINTSCRIPTDPKGENVVAR, PACKAGE_VERSION, 1))
       ohshite(_("unable to setenv for maintainer script"));
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to