[vdr] 08/21: Fixed postinst plugin config migration

Tobias Grimm tiber-guest at moszumanska.debian.org
Wed Mar 25 00:19:23 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 6b7973c184a4f47b47e73145fa9b094d16f42239
Author: etobi <git at e-tobi.net>
Date:   Mon Mar 23 19:03:33 2015 +0100

    Fixed postinst plugin config migration
---
 debian/changelog                                     |  2 +-
 debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index db7cab3..6accfcb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-vdr (2.2.0-1~etobi5) UNRELEASED; urgency=medium
+vdr (2.2.0-2~etobi5) UNRELEASED; urgency=medium
 
   * Updated copyright
   * Arguments for vdr are now read from /etc/vdr/conf.d/
diff --git a/debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate b/debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate
index b8a9184..389e934 100644
--- a/debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate
+++ b/debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate
@@ -20,12 +20,25 @@ dh_vdrplugin_migrate_config() {
     }
   }
 
+  my @updatedOptions;
+
+  # Update options in new config with values from old one
   while(<$newConfigFile>) {
     my $line = $_;
     while (my ($key, $value) = each(%options)) {
-      $line = $value if $line =~ /^$key/;
+      if ($line =~ /^$key/) {
+        $line = $value;
+        push(@updatedOptions,$key);
+      }
+    }
+    print $modifiedConfigFile $line;
+  }
+
+  # Add additional values from old config to new one
+  while (my ($key, $value) = each(%options)) {
+    if (! grep {$_ eq $key} @updatedOptions) {
+      print $modifiedConfigFile $value;
     }
-    print $modifiedConfigFile  $line;
   }
 
   close($originalConfigFile);

-- 
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