[dpkg] 147/192: debian: Add support for DPKG_ROOT in dpkg maintainer scripts

Ximin Luo infinity0 at debian.org
Tue Oct 17 11:04:12 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit b77da84672f77ee4eafaef8a308555c496335738
Author: Guillem Jover <guillem at debian.org>
Date:   Sun Sep 24 21:00:06 2017 +0200

    debian: Add support for DPKG_ROOT in dpkg maintainer scripts
---
 debian/changelog     | 1 +
 debian/dpkg.postinst | 2 +-
 debian/dpkg.postrm   | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 13a01b2..12c6065 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -134,6 +134,7 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
     - Remove maintainer script code to handle downgrades to pre-triggers and
       pre-multiarch dpkg versions.
     - Remove alternative logs when purging dpkg (!?).
+    - Add support for DPKG_ROOT in dpkg maintainer scripts.
   * Test suite:
     - Enable perlcritic Documentation::RequirePodSections and
       Miscellanea::ProhibitTies.
diff --git a/debian/dpkg.postinst b/debian/dpkg.postinst
index 9771d7f..e762b8a 100755
--- a/debian/dpkg.postinst
+++ b/debian/dpkg.postinst
@@ -17,7 +17,7 @@ create_database() {
 
 # Create log file and set default permissions if possible
 create_logfile() {
-    logfile=/var/log/dpkg.log
+    logfile=$DPKG_ROOT/var/log/dpkg.log
     touch $logfile
     chmod 644 $logfile
     chown root:root $logfile 2>/dev/null || chown 0:0 $logfile
diff --git a/debian/dpkg.postrm b/debian/dpkg.postrm
index 8fe5a64..e5658ce 100755
--- a/debian/dpkg.postrm
+++ b/debian/dpkg.postrm
@@ -5,7 +5,7 @@ set -e
 
 # Remove log file when dpkg is purged
 remove_logfile() {
-    logdir=/var/log
+    logdir=$DPKG_ROOT/var/log
 
     rm -f $logdir/dpkg.log $logdir/dpkg.log.* 2>/dev/null
     rm -f $logdir/alternatives.log $logdir/alternatives.log.* 2>/dev/null

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list