[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#657904: converting /usr/share/doc/console-setup into a symlink



tags 657904 + patch
thanks

While working on this bug, I found two related problems:

- console-setup-mini has the same problem as console-setup and also
  needs /usr/share/doc/console-setup-mini converted into a symlink.

- console-setup* packages are missing a tight dependency on
  keyboard-configuration, see Policy 12.3.

See the attached patches which seem to solve these problems, unless the
admin has done something stupid like dropping files into
/usr/share/doc/console-setup.  I don't think it's really necessary to
clean up after them if they do such things.

Note to potential NMU'ers: it is assumed that 1.82 will be the first
fixed version, if that's not the case you need to adjust the postinst
scripts.

Cheers,
       Sven

>From cc4a2e6e8d78076c2ef0f92d3d39958186a6f701 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenjoac@gmx.de>
Date: Sat, 28 Jul 2012 11:55:37 +0200
Subject: [PATCH 1/2] Turn /usr/share/doc/console-setup{,-mini} into symlinks

The snippets here are based on Colin Watson's libpipeline-dev package.
---
 debian/changelog                   |    6 ++++++
 debian/console-setup-mini.postinst |   10 ++++++++++
 debian/console-setup.postinst      |   23 ++++++++++-------------
 3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 459496b..7ea5a98 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+console-setup (1.82) UNRELEASED; urgency=low
+
+  * Turn /usr/share/doc/console-setup{,-mini} into symlinks. Closes: #657904.
+
+ -- Sven Joachim <svenjoac@gmx.de>  Sat, 28 Jul 2012 11:53:49 +0200
+
 console-setup (1.81) unstable; urgency=low
 
   * Team upload
diff --git a/debian/console-setup-mini.postinst b/debian/console-setup-mini.postinst
index b27f3d9..8061bc4 100644
--- a/debian/console-setup-mini.postinst
+++ b/debian/console-setup-mini.postinst
@@ -5,6 +5,16 @@ set -e
 # Source debconf library.
 . /usr/share/debconf/confmodule
 
+if dpkg --compare-versions "$2" lt-nl 1.82; then
+	# Replace directory with symlink.
+	if [ ! -L /usr/share/doc/console-setup-mini ] && \
+	   [ -d /usr/share/doc/console-setup-mini ]; then
+		if rmdir /usr/share/doc/console-setup-mini 2>/dev/null; then
+			ln -sf keyboard-configuration /usr/share/doc/console-setup-mini
+		fi
+	fi
+fi
+
 # This works even if we are not on the console
 setupcon --save-only || true
 # This will protest if we are not on the console
diff --git a/debian/console-setup.postinst b/debian/console-setup.postinst
index d8e7f68..0c8b454 100644
--- a/debian/console-setup.postinst
+++ b/debian/console-setup.postinst
@@ -8,19 +8,16 @@ set -e
 CONFIGDIR=/etc/console-setup
 CONFIGFILE=/etc/default/console-setup
 
-# # turn around bug in dpkg (#17624)
-# cd /usr/share/doc
-# if [ "$1" = configure ]; then
-#     [ -d keyboard-configuration ] || exit 123 # should never fail
-#     if [ -d console-setup -a ! -L console-setup ]; then
-#         # in case the administrator has created some files
-#         cp -a console-setup/* keyboard-configuration/ 2>/dev/null || true
-#         rm -r console-setup
-#         ln -s keyboard-configuration console-setup
-#     elif [ ! -e console-setup ]; then
-#         ln -s keyboard-configuration console-setup
-#     fi
-# fi
+# turn around bug in dpkg (#17624)
+if dpkg --compare-versions "$2" lt-nl 1.82; then
+	# Replace directory with symlink.
+	if [ ! -L /usr/share/doc/console-setup ] && \
+	   [ -d /usr/share/doc/console-setup ]; then
+		if rmdir /usr/share/doc/console-setup 2>/dev/null; then
+			ln -sf keyboard-configuration /usr/share/doc/console-setup
+		fi
+	fi
+fi
 
 if [ "$1" = "configure" ]; then
     
-- 
1.7.10.4

>From c0c90097ec53951e784215b2ee26cb5418ac4635 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenjoac@gmx.de>
Date: Sat, 28 Jul 2012 12:06:52 +0200
Subject: [PATCH 2/2] Tighten the dependency of console-setup-* on
 keyboard-configuration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

As per Policy §12.3, /usr/share/doc symlinks are only allowed if both
packages have the same version.
---
 debian/changelog |    1 +
 debian/control   |    8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7ea5a98..bd51da5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 console-setup (1.82) UNRELEASED; urgency=low
 
   * Turn /usr/share/doc/console-setup{,-mini} into symlinks. Closes: #657904.
+  * Tighten the dependency of console-setup-* on keyboard-configuration.
 
  -- Sven Joachim <svenjoac@gmx.de>  Sat, 28 Jul 2012 11:53:49 +0200
 
diff --git a/debian/control b/debian/control
index fd85468..69f2ed0 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Package: console-setup
 Section: utils
 Architecture: all
 Pre-Depends: debconf (>= 1.5.34)
-Depends: console-setup-linux | console-setup-freebsd, xkb-data (>= 0.9), keyboard-configuration, ${misc:Depends}
+Depends: console-setup-linux | console-setup-freebsd, xkb-data (>= 0.9), keyboard-configuration (= ${source:Version}), ${misc:Depends}
 Suggests: lsb-base (>= 3.0-6), locales
 Conflicts: console-setup-mini
 Breaks: lsb-core (<< 2.0-6), lsb (<< 2.0-6), lsb-base (<< 3.0-6)
@@ -48,7 +48,7 @@ Section: utils
 Priority: extra
 Architecture: all
 Recommends: kbd | console-tools
-Depends: console-setup-linux | console-setup-freebsd, debconf (>= 0.5) | debconf-2.0, keyboard-configuration, ${misc:Depends}
+Depends: console-setup-linux | console-setup-freebsd, debconf (>= 0.5) | debconf-2.0, keyboard-configuration (= ${source:Version}), ${misc:Depends}
 Suggests: lsb-base (>= 3.0-6)
 Conflicts: console-setup
 Breaks: lsb-core (<< 2.0-6), lsb (<< 2.0-6), lsb-base (<< 3.0-6)
@@ -67,7 +67,7 @@ Package: console-setup-linux
 Section: utils
 Priority: optional
 Architecture: all
-Depends: kbd (>= 0.99-12) | console-tools (>= 1:0.2.3-16), ${misc:Depends}
+Depends: kbd (>= 0.99-12) | console-tools (>= 1:0.2.3-16), keyboard-configuration (= ${source:Version}), ${misc:Depends}
 Suggests: console-setup
 Breaks: console-terminus, console-cyrillic (<= 0.9-11), console-setup (<< 1.71)
 Replaces: console-terminus, console-setup (<< 1.71)
@@ -80,7 +80,7 @@ Package: console-setup-freebsd
 Section: utils
 Priority: optional
 Architecture: all
-Depends: vidcontrol, kbdcontrol, ${misc:Depends}
+Depends: vidcontrol, kbdcontrol, keyboard-configuration (= ${source:Version}), ${misc:Depends}
 Suggests: console-setup
 Breaks: console-setup (<< 1.71)
 Replaces: console-setup (<< 1.71)
-- 
1.7.10.4


Reply to: