Просмотр исходного кода

Fix dpkg maintainer scripts to honour DPKG_ADMINDIR if present

This will allow the maintainer scripts to work properly if --admindir
has been passed to dpkg. Fallback to using the default admindir in case
we are being called from an old dpkg not setting the environment
variable.
Guillem Jover лет назад: 15
Родитель
Сommit
bf7b7023d4
3 измененных файлов с 6 добавлено и 5 удалено
  1. 3 3
      debian/dpkg.lintian-overrides
  2. 1 1
      debian/dpkg.postinst
  3. 2 1
      debian/dpkg.preinst

+ 3 - 3
debian/dpkg.lintian-overrides

@@ -2,9 +2,9 @@ dpkg: redundant-origin-field
 dpkg: redundant-bugs-field
 dpkg: redundant-bugs-field
 dpkg: arch-dep-package-has-big-usr-share
 dpkg: arch-dep-package-has-big-usr-share
 # False positives, we read from a file not from a tty
 # False positives, we read from a file not from a tty
-dpkg: read-in-maintainer-script preinst:39
 dpkg: read-in-maintainer-script preinst:40
 dpkg: read-in-maintainer-script preinst:40
-dpkg: read-in-maintainer-script preinst:42
-dpkg: read-in-maintainer-script preinst:50
+dpkg: read-in-maintainer-script preinst:41
+dpkg: read-in-maintainer-script preinst:43
+dpkg: read-in-maintainer-script preinst:51
 # On purpose, install-info is only a wrapper that will be removed soon
 # On purpose, install-info is only a wrapper that will be removed soon
 dpkg: binary-without-manpage usr/sbin/install-info
 dpkg: binary-without-manpage usr/sbin/install-info

+ 1 - 1
debian/dpkg.postinst

@@ -21,7 +21,7 @@
 
 
 # Create the database files if they don't already exist
 # Create the database files if they don't already exist
 create_database() {
 create_database() {
-    admindir=/var/lib/dpkg
+    admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
 
 
     for file in diversions statoverride status; do
     for file in diversions statoverride status; do
 	if [ ! -f "$admindir/$file" ]; then
 	if [ ! -f "$admindir/$file" ]; then

+ 2 - 1
debian/dpkg.preinst

@@ -28,7 +28,8 @@ upgrade_dpkg_non_conffile()
 
 
 kill_bad_alternatives () {
 kill_bad_alternatives () {
     local IFS=""
     local IFS=""
-    ALTDIR="/var/lib/dpkg/alternatives"
+    admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
+    ALTDIR="$admindir/alternatives"
     for alt in $ALTDIR/*; do
     for alt in $ALTDIR/*; do
         if [ ! -f $alt ]; then
         if [ ! -f $alt ]; then
             # In case it's been removed by the code below, or in case
             # In case it's been removed by the code below, or in case