[vdr] 15/21: Use dpkg-query to check if a plugin config was not yet installed and needs to be symlinked in postinst

Tobias Grimm tiber-guest at moszumanska.debian.org
Wed Mar 25 00:19:24 UTC 2015


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

tiber-guest pushed a commit to branch e-tobi
in repository vdr.

commit b51a24e6bfeae5d68ebda04662dc10c7a1f8254e
Author: etobi <git at e-tobi.net>
Date:   Wed Mar 25 00:08:08 2015 +0100

    Use dpkg-query to check if a plugin config was not yet installed and needs to be symlinked in postinst
---
 debian/dh-addon-vdrplugin/dh_vdrplugin_enable      | 2 +-
 debian/dh-addon-vdrplugin/preinst-vdrplugin-enable | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/debian/dh-addon-vdrplugin/dh_vdrplugin_enable b/debian/dh-addon-vdrplugin/dh_vdrplugin_enable
index bb1d6e8..d0467ab 100755
--- a/debian/dh-addon-vdrplugin/dh_vdrplugin_enable
+++ b/debian/dh-addon-vdrplugin/dh_vdrplugin_enable
@@ -163,7 +163,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
   my @enabled_configs = grep { looks_like_number($config_files{$_}) } (keys %config_files);
   if (@enabled_configs) {
     my $configs = join(' ', map { (basename($_), $config_files{$_}) } (@enabled_configs));
-    autoscript($package, "preinst", "preinst-vdrplugin-enable", "s/#ENABLEDCONFIGS#/$configs/");
+    autoscript($package, "preinst", "preinst-vdrplugin-enable", "s/#PKGNAME#/$package/; s/#ENABLEDCONFIGS#/$configs/");
     autoscript($package, "postinst", "postinst-vdrplugin-enable", "s/#ENABLEDCONFIGS#/$configs/");
     autoscript($package, "postrm", "postrm-vdrplugin-enable", "s/#ENABLEDCONFIGS#/$configs/");
   }
diff --git a/debian/dh-addon-vdrplugin/preinst-vdrplugin-enable b/debian/dh-addon-vdrplugin/preinst-vdrplugin-enable
index cae1fbc..9676a33 100644
--- a/debian/dh-addon-vdrplugin/preinst-vdrplugin-enable
+++ b/debian/dh-addon-vdrplugin/preinst-vdrplugin-enable
@@ -9,14 +9,17 @@
 # by creating a /etc/vdr/conf.d/*.dpkg-vdr-plugin-enable "tag"-file.
 #
 dh_vdrplugin_prepare_enable() {
+  local pkgname="$1"
+  shift
   while [ $# -gt 0 ] ; do
     local config=$1
     local priority=$2
     shift 2
-    if [ ! -e "/etc/vdr/conf.avail/$config" ] ; then
+    local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $pkgname | sed -n -e "\' $config ' { s/ obsolete$//; s/.* //; p }")"
+    if [ -z "$old_md5sum" ] ; then
       touch "/etc/vdr/conf.d/$priority-$config.dpkg-vdrplugin-enable"
     fi
   done
 }
 
-dh_vdrplugin_prepare_enable #ENABLEDCONFIGS#
+dh_vdrplugin_prepare_enable #PKGNAME# #ENABLEDCONFIGS#

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vdr-dvb/vdr.git



More information about the pkg-vdr-dvb-changes mailing list